poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r1597098 - in /poi/trunk/src: java/org/apache/poi/hssf/record/NoteRecord.java testcases/org/apache/poi/hssf/usermodel/TestBugs.java
Date Fri, 23 May 2014 14:07:21 GMT
Author: nick
Date: Fri May 23 14:07:20 2014
New Revision: 1597098

URL: http://svn.apache.org/r1597098
Log:
If a NoteRecord has no author tag, it seems it can sometimes be double padded. Fixes #47251

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

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/NoteRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/NoteRecord.java?rev=1597098&r1=1597097&r2=1597098&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/NoteRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/NoteRecord.java Fri May 23 14:07:20 2014
@@ -90,7 +90,11 @@ public final class NoteRecord extends St
 		}
  		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) {

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java?rev=1597098&r1=1597097&r2=1597098&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java Fri May 23 14:07:20
2014
@@ -1651,8 +1651,7 @@ public final class TestBugs extends Base
         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");
     }
     
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message