diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index b1790bf74..96acff77e 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 51535 - correct signed vs unsigned short reading in NDocumentInputStream 51634 - support SXSSF streaming from templates initial support for XSLF usermodel API 51187 - fixed OPCPackage to correctly handle self references diff --git a/src/java/org/apache/poi/poifs/filesystem/NDocumentInputStream.java b/src/java/org/apache/poi/poifs/filesystem/NDocumentInputStream.java index cb4f7ffe7..1db8975d2 100644 --- a/src/java/org/apache/poi/poifs/filesystem/NDocumentInputStream.java +++ b/src/java/org/apache/poi/poifs/filesystem/NDocumentInputStream.java @@ -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 diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java index 25ad94e35..d53e50783 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java @@ -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(