DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17329>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17329 removeMergedRegion() throws IndexOutOfBoundsException Summary: removeMergedRegion() throws IndexOutOfBoundsException Product: POI Version: 1.5.1 Platform: Other OS/Version: Other Status: NEW Severity: Critical Priority: Other Component: HSSF AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] HSSFSheet.removeMergedRegion() throws an IndexOutOfBoundsException. The document I'm testing contains 2 merged regions. The following code is supposed to remove them all. However, when trying to remove the second region it throw the exception. This is the test program: ----------------------------------- import java.io.*; import org.apache.poi.poifs.filesystem.*; import org.apache.poi.hssf.usermodel.*; public class Test { public static void main(String[] args) throws Exception { FileInputStream in = new FileInputStream("example.xls"); POIFSFileSystem fs = new POIFSFileSystem(in); HSSFWorkbook wb = new HSSFWorkbook(fs); HSSFSheet sheet = wb.getSheetAt(0); int numRegions = sheet.getNumMergedRegions(); for (int i = 0; i < numRegions; i++) { System.out.println("removing region " + sheet.getMergedRegionAt(0)); sheet.removeMergedRegion(0); } } } ----------------------------------- and here is what happens: ----------------------------------- removing region [EMAIL PROTECTED] removing region [EMAIL PROTECTED] Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 95, Size: 36 at java.util.ArrayList.RangeCheck(ArrayList.java:508) at java.util.ArrayList.remove(ArrayList.java:388) at org.apache.poi.hssf.model.Sheet.removeMergedRegion(Sheet.java:342) at org.apache.poi.hssf.usermodel.HSSFSheet.removeMergedRegion(HSSFSheet.java:502) at Test.main(Test.java:17) ----------------------------------- The problem occured to me with POI versions 1.5.1 and 1.9.0. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
