Summary: | NPE in ODocumentInputStream.readUShort() when parsing XLS | ||
---|---|---|---|
Product: | POI | Reporter: | tjuchniewicz <tjuchniewicz> |
Component: | HSSF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED WONTFIX | ||
Severity: | major | ||
Priority: | P2 | ||
Version: | 3.9-dev | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All | ||
Attachments: | Example XLS file. |
Does opening the file with NPOIFSFileSystem rather than the older POIFSFileSystem solve the problem for you? Yes. After switching to NPOIFSFileSystem it works fine. My problem is solved, thanks. There are a couple of design snags in the older POIFS implementation, which is partly why we re-wrote it (those and cleaner code now the documentation is better + public, lower memory footprint etc). I think this bug is likely related to one of the gnarly bits in the old codebase, so I'm marking this as Won't Fix since it's corrected by the new implementation |
Created attachment 29005 [details] Example XLS file. Stacktrace: Caused by: java.lang.NullPointerException at org.apache.poi.poifs.filesystem.ODocumentInputStream.readUShort(ODocumentInputStream.java:294) at org.apache.poi.poifs.filesystem.DocumentInputStream.readUShort(DocumentInputStream.java:163) at org.apache.poi.hssf.record.RecordInputStream$SimpleHeaderInput.readRecordSID(RecordInputStream.java:98) at org.apache.poi.hssf.record.RecordInputStream.readNextSid(RecordInputStream.java:177) at org.apache.poi.hssf.record.RecordInputStream.<init>(RecordInputStream.java:115) at org.apache.poi.hssf.record.RecordInputStream.<init>(RecordInputStream.java:103) at org.apache.poi.hssf.record.RecordFactoryInputStream.<init>(RecordFactoryInputStream.java:180) at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:440) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:285) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:248) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:192) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:327) at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:308) at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:70) When file form attachment is re-saved in MS Office or OpenOffice then POI parse XLS with no NPE.