Bug 57826 - [PATCH] XSSFSimpleShape.getText throws NullPointerException
Summary: [PATCH] XSSFSimpleShape.getText throws NullPointerException
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.11-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2015-04-17 07:34 UTC by Jon Scharff
Modified: 2015-04-29 19:22 UTC (History)
1 user (show)



Attachments
An xlsx file that exhibits the issue (8.88 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2015-04-17 07:34 UTC, Jon Scharff
Details
[patch] testcase for the bug (made with ant -f patch.xml). (7.33 KB, patch)
2015-04-20 06:14 UTC, Jon Scharff
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jon Scharff 2015-04-17 07:34:53 UTC
Created attachment 32657 [details]
An xlsx file that exhibits the issue

A NullPointerException occurs when running extractor.XSSFExcelExtractor on the attached xlsx file.

It is possible have a shape containing a paragraph with property BuFont but none of the properties BuNone, BuChar, and BuAutoNum. This is the case with the text box containing text "test fail" in the attached file. *

In this case, usermodel.XSSFTextParagraph.isBullet() returns true.

usermodel.XSSFSimpleShape.getText() expects that if p.isBullet() is true then either p.isBulletAutoNumber() is true or p.getBulletCharacter() returns a non-null string. However, with the attached file, this is not the case.

Excel 2010 treats the textbox as not being bulleted, so perhaps XSSFTextParagraph.isBullet() should return false in this case. Otherwise, XSSFSimpleShape.getText() should perform a null check before using the result of p.getBulletCharacter() (or both?).

* I have no idea how the text box got in this state, but it was mostly likely done with Microsoft products...
Comment 1 Jon Scharff 2015-04-20 06:14:41 UTC
Created attachment 32663 [details]
[patch] testcase for the bug (made with ant -f patch.xml).

includes an xlsx that exhibits the issue and a junit test added to usermodel.TestUnfixedBugs in ooxml/testcases.
Comment 2 Dominik Stadler 2015-04-20 20:45:26 UTC
Comment on attachment 32663 [details]
[patch] testcase for the bug (made with ant -f patch.xml).

.
Comment 3 Nick Burch 2015-04-29 19:22:06 UTC
Thanks! Fixed in r1676831, using your test to verify it's all working