aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases
diff options
context:
space:
mode:
authorJosh Micich <josh@apache.org>2009-12-02 21:29:44 +0000
committerJosh Micich <josh@apache.org>2009-12-02 21:29:44 +0000
commit54d27d0cc616958254c8e5531a9dd9b64506491b (patch)
tree7b1b80bfc747a01b2185b663af86c48218607c53 /src/testcases
parent3977d9063121ae5f5ae27e16e691a39685451da4 (diff)
downloadpoi-54d27d0cc616958254c8e5531a9dd9b64506491b.tar.gz
poi-54d27d0cc616958254c8e5531a9dd9b64506491b.zip
Bugzilla 48332 - fixed ColumnInfoRecord to tolerate missing reserved field
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@886311 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases')
-rw-r--r--src/testcases/org/apache/poi/hssf/record/TestColumnInfoRecord.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/hssf/record/TestColumnInfoRecord.java b/src/testcases/org/apache/poi/hssf/record/TestColumnInfoRecord.java
index 8f11d90604..fd0e41217e 100644
--- a/src/testcases/org/apache/poi/hssf/record/TestColumnInfoRecord.java
+++ b/src/testcases/org/apache/poi/hssf/record/TestColumnInfoRecord.java
@@ -49,6 +49,30 @@ public final class TestColumnInfoRecord extends TestCase {
}
/**
+ * Some applications skip the last reserved field when writing {@link ColumnInfoRecord}s
+ * The attached file was apparently created by "SoftArtisans OfficeWriter for Excel".
+ * Excel reads that file OK and assumes zero for the value of the reserved field.
+ */
+ public void testZeroResevedBytes_bug48332() {
+ // Taken from bugzilla attachment 24661 (offset 0x1E73)
+ byte[] inpData = HexRead.readFromString("7D 00 0A 00 00 00 00 00 D5 19 0F 00 02 00");
+ byte[] outData = HexRead.readFromString("7D 00 0C 00 00 00 00 00 D5 19 0F 00 02 00 00 00");
+
+ RecordInputStream in = TestcaseRecordInputStream.create(inpData);
+ ColumnInfoRecord cir;
+ try {
+ cir = new ColumnInfoRecord(in);
+ } catch (RuntimeException e) {
+ if (e.getMessage().equals("Unusual record size remaining=(0)")) {
+ throw new AssertionFailedError("Identified bug 48332");
+ }
+ throw e;
+ }
+ assertEquals(0, in.remaining());
+ assertTrue(Arrays.equals(outData, cir.serialize()));
+ }
+
+ /**
* Some sample files have just one reserved byte (field 6):
* OddStyleRecord.xls, NoGutsRecords.xls, WORKBOOK_in_capitals.xls
* but this seems to cause no problem to Excel