<!-- Don't forget to update status.xml too! -->
<release version="3.1.1-alpha1" date="2008-??-??">
+ <action dev="POI-DEVELOPERS" type="fix">45367 - Fixed bug when last row removed from sheet is row zero</action>
<action dev="POI-DEVELOPERS" type="fix">45348 - Tweaks to RVA formula logic</action>
<action dev="POI-DEVELOPERS" type="fix">45354 - Fixed recognition of named ranges within formulas</action>
<action dev="POI-DEVELOPERS" type="fix">45338 - Fix HSSFWorkbook to give you the same HSSFFont every time, and then fix it to find newly added fonts</action>
<!-- Don't forget to update changes.xml too! -->
<changes>
<release version="3.1.1-alpha1" date="2008-??-??">
+ <action dev="POI-DEVELOPERS" type="fix">45367 - Fixed bug when last row removed from sheet is row zero</action>
<action dev="POI-DEVELOPERS" type="fix">45348 - Tweaks to RVA formula logic</action>
<action dev="POI-DEVELOPERS" type="fix">45354 - Fixed recognition of named ranges within formulas</action>
<action dev="POI-DEVELOPERS" type="fix">45338 - Fix HSSFWorkbook to give you the same HSSFFont every time, and then fix it to find newly added fonts</action>
/**
* used internally to refresh the "last row" when the last row is removed.
*/
-
- private int findLastRow(int lastrow)
- {
+ private int findLastRow(int lastrow) {
+ if (lastrow < 1) {
+ return -1;
+ }
int rownum = lastrow - 1;
HSSFRow r = getRow(rownum);
- while (r == null && rownum > 0)
- {
+ while (r == null && rownum > 0) {
r = getRow(--rownum);
}
- if (r == null)
- return -1;
+ if (r == null) {
+ return -1;
+ }
return rownum;
}
sheet.removeRow(row);
}
+ public void testRemoveZeroRow() {
+ HSSFWorkbook workbook = new HSSFWorkbook();
+ HSSFSheet sheet = workbook.createSheet("Sheet1");
+ HSSFRow row = sheet.createRow(0);
+ try {
+ sheet.removeRow(row);
+ } catch (IllegalArgumentException e) {
+ if (e.getMessage().equals("Invalid row number (-1) outside allowable range (0..65535)")) {
+ throw new AssertionFailedError("Identified bug 45367");
+ }
+ throw e;
+ }
+ }
+
public void testCloneSheet() {
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet("Test Clone");