From ca3e6d3a221ad83714fbb8de04d56ea557f2fffd Mon Sep 17 00:00:00 2001 From: mareks Date: Wed, 3 Apr 2024 15:02:24 +0200 Subject: [PATCH] bugfix: since columns are nullable now, wasNull() must return correct value --- src/com/inet/excel/ExcelSheetResultSet.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/com/inet/excel/ExcelSheetResultSet.java b/src/com/inet/excel/ExcelSheetResultSet.java index 3015488..277dfe3 100644 --- a/src/com/inet/excel/ExcelSheetResultSet.java +++ b/src/com/inet/excel/ExcelSheetResultSet.java @@ -35,6 +35,7 @@ public class ExcelSheetResultSet extends ExcelResultSet { private List> rowBatch; private int currentRowIndex; private int currentBatchIndex; + private boolean wasNull; private boolean closed; /** Constructor of the class. @@ -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; } @@ -152,7 +154,9 @@ public boolean isClosed() throws SQLException { protected 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; } /** @@ -161,6 +165,6 @@ protected T getValue( int columnIndex ) throws SQLException { @Override public boolean wasNull() throws SQLException { throwIfAlreadyClosed(); - return false; + return wasNull; } }