aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2014-05-23 14:07:20 +0000
committerNick Burch <nick@apache.org>2014-05-23 14:07:20 +0000
commit2bfef69f370e6500144ad937e7cbe90430c7c327 (patch)
tree8634c5929c99425a0e1078e09c99d51b9411e9bb
parentc2edd459c77750d868f6874a4b3977e6b9b8aa4e (diff)
downloadpoi-2bfef69f370e6500144ad937e7cbe90430c7c327.tar.gz
poi-2bfef69f370e6500144ad937e7cbe90430c7c327.zip
If a NoteRecord has no author tag, it seems it can sometimes be double padded. Fixes #47251
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1597098 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/poi/hssf/record/NoteRecord.java6
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java3
2 files changed, 6 insertions, 3 deletions
diff --git a/src/java/org/apache/poi/hssf/record/NoteRecord.java b/src/java/org/apache/poi/hssf/record/NoteRecord.java
index 86d4609606..86c239c6e5 100644
--- a/src/java/org/apache/poi/hssf/record/NoteRecord.java
+++ b/src/java/org/apache/poi/hssf/record/NoteRecord.java
@@ -90,7 +90,11 @@ public final class NoteRecord extends StandardRecord {
}
if (in.available() == 1) {
field_7_padding = Byte.valueOf(in.readByte());
- }
+ } else if (in.available() == 2 && length == 0) {
+ // If there's no author, may be double padded
+ field_7_padding = Byte.valueOf(in.readByte());
+ in.readByte();
+ }
}
public void serialize(LittleEndianOutput out) {
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
index a6894a1a1b..989ea4125f 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
@@ -1651,8 +1651,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
openSample("47251.xls");
// Now with one that triggers on NoteRecord
- // TODO Fix the bug and enable this bit of the test
- //openSample("47251_1.xls");
+ openSample("47251_1.xls");
}
/**