}
public String readCompressedUnicode(int length) {
+ if(length == 0) {
+ return "";
+ }
if ((length < 0) || ((remaining() < length) && !isContinueNext())) {
throw new IllegalArgumentException("Illegal length " + length);
}
StringBuffer buf = new StringBuffer(length);
for (int i=0;i<length;i++) {
if ((remaining() == 0) && (isContinueNext())) {
- nextRecord();
+ nextRecord();
int compressByte = readByte();
if(compressByte != 0) throw new IllegalArgumentException("compressByte in continue records must be 0 while reading compressed unicode");
}
assertEquals(2, wb.getNumberOfSheets());
}
+
+ /**
+ * Used to give problems due to trying to read a zero
+ * length string, but that's now properly handled
+ */
+ public void test44643() throws Exception {
+ FileInputStream in = new FileInputStream(new File(cwd, "44643.xls"));
+
+ // Used to blow up with an IllegalArgumentException
+ HSSFWorkbook wb = new HSSFWorkbook(in);
+ in.close();
+
+ assertEquals(1, wb.getNumberOfSheets());
+ }
}