Fix for bug #46137 - continue records after eofrecord

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@712652 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2008-11-10 12:20:49 +00:00
parent 02db58997d
commit f07b507940
5 changed files with 16 additions and 0 deletions

View File

@ -37,6 +37,7 @@
<!-- Don't forget to update status.xml too! --> <!-- Don't forget to update status.xml too! -->
<release version="3.5-beta4" date="2008-??-??"> <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">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">45784 - More fixes to SeriesTextRecord</action>
<action dev="POI-DEVELOPERS" type="fix">46033 - fixed TableCell to correctly set text type</action> <action dev="POI-DEVELOPERS" type="fix">46033 - fixed TableCell to correctly set text type</action>

View File

@ -34,6 +34,7 @@
<!-- Don't forget to update changes.xml too! --> <!-- Don't forget to update changes.xml too! -->
<changes> <changes>
<release version="3.5-beta4" date="2008-??-??"> <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">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">45784 - More fixes to SeriesTextRecord</action>
<action dev="POI-DEVELOPERS" type="fix">46033 - fixed TableCell to correctly set text type</action> <action dev="POI-DEVELOPERS" type="fix">46033 - fixed TableCell to correctly set text type</action>

View File

@ -383,6 +383,10 @@ public final class RecordFactory {
//Gracefully handle records that we don't know about, //Gracefully handle records that we don't know about,
//that happen to be continued //that happen to be continued
records.add(record); 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 { } else {
throw new RecordFormatException("Unhandled Continue Record"); throw new RecordFormatException("Unhandled Continue Record");
} }

Binary file not shown.

View File

@ -1523,4 +1523,14 @@ public final class TestBugs extends TestCase {
assertEquals(64, green.getCellStyle().getFillBackgroundColor()); assertEquals(64, green.getCellStyle().getFillBackgroundColor());
assertEquals("0:FFFF:0", p.getColor(11).getHexString()); 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);
}
} }