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 abad8d1b09
commit 5cbd261957
3 changed files with 8 additions and 4 deletions

View 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>

View 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

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");
HSSFWorkbook wbPOIFS = new HSSFWorkbook(new POIFSFileSystem(