Bug 27005 - java.lang.IndexOutOfBoundsException during Workbook.cloneSheet()
Summary: java.lang.IndexOutOfBoundsException during Workbook.cloneSheet()
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: unspecified
Hardware: Other Windows XP
: P3 major (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2004-02-17 12:52 UTC by Sergey Skalchihin
Modified: 2004-11-16 19:05 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Sergey Skalchihin 2004-02-17 12:52:20 UTC
POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream("blank.xls"));
Workbook wb = new HSSFWorkbook(fs);
System.out.println(wb.getSheetName(0)); // result Ok -> Sheet1
HSSFSheet cc = wb.cloneSheet(0);
FileOutputStream fileOut = new FileOutputStream(n);
//java.lang.IndexOutOfBoundsException: Index: 9, Size: 9
//        at java.util.ArrayList.RangeCheck(ArrayList.java:507)
//        at java.util.ArrayList.get(ArrayList.java:324)
//        at org.apache.poi.hssf.record.MergeCellsRecord.getAreaAt
//        at org.apache.poi.hssf.record.MergeCellsRecord.serialize
//        at org.apache.poi.hssf.model.Sheet.serialize(Sheet.java:787)
//        at org.apache.poi.hssf.usermodel.HSSFWorkbook.getBytes
//        at org.apache.poi.hssf.usermodel.HSSFWorkbook.write
//        at ExcelReportMaker.close(ExcelReportMaker.java:43)
Comment 1 Danny Mui 2004-02-17 16:03:39 UTC
We're going to need more detail...like the blank.xls file you used.  I just
tried this code with version 2.0 FINAL and it worked ok. 
Comment 2 Sergey Skalchihin 2004-02-18 06:44:36 UTC
java.lang.IndexOutOfBoundsException is throws if "blank.xls" file consist 
merged cells.
Comment 3 Danny Mui 2004-02-18 16:49:09 UTC
Removed variable that stores the number of merged regions in 
its record since the array should be the basis for this number.  Less
manual index tracking, the better.

Thanks for problem report!

Should be released shortly in a development/production release but is now
available in CVS.