Bug 39921 - getLastRowNum broken for empty sheets
Summary: getLastRowNum broken for empty sheets
Status: RESOLVED DUPLICATE of bug 30635
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 2.5-FINAL
Hardware: Other other
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2006-06-28 15:42 UTC by Andreas Goetz
Modified: 2006-09-05 06:26 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Goetz 2006-06-28 15:42:13 UTC
We're seing excel sheets that return getLastRowNum()=0 but do not allow reading
row 0:

for (int i = sheet.getFirstRowNum(); i <= sheet.getLastRowNum(); i++) HSSFRow
row = getRow(sheet, i);
-> NullPointerException when using getRow.

Alternatively using the iterator interface this error can be avoided:

for (Iterator iter = sheet.rowIterator(); iter.hasNext();) 			HSSFRow row =
(HSSFRow) iter.next();

Expected behaviour would be getLastRowNum() returning -1 instead of 0.
Comment 1 Andreas Goetz 2006-06-28 15:43:01 UTC
I believe this issue may be related to bug 30635 but decided to open a new one
as 30635 didn't get updated since 2004.
Comment 2 Andreas Goetz 2006-09-05 13:26:50 UTC

*** This bug has been marked as a duplicate of 30635 ***