From 8bf48bd37f57340030ac4dce1ce301617f38870c Mon Sep 17 00:00:00 2001 From: Glen Stampoultzis Date: Mon, 8 Apr 2002 14:03:37 +0000 Subject: [PATCH] findFirstRow fix... sheesh... git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352362 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/hssf/usermodel/HSSFRow.java | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) 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; } -- 2.39.5