Created attachment 22816 [details] A test Excel file that cannot be loaded due to this bug Sometimes, Excel generates a Continue record after an EOF record for some unknown reasons. It should be considered as a bug. Excel itself, Excel Viewer, and Ruby all can handle it without any incident. However, the POI package fails to handle it. Based on a Google search on "Unhandled Continue Record", this issue was reported as early as 2005. See http://www.mail-archive.com/poi-dev@jakarta.apache.org/msg10360.html. However, it is not fixed in all the versions we tested, namely, 3.0 rc4, 3.1 FINAL, 3.2 FINAL, and 3.5.1 beta. The fix seems pretty simple. If the following lines are added to the method createRecords() in org.apache.poi.hssf.record.RecordFactory, the problem goes away with those "offending" Excel files. } else if (lastRecord instanceof EOFRecord) { // System.err.println("Warning: Unexpected Continue Record after an End of File record!"); records.add(record);
Fixed in svn trunk
(In reply to comment #1) > Fixed in svn trunk > svn r46137 which made it into the 3.5-beta4 release
*** Bug 46094 has been marked as a duplicate of this bug. ***
reproduced error with 3.5 Beta 5
Created attachment 23611 [details] File to reproduce the error with Poi 3.2 fianl and 3.5 beta 5
Test Source Code try { String dataFile = "BrokenExampleFile.xls"; POIFSFileSystem fs1 = new POIFSFileSystem(new FileInputStream(dataFile)); HSSFWorkbook workbook = new HSSFWorkbook(fs1); HSSFSheet sheet = workbook.getSheetAt(0); } catch (Exception ex) { ex.printStackTrace(); }
Both attached files can be read by the latest build of trunk without any problems. Daily builds can be downloaded from http://encore.torchbox.com/poi-svn-build/ Yegor
Does this fix exist for version 3.2 too? If yes, what is the link to download it? Otherwise, how can we download the source code of the 3.2 version? (I found code only for new versions) Thanks.