Bug 49931 - IllegalStateException at PageSettingsBlock$1.visitRecord
Summary: IllegalStateException at PageSettingsBlock$1.visitRecord
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.7-dev
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-14 17:26 UTC by willpower1024
Modified: 2010-09-20 12:01 UTC (History)
0 users



Attachments
Excel file to reproduce issue (111.00 KB, application/vnd.ms-excel)
2010-09-14 17:26 UTC, willpower1024
Details

Note You need to log in before you can comment on or make changes to this bug.
Description willpower1024 2010-09-14 17:26:47 UTC
Created attachment 26026 [details]
Excel file to reproduce issue

I'm using POI 3.7 beta 2

When opening the attached Excel file with the following simple code:

InputStream is = file.openInputStream();
try {
    Workbook wb = WorkbookFactory.create(is);
} catch (InvalidFormatException e) {
} finally {
    is.close();
}

the following stack trace is thrown:

java.lang.IllegalStateException
at java.util.AbstractList$Itr.remove(AbstractList.java:356)
at org.apache.poi.hssf.record.aggregates.PageSettingsBlock$1.visitRecord(PageSettingsBlock.java:666)
at org.apache.poi.hssf.record.aggregates.CustomViewSettingsRecordAggregate.visitContainedRecords(CustomViewSettingsRecordAggregate.java:71)
at org.apache.poi.hssf.record.aggregates.PageSettingsBlock.positionRecords(PageSettingsBlock.java:659)
at org.apache.poi.hssf.model.InternalSheet.<init>(InternalSheet.java:230)
at org.apache.poi.hssf.model.InternalSheet.createSheet(InternalSheet.java:162)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:273)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:187)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:304)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:285)
at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:60)


I cannot share the contents of the Excel file and so I removed it.  It is still reproducing though.

This Excel file can be opened up fine using POI 3.6 libraries
Comment 1 willpower1024 2010-09-14 18:00:23 UTC
My mistake, this was a regression in 3.6.  It worked with 3.5 final
Comment 2 Nick Burch 2010-09-20 12:01:44 UTC
Since 3.5 we now do more processing of page settings

It seems that in some situations though, when processing multiple page settings blocks on one sheet, we hit some sort of concurrency issues when re-ordering the records. Fixed in r998967, along with a unit test that shows we can read the file without errors.