]> source.dussan.org Git - poi.git/commitdiff
Fix for bug #46137 - continue records after eofrecord
authorNick Burch <nick@apache.org>
Mon, 10 Nov 2008 12:20:49 +0000 (12:20 +0000)
committerNick Burch <nick@apache.org>
Mon, 10 Nov 2008 12:20:49 +0000 (12:20 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@712652 13f79535-47bb-0310-9956-ffa450edef68

src/documentation/content/xdocs/changes.xml
src/documentation/content/xdocs/status.xml
src/java/org/apache/poi/hssf/record/RecordFactory.java
src/testcases/org/apache/poi/hssf/data/46137.xls [new file with mode: 0644]
src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java

index 0d04e7ef44965df2edc791f0deb898f816dbd723..259caeae3014e80efa98925b9c2c186959dec3a4 100644 (file)
@@ -37,6 +37,7 @@
 
                <!-- Don't forget to update status.xml too! -->
         <release version="3.5-beta4" date="2008-??-??">
+           <action dev="POI-DEVELOPERS" type="fix">46137 - Handle odd files with a ContinueRecord after EOFRecord</action>
            <action dev="POI-DEVELOPERS" type="fix">Fixed problem with linking shared formulas when ranges overlap</action>
            <action dev="POI-DEVELOPERS" type="fix">45784 - More fixes to SeriesTextRecord</action>
            <action dev="POI-DEVELOPERS" type="fix">46033 - fixed TableCell to correctly set text type</action>
index 430a136bfb7cee6ceb108552958860e089f0adea..3cef6f652cff6811bbe2e8815930001b9b9ea83b 100644 (file)
@@ -34,6 +34,7 @@
        <!-- Don't forget to update changes.xml too! -->
     <changes>
         <release version="3.5-beta4" date="2008-??-??">
+                       <action dev="POI-DEVELOPERS" type="fix">46137 - Handle odd files with a ContinueRecord after EOFRecord</action>
            <action dev="POI-DEVELOPERS" type="fix">Fixed problem with linking shared formulas when ranges overlap</action>
            <action dev="POI-DEVELOPERS" type="fix">45784 - More fixes to SeriesTextRecord</action>
            <action dev="POI-DEVELOPERS" type="fix">46033 - fixed TableCell to correctly set text type</action>
index bae867e51260607d2893a5fe2fe29dc258d8e1fa..da8424e46653cba1ee9e8792f96fd2893f59732b 100644 (file)
@@ -383,6 +383,10 @@ public final class RecordFactory {
                                        //Gracefully handle records that we don't know about,
                                        //that happen to be continued
                                        records.add(record);
+                               } else if (lastRecord instanceof EOFRecord) {
+                                       // This is really odd, but excel still sometimes
+                                       //  outputs a file like this all the same
+                           records.add(record);
                                } else {
                                        throw new RecordFormatException("Unhandled Continue Record");
                                }
diff --git a/src/testcases/org/apache/poi/hssf/data/46137.xls b/src/testcases/org/apache/poi/hssf/data/46137.xls
new file mode 100644 (file)
index 0000000..5fc399d
Binary files /dev/null and b/src/testcases/org/apache/poi/hssf/data/46137.xls differ
index 1f7648ed757f5db278937da0bb11438f89683a58..024f94e5b785cab31d725ab37fea2a3c2ef05cab 100644 (file)
@@ -1523,4 +1523,14 @@ public final class TestBugs extends TestCase {
        assertEquals(64, green.getCellStyle().getFillBackgroundColor());
        assertEquals("0:FFFF:0", p.getColor(11).getHexString());
     }
+    
+    /**
+     * ContinueRecord after EOF
+     */
+    public void test46137() {
+        // This used to break
+        HSSFWorkbook wb = openSample("46137.xls");
+        assertEquals(7, wb.getNumberOfSheets());
+        wb = HSSFTestDataSamples.writeOutAndReadBack(wb);
+    }
 }