Bug 47363

Summary: Adding data validations after sheet protection causes IllegalStateException
Product: POI Reporter: Josh Micich <josh>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 3.5-dev   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
URL: http://mail-archives.apache.org/mod_mbox/poi-user/200906.mbox/<1323dc380906110128s4133669cidfd315ebe0979a9a@mail.gmail.com>

Description Josh Micich 2009-06-12 12:11:50 UTC
java.lang.IllegalStateException: Unexpected (org.apache.poi.hssf.record.PasswordRecord) while looking for DV Table insert pos
	at org.apache.poi.hssf.model.RecordOrderer.findDataValidationTableInsertPos(RecordOrderer.java:240)
	at org.apache.poi.hssf.model.RecordOrderer.findSheetInsertPos(RecordOrderer.java:95)
	at org.apache.poi.hssf.model.RecordOrderer.addNewSheetRecord(RecordOrderer.java:89)
	at org.apache.poi.hssf.model.Sheet.getOrCreateDataValidityTable(Sheet.java:1752)
	at org.apache.poi.hssf.usermodel.HSSFSheet.addValidationData(HSSFSheet.java:369)
Comment 1 Josh Micich 2009-06-12 12:28:36 UTC
Fixed in svn r784240

junits added

The problem was due to the PASSWORD record being added in the wrong place (after DIMENSION).  PASSWORD is part of the 'Worksheet Protection Block' which should be before DIMENSION.