You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2011/08/11 13:13:03 UTC

svn commit: r1156573 - in /poi/trunk/src: documentation/content/xdocs/status.xml java/org/apache/poi/poifs/filesystem/NDocumentInputStream.java testcases/org/apache/poi/hssf/usermodel/TestBugs.java

Author: nick
Date: Thu Aug 11 11:13:03 2011
New Revision: 1156573

URL: http://svn.apache.org/viewvc?rev=1156573&view=rev
Log:
Patch from Antoni Mylka from bug #51535 - correct signed vs unsigned short reading in NDocumentInputStream

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

Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=1156573&r1=1156572&r2=1156573&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Thu Aug 11 11:13:03 2011
@@ -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>

Modified: poi/trunk/src/java/org/apache/poi/poifs/filesystem/NDocumentInputStream.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/filesystem/NDocumentInputStream.java?rev=1156573&r1=1156572&r2=1156573&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/filesystem/NDocumentInputStream.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/filesystem/NDocumentInputStream.java Thu Aug 11 11:13:03 2011
@@ -275,7 +275,10 @@ public final class NDocumentInputStream 
 
    @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 
 		checkAvaliable(SIZE_SHORT);
       byte[] data = new byte[SIZE_SHORT];
       readFully(data, 0, SIZE_SHORT);
-      return LittleEndian.getShort(data);
+      return LittleEndian.getUShort(data);
 	}
 
    @Override

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=1156573&r1=1156572&r2=1156573&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 Thu Aug 11 11:13:03 2011
@@ -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(



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