From: Glen Stampoultzis Date: Mon, 8 Apr 2002 14:03:37 +0000 (+0000) Subject: findFirstRow fix... sheesh... X-Git-Tag: REL_1_5_0~107 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8bf48bd37f57340030ac4dce1ce301617f38870c;p=poi.git findFirstRow fix... sheesh... git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352362 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java b/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java index 6f5b0cc6b4..0bb7128eb4 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java @@ -214,7 +214,8 @@ public class HSSFRow if (cell.getCellNum() == row.getLastCol()) { row.setLastCol( findLastCell(row.getLastCol()) ); - } else if (cell.getCellNum() == row.getFirstCol()) + } + if (cell.getCellNum() == row.getFirstCol()) { row.setFirstCol( findFirstCell(row.getFirstCol()) ); } @@ -330,16 +331,6 @@ public class HSSFRow return row.getLastCol(); } - /** - * gets a list of cells in the row. - * @retun List - shallow copy of cells - best you don't modify them - */ - -// public List getCells() -// { // shallow copy, modifying cells changes things - // modifying the array changes nothing! -// return ( ArrayList ) cells.clone(); -// } /** * gets the number of defined cells (NOT number of cells in the actual row!). @@ -440,10 +431,12 @@ public class HSSFRow short cellnum = (short) (firstcell + 1); HSSFCell r = getCell(cellnum); - while (r == null) + while (r == null && cellnum <= getLastCellNum()) { r = getCell(++cellnum); } + if (cellnum > getLastCellNum()) + return -1; return cellnum; }