Patch from Antoni Mylka from bug #51535 - correct signed vs unsigned short reading in NDocumentInputStream

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1156573 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2011-08-11 11:13:03 +00:00
parent 34c7fc8f98
commit 1072b40726
3 changed files with 8 additions and 4 deletions

View File

@ -34,6 +34,7 @@
<changes> <changes>
<release version="3.8-beta4" date="2011-??-??"> <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">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="add">initial support for XSLF usermodel API</action>
<action dev="poi-developers" type="fix">51187 - fixed OPCPackage to correctly handle self references</action> <action dev="poi-developers" type="fix">51187 - fixed OPCPackage to correctly handle self references</action>

View File

@ -275,7 +275,10 @@ public final class NDocumentInputStream extends DocumentInputStream {
@Override @Override
public short readShort() { 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 @Override
@ -291,7 +294,7 @@ public final class NDocumentInputStream extends DocumentInputStream {
checkAvaliable(SIZE_SHORT); checkAvaliable(SIZE_SHORT);
byte[] data = new byte[SIZE_SHORT]; byte[] data = new byte[SIZE_SHORT];
readFully(data, 0, SIZE_SHORT); readFully(data, 0, SIZE_SHORT);
return LittleEndian.getShort(data); return LittleEndian.getUShort(data);
} }
@Override @Override

View 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"); byte[] data = HSSFITestDataProvider.instance.getTestDataFileContent("51535.xls");
HSSFWorkbook wbPOIFS = new HSSFWorkbook(new POIFSFileSystem( HSSFWorkbook wbPOIFS = new HSSFWorkbook(new POIFSFileSystem(