Bug 49931

Summary: IllegalStateException at PageSettingsBlock$1.visitRecord
Product: POI Reporter: willpower1024 <willpower1024>
Component: HSSFAssignee: POI Developers List <dev>
Severity: normal    
Priority: P2    
Version: 3.7-dev   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: Excel file to reproduce issue

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 {

the following stack trace is thrown:

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.