Bug 59222 - XSSFSheet.getCellComments() raises NPE when sheet has no cell comments
Summary: XSSFSheet.getCellComments() raises NPE when sheet has no cell comments
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.15-dev
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-23 16:37 UTC by Javen O'Neal
Modified: 2016-03-23 16:44 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Javen O'Neal 2016-03-23 16:37:54 UTC
Reported by Vasily Kopytov on user@poi mailing list.

> I'm trying to find comments to cells on a spreadsheet.
> All is well, when comments have org.apache.poi.ss.usermodel.Sheet.
> getCellComments() returns. But when no comments, an exception is thrown
> java.lang.NullPointerException.
> Is it possible to do so in this case getCellComments() returned null or an
> empty Map?

I believe this bug only applies to (S)XSSF. The cleanest solution is to return an empty map.
Comment 1 Javen O'Neal 2016-03-23 16:44:52 UTC
Fixed in r1736347.