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
My mistake, this was a regression in 3.6. It worked with 3.5 final
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.