Skip to content

Commit

Permalink
bugfix: since columns are nullable now, wasNull() must return correct
Browse files Browse the repository at this point in the history
value
  • Loading branch information
mareks committed Apr 3, 2024
1 parent 243ce8f commit ca3e6d3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/com/inet/excel/ExcelSheetResultSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class ExcelSheetResultSet extends ExcelResultSet {
private List<List<Object>> rowBatch;
private int currentRowIndex;
private int currentBatchIndex;
private boolean wasNull;
private boolean closed;

/** Constructor of the class.
Expand All @@ -56,6 +57,7 @@ public ExcelSheetResultSet( ExcelParser parser, String sheetName, int maxRowsPer
this.rowCount = parser.getRowCount( sheetName );
this.currentRowIndex = -1;
this.currentBatchIndex = -1;
this.wasNull = false;
this.closed = false;
}

Expand Down Expand Up @@ -152,7 +154,9 @@ public boolean isClosed() throws SQLException {
protected <T> T getValue( int columnIndex ) throws SQLException {
throwIfAlreadyClosedOrReachedEnd();
throwIfColumnIndexIsInvalid( columnIndex );
return (T)rowBatch.get( currentBatchIndex ).get( columnIndex - 1 );
T value = (T)rowBatch.get( currentBatchIndex ).get( columnIndex - 1 );
wasNull = value == null;
return value;
}

/**
Expand All @@ -161,6 +165,6 @@ protected <T> T getValue( int columnIndex ) throws SQLException {
@Override
public boolean wasNull() throws SQLException {
throwIfAlreadyClosed();
return false;
return wasNull;
}
}

0 comments on commit ca3e6d3

Please # to comment.