When attempting shift rows on some particular Excel sheets using HSSFSheet. shiftRows(), IndexOutOfBoundsException arises. shiftRows() works just fine most of the time. It seems that, when merged cells are invoved, it is likely to have this problem.
Created attachment 8056 [details] Excel file used to reproduce the problem
Created attachment 8057 [details] The test program to reproduce the problem. Needs to work together with the previously attached MS-Excel file.
Have attched both a java test program and an Excel file to re-produce the problem. The test program(TestShiftMerged.java) asks the user to provide a row number. The program will shift the rows between the specified row number and the last row one row down. In my test, when the first row and second row is involved, the exception arises. It works OK otherwise. The following is some stacktrace of one run. [java] Input the row number or Q to quit please: 1 [java] shifting rows between:0 and 14 1 row down [java] java.lang.IndexOutOfBoundsException: Index: 90, Size: 43
Committed Fix for Development and Release branch. Please verify and thanks for your report!