Bug 56444 - NullPointerException on HSSFCell.getCellComment()
Summary: NullPointerException on HSSFCell.getCellComment()
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2014-04-22 13:28 UTC by Lionel
Modified: 2014-04-22 15:48 UTC (History)
0 users

Java Class and Excel file to run the bug. (374.89 KB, application/zip)
2014-04-22 13:28 UTC, Lionel

Note You need to log in before you can comment on or make changes to this bug.
Description Lionel 2014-04-22 13:28:41 UTC
Created attachment 31546 [details]
Java Class and Excel file to run the bug.

On some of my Excel files, POI throws a NulPointerException on HSSFCell.getCellComment() method.

I have made a synthetic Excel file and a sunthetic Java class, which are in the attachment, to present this bug.
Comment 1 Nick Burch 2014-04-22 15:16:52 UTC
Have you checked that the cell isn't null? Row.getCell(int) can return null if the cell has never been used or styled - use the overloaded getting with a MissingCellPolicy or check for null if you want your code to cope easily with this
Comment 2 Lionel 2014-04-22 15:48:17 UTC
Ok, I'm sorry : you're right, I didn't think the cell before the last cell could be null.

Thank you :-).