]> source.dussan.org Git - poi.git/commitdiff
Patch from Antoni Mylka from bug #51535 - correct signed vs unsigned short reading...
authorNick Burch <nick@apache.org>
Thu, 11 Aug 2011 11:13:03 +0000 (11:13 +0000)
committerNick Burch <nick@apache.org>
Thu, 11 Aug 2011 11:13:03 +0000 (11:13 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1156573 13f79535-47bb-0310-9956-ffa450edef68

src/documentation/content/xdocs/status.xml
src/java/org/apache/poi/poifs/filesystem/NDocumentInputStream.java
src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java

index b1790bf74cd3bfab610ef3c34a74ac51368d4bf8..96acff77ec878cb027cccda3cf0840171d5b2305 100644 (file)
@@ -34,6 +34,7 @@
 
     <changes>
         <release version="3.8-beta4" date="2011-??-??">
+           <action dev="poi-developers" type="fix">51535 - correct signed vs unsigned short reading in NDocumentInputStream</action>
            <action dev="poi-developers" type="add">51634 - support SXSSF streaming from templates</action>
            <action dev="poi-developers" type="add">initial support for XSLF usermodel API</action>
            <action dev="poi-developers" type="fix">51187 - fixed OPCPackage to correctly handle self references</action>
index cb4f7ffe757ecb7b499456011924a1bf52b039ee..1db8975d2b960b2967226eed202a983452624636 100644 (file)
@@ -275,7 +275,10 @@ public final class NDocumentInputStream extends DocumentInputStream {
 
    @Override
    public short readShort() {
-      return (short) readUShort();
+      checkAvaliable(SIZE_SHORT);
+      byte[] data = new byte[SIZE_SHORT];
+      readFully(data, 0, SIZE_SHORT);
+      return LittleEndian.getShort(data);
    }
 
    @Override
@@ -291,7 +294,7 @@ public final class NDocumentInputStream extends DocumentInputStream {
                checkAvaliable(SIZE_SHORT);
       byte[] data = new byte[SIZE_SHORT];
       readFully(data, 0, SIZE_SHORT);
-      return LittleEndian.getShort(data);
+      return LittleEndian.getUShort(data);
        }
 
    @Override
index 25ad94e3529c9d271871b139eba9b060edda3b43..d53e50783e00524aea927a5170688a20dcefc2e5 100644 (file)
@@ -2144,9 +2144,9 @@ if(1==2) {
     }
     
     /**
-     * Large row numbers
+     * Large row numbers and NPOIFS vs POIFS
      */
-    public void DISABLEDtest51535() throws Exception {
+    public void test51535() throws Exception {
        byte[] data = HSSFITestDataProvider.instance.getTestDataFileContent("51535.xls");
        
        HSSFWorkbook wbPOIFS = new HSSFWorkbook(new POIFSFileSystem(