summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/java/org/apache/poi/hssf/eventusermodel/MissingRecordAwareHSSFListener.java15
-rw-r--r--src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.java18
-rw-r--r--test-data/spreadsheet/53588.xlsbin0 -> 15360 bytes
3 files changed, 24 insertions, 9 deletions
diff --git a/src/java/org/apache/poi/hssf/eventusermodel/MissingRecordAwareHSSFListener.java b/src/java/org/apache/poi/hssf/eventusermodel/MissingRecordAwareHSSFListener.java
index 7e5007a657..15206bd218 100644
--- a/src/java/org/apache/poi/hssf/eventusermodel/MissingRecordAwareHSSFListener.java
+++ b/src/java/org/apache/poi/hssf/eventusermodel/MissingRecordAwareHSSFListener.java
@@ -20,15 +20,7 @@ package org.apache.poi.hssf.eventusermodel;
import org.apache.poi.hssf.eventusermodel.dummyrecord.LastCellOfRowDummyRecord;
import org.apache.poi.hssf.eventusermodel.dummyrecord.MissingCellDummyRecord;
import org.apache.poi.hssf.eventusermodel.dummyrecord.MissingRowDummyRecord;
-import org.apache.poi.hssf.record.BOFRecord;
-import org.apache.poi.hssf.record.CellValueRecordInterface;
-import org.apache.poi.hssf.record.MulBlankRecord;
-import org.apache.poi.hssf.record.MulRKRecord;
-import org.apache.poi.hssf.record.NoteRecord;
-import org.apache.poi.hssf.record.Record;
-import org.apache.poi.hssf.record.RecordFactory;
-import org.apache.poi.hssf.record.RowRecord;
-import org.apache.poi.hssf.record.SharedFormulaRecord;
+import org.apache.poi.hssf.record.*;
/**
* <p>A HSSFListener which tracks rows and columns, and will
@@ -72,6 +64,11 @@ public final class MissingRecordAwareHSSFListener implements HSSFListener {
thisRow = valueRec.getRow();
thisColumn = valueRec.getColumn();
} else {
+ if (record instanceof StringRecord){
+ //it contains only cashed result of the previous FormulaRecord evaluation
+ childListener.processRecord(record);
+ return;
+ }
thisRow = -1;
thisColumn = -1;
diff --git a/src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.java b/src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.java
index e632cbbbb1..6a60f94546 100644
--- a/src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.java
+++ b/src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.java
@@ -461,4 +461,22 @@ public final class TestMissingRecordAwareHSSFListener extends TestCase {
}
assertEquals(2, eorCount);
}
+
+ public void testStringRecordHandling(){
+ readRecords("53588.xls");
+ Record[] rr = r;
+ int missingCount=0;
+ int lastCount=0;
+ for (int i = 0; i < rr.length; i++) {
+ Record record = rr[i];
+ if (record instanceof MissingCellDummyRecord) {
+ missingCount++;
+ }
+ if (record instanceof LastCellOfRowDummyRecord) {
+ lastCount++;
+ }
+ }
+ assertEquals(1, missingCount);
+ assertEquals(1, lastCount);
+ }
}
diff --git a/test-data/spreadsheet/53588.xls b/test-data/spreadsheet/53588.xls
new file mode 100644
index 0000000000..716305b544
--- /dev/null
+++ b/test-data/spreadsheet/53588.xls
Binary files differ