@@ -293,11 +293,11 @@ public void beforeFirst() throws SQLException {
293
293
294
294
private void checkIndex (final int index ) throws SQLException {
295
295
if (this .currentRow != null ) {
296
- this .wasNull = this .currentRow .isNull (index - 1 );
297
296
if (index < 1 || index > this .currentRow .getColumnDefinitions ().size ()) {
298
297
throw new SQLSyntaxErrorException (String .format (MUST_BE_POSITIVE , index ) + StringUtils .SPACE
299
298
+ this .currentRow .getColumnDefinitions ().size ());
300
299
}
300
+ this .wasNull = this .currentRow .isNull (index - 1 );
301
301
} else if (this .driverResultSet != null ) {
302
302
if (index < 1 || index > this .driverResultSet .getColumnDefinitions ().size ()) {
303
303
throw new SQLSyntaxErrorException (String .format (MUST_BE_POSITIVE , index ) + StringUtils .SPACE
@@ -309,10 +309,10 @@ private void checkIndex(final int index) throws SQLException {
309
309
310
310
private void checkName (final String name ) throws SQLException {
311
311
if (this .currentRow != null ) {
312
- this .wasNull = this .currentRow .isNull (name );
313
312
if (!this .currentRow .getColumnDefinitions ().contains (name )) {
314
313
throw new SQLSyntaxErrorException (String .format (VALID_LABELS , name ));
315
314
}
315
+ this .wasNull = this .currentRow .isNull (name );
316
316
} else if (this .driverResultSet != null ) {
317
317
if (!this .driverResultSet .getColumnDefinitions ().contains (name )) {
318
318
throw new SQLSyntaxErrorException (String .format (VALID_LABELS , name ));
@@ -344,7 +344,12 @@ public void close() throws SQLException {
344
344
public int findColumn (final String columnLabel ) throws SQLException {
345
345
checkNotClosed ();
346
346
checkName (columnLabel );
347
- return this .currentRow .getColumnDefinitions ().firstIndexOf (columnLabel );
347
+ if (this .currentRow != null ) {
348
+ return this .currentRow .getColumnDefinitions ().firstIndexOf (columnLabel ) + 1 ;
349
+ } else if (this .driverResultSet != null ) {
350
+ return this .driverResultSet .getColumnDefinitions ().firstIndexOf (columnLabel ) + 1 ;
351
+ }
352
+ throw new SQLSyntaxErrorException (String .format (VALID_LABELS , columnLabel ));
348
353
}
349
354
350
355
@ Override
@@ -1025,7 +1030,7 @@ public Object getObject(final String columnLabel) throws SQLException {
1025
1030
@ Override
1026
1031
public <T > T getObject (final String columnLabel , final Class <T > type ) throws SQLException {
1027
1032
final int index = findColumn (columnLabel );
1028
- return getObject (index + 1 , type );
1033
+ return getObject (index , type );
1029
1034
}
1030
1035
1031
1036
@ Override
@@ -1149,7 +1154,7 @@ public <T> T getObjectFromJson(final int columnIndex, final Class<T> type) throw
1149
1154
@ Override
1150
1155
public <T > T getObjectFromJson (final String columnLabel , final Class <T > type ) throws SQLException {
1151
1156
final int index = findColumn (columnLabel );
1152
- return getObjectFromJson (index + 1 , type );
1157
+ return getObjectFromJson (index , type );
1153
1158
}
1154
1159
1155
1160
@ Override
0 commit comments