You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by jh...@apache.org on 2003/09/22 00:11:56 UTC
cvs commit: jakarta-poi/src/java/org/apache/poi/hssf/record/aggregates ValueRecordsAggregate.java
jheight 2003/09/21 15:11:56
Modified: src/java/org/apache/poi/hssf/record/aggregates
ValueRecordsAggregate.java
Log:
Small fix for when the start row didnt contain any cells.
Revision Changes Path
1.13 +14 -2 jakarta-poi/src/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java
Index: ValueRecordsAggregate.java
===================================================================
RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/hssf/record/aggregates/ValueRecordsAggregate.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ValueRecordsAggregate.java 18 Sep 2003 02:10:50 -0000 1.12
+++ ValueRecordsAggregate.java 21 Sep 2003 22:11:56 -0000 1.13
@@ -136,7 +136,15 @@
* that are attached to the rows in the range specified.
*/
public int getRowCellBlockSize(int startRow, int endRow) {
- Iterator cellRec = new VRAIterator(this, startRow, endRow);;
+ //Make sure that the row has cells
+ while (!rowHasCells(startRow) && (startRow <= endRow))
+ startRow++;
+ if (startRow > endRow) {
+ //Couldnt find any cells between the row range provided.
+ return 0;
+ }
+
+ Iterator cellRec = new VRAIterator(this, startRow, endRow);
int size = 0;
while (cellRec.hasNext()) {
CellValueRecordInterface cell = (CellValueRecordInterface)cellRec.next();
@@ -149,6 +157,8 @@
/** Returns true if the row has cells attached to it */
public boolean rowHasCells(int row) {
+ if (row >= celltype.size())
+ return false;
IntList ctRow = (IntList) celltype.get(row);
return ((ctRow != null) && (ctRow.size() > 0));
}
@@ -553,7 +563,9 @@
this.row = startRow;
this.rowlimit = endRow;
this.popindex = vra.populatedRows.indexOf(row);
- if (vra.getPhysicalNumberOfCells() > 0) {
+ if (this.popindex == -1) {
+ hasNext = false;
+ } else if (vra.getPhysicalNumberOfCells() > 0) {
next = findNextCell(null);
hasNext = (next != null);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-dev-help@jakarta.apache.org