Author: jheight Date: Fri Aug 25 15:24:47 2006 New Revision: 436986 URL: http://svn.apache.org/viewvc?rev=436986&view=rev Log: bug 40285: Corrected index of CellIterator. In addition made CelIterator obey the Iterator contract wrt exceptions.
Modified: jakarta/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java Modified: jakarta/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java?rev=436986&r1=436985&r2=436986&view=diff ============================================================================== --- jakarta/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java (original) +++ jakarta/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java Fri Aug 25 15:24:47 2006 @@ -28,6 +28,7 @@ import java.util.HashMap; import java.util.Iterator; +import java.util.NoSuchElementException; /** * High level representation of a row of a spreadsheet. @@ -436,7 +437,8 @@ private class CellIterator implements Iterator { - int thisId,nextId=0; + int thisId=-1; + int nextId=-1; public CellIterator() { @@ -448,6 +450,8 @@ } public Object next() { + if (!hasNext()) + throw new NoSuchElementException("At last element"); HSSFCell cell=cells[nextId]; thisId=nextId; findNext(); @@ -455,6 +459,8 @@ } public void remove() { + if (thisId == -1) + throw new IllegalStateException("remove() called before next()"); cells[thisId]=null; } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta POI Project: http://jakarta.apache.org/poi/