]> source.dussan.org Git - poi.git/commitdiff
If a NoteRecord has no author tag, it seems it can sometimes be double padded. Fixes...
authorNick Burch <nick@apache.org>
Fri, 23 May 2014 14:07:20 +0000 (14:07 +0000)
committerNick Burch <nick@apache.org>
Fri, 23 May 2014 14:07:20 +0000 (14:07 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1597098 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/record/NoteRecord.java
src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java

index 86d4609606db0c790a97d8a6422eb3063314fb42..86c239c6e5a644d14464fd38233e13fec582d20e 100644 (file)
@@ -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) {
index a6894a1a1b0a82eddf4dc4c2230b2bfa27a9a0b0..989ea4125f0bbeb0ce9066d60e3584ed2853736d 100644 (file)
@@ -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");
     }
     
     /**