Bug 56450 - 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-23 17:05 UTC by Lionel
Modified: 2014-04-24 15:43 UTC (History)
0 users

Java Class and Excel file to run the bug. (376.67 KB, application/zip)
2014-04-23 17:05 UTC, Lionel

Note You need to log in before you can comment on or make changes to this bug.
Description Lionel 2014-04-23 17:05:27 UTC
Created attachment 31553 [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 Lionel 2014-04-23 17:07:14 UTC
Here is the StackTrace :

Exception in thread "main" java.lang.NullPointerException
	at org.apache.poi.hssf.usermodel.HSSFComment.getColumn(HSSFComment.java:170)
	at org.apache.poi.hssf.usermodel.HSSFSheet.lookForComment(HSSFSheet.java:2118)
	at org.apache.poi.hssf.usermodel.HSSFSheet.findCellComment(HSSFSheet.java:2103)
	at org.apache.poi.hssf.usermodel.HSSFCell.getCellComment(HSSFCell.java:1022)
	at org.apache.poi.hssf.usermodel.HSSFCell.getCellComment(HSSFCell.java:70)
	at poi.bugs.BugGetCellComment.main(BugGetCellComment.java:58)
Comment 2 Nick Burch 2014-04-24 15:43:57 UTC
For some reason, your comments didn't have an associated NoteRecord. In r1589770 I've fixed it to not give a NPE, but without the NoteRecord we can't associate the comment with a cell, so none of your cells are found to have comments