Skip to content

Commit ca3e6d3

Browse files
author
mareks
committed
bugfix: since columns are nullable now, wasNull() must return correct
value
1 parent 243ce8f commit ca3e6d3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/com/inet/excel/ExcelSheetResultSet.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public class ExcelSheetResultSet extends ExcelResultSet {
3535
private List<List<Object>> rowBatch;
3636
private int currentRowIndex;
3737
private int currentBatchIndex;
38+
private boolean wasNull;
3839
private boolean closed;
3940

4041
/** Constructor of the class.
@@ -56,6 +57,7 @@ public ExcelSheetResultSet( ExcelParser parser, String sheetName, int maxRowsPer
5657
this.rowCount = parser.getRowCount( sheetName );
5758
this.currentRowIndex = -1;
5859
this.currentBatchIndex = -1;
60+
this.wasNull = false;
5961
this.closed = false;
6062
}
6163

@@ -152,7 +154,9 @@ public boolean isClosed() throws SQLException {
152154
protected <T> T getValue( int columnIndex ) throws SQLException {
153155
throwIfAlreadyClosedOrReachedEnd();
154156
throwIfColumnIndexIsInvalid( columnIndex );
155-
return (T)rowBatch.get( currentBatchIndex ).get( columnIndex - 1 );
157+
T value = (T)rowBatch.get( currentBatchIndex ).get( columnIndex - 1 );
158+
wasNull = value == null;
159+
return value;
156160
}
157161

158162
/**
@@ -161,6 +165,6 @@ protected <T> T getValue( int columnIndex ) throws SQLException {
161165
@Override
162166
public boolean wasNull() throws SQLException {
163167
throwIfAlreadyClosed();
164-
return false;
168+
return wasNull;
165169
}
166170
}

0 commit comments

Comments
 (0)