poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ber...@apache.org
Subject svn commit: r1382339 - in /poi/trunk: src/java/org/apache/poi/hssf/eventusermodel/MissingRecordAwareHSSFListener.java src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.java test-data/spreadsheet/53588.xls
Date Sat, 08 Sep 2012 18:35:04 GMT
Author: berlog
Date: Sat Sep  8 18:35:04 2012
New Revision: 1382339

URL: http://svn.apache.org/viewvc?rev=1382339&view=rev
Log:
fixed bug 53588

Added:
    poi/trunk/test-data/spreadsheet/53588.xls   (with props)
Modified:
    poi/trunk/src/java/org/apache/poi/hssf/eventusermodel/MissingRecordAwareHSSFListener.java
    poi/trunk/src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.java

Modified: poi/trunk/src/java/org/apache/poi/hssf/eventusermodel/MissingRecordAwareHSSFListener.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/eventusermodel/MissingRecordAwareHSSFListener.java?rev=1382339&r1=1382338&r2=1382339&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/eventusermodel/MissingRecordAwareHSSFListener.java
(original)
+++ poi/trunk/src/java/org/apache/poi/hssf/eventusermodel/MissingRecordAwareHSSFListener.java
Sat Sep  8 18:35:04 2012
@@ -20,15 +20,7 @@ package org.apache.poi.hssf.eventusermod
 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 MissingRecordAwareHSS
 			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;
 

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.java?rev=1382339&r1=1382338&r2=1382339&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.java
(original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/eventusermodel/TestMissingRecordAwareHSSFListener.java
Sat Sep  8 18:35:04 2012
@@ -461,4 +461,22 @@ public final class TestMissingRecordAwar
 		}
 		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);
+    }
 }

Added: poi/trunk/test-data/spreadsheet/53588.xls
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/53588.xls?rev=1382339&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/test-data/spreadsheet/53588.xls
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message