Bug 45640

Summary: java.lang.ClassCastException in the HSSFSheet.addRow
Product: POI Reporter: Anton Sharapov <asharapov>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: major    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   

Description Anton Sharapov 2008-08-17 04:34:56 UTC
This is the exception that occurs when I try to add row on sheet after sheet.groupRow(...) method :
java.lang.ClassCastException: org.apache.poi.hssf.record.aggregates.ColumnInfoRecordsAggregate
	at org.apache.poi.hssf.model.Sheet.addRow(Sheet.java:769)
	at org.apache.poi.hssf.usermodel.HSSFSheet.addRow(HSSFSheet.java:298)
	at org.apache.poi.hssf.usermodel.HSSFSheet.createRow(HSSFSheet.java:201)

example code: 
        final HSSFWorkbook wb = new HSSFWorkbook();
        final HSSFSheet sheet = wb.createSheet("test");
        sheet.createRow(0);
        sheet.createRow(1);
        sheet.groupRow(0,1);
        sheet.createRow(2);

Tested on current poi version (poi-3.2-alpha1-20080817)
Note: in earlier builds (checked on poi-3.2-alpha1-20080716) this bug wasn't occurs.
Comment 1 Josh Micich 2008-08-19 00:49:59 UTC
Fixed in svn r686977

junit added

Thanks for the bug report.  This bug was introduced in the records aggregates refactoring since 3.1-final (svn r682282-r683880).