Bug 46137 - Failed to create an HSSFWorkbook due to "Unhandled Continue Record" after an EOFRecord
Summary: Failed to create an HSSFWorkbook due to "Unhandled Continue Record" after an ...
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: POIFS (show other bugs)
Version: 3.2-dev
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
: 46094 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-10-31 10:06 UTC by Shijie Wang
Modified: 2010-01-14 04:12 UTC (History)
2 users (show)



Attachments
A test Excel file that cannot be loaded due to this bug (50.50 KB, application/ms-excel)
2008-10-31 10:06 UTC, Shijie Wang
Details
File to reproduce the error with Poi 3.2 fianl and 3.5 beta 5 (252.50 KB, application/vnd.ms-excel)
2009-05-05 02:18 UTC, Joern Muehlencord
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Shijie Wang 2008-10-31 10:06:11 UTC
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);
Comment 1 Nick Burch 2008-11-10 04:20:51 UTC
Fixed in svn trunk
Comment 2 Josh Micich 2009-02-13 12:59:02 UTC
(In reply to comment #1)
> Fixed in svn trunk
> 

svn r46137 which made it into the 3.5-beta4 release

Comment 3 Josh Micich 2009-02-13 13:01:16 UTC
*** Bug 46094 has been marked as a duplicate of this bug. ***
Comment 4 Joern Muehlencord 2009-05-05 02:16:58 UTC
reproduced error with 3.5 Beta 5
Comment 5 Joern Muehlencord 2009-05-05 02:18:18 UTC
Created attachment 23611 [details]
File to reproduce the error with Poi 3.2 fianl and 3.5 beta 5
Comment 6 Joern Muehlencord 2009-05-05 02:18:58 UTC
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();
    }
Comment 7 Yegor Kozlov 2009-08-14 12:53:42 UTC
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
Comment 8 Merav E. 2010-01-14 04:12:46 UTC
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.