Bug 56218 - [PATCH] NPE when reading XLSX file with drawing shapes
Summary: [PATCH] NPE when reading XLSX file with drawing shapes
Status: RESOLVED DUPLICATE of bug 56514
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.10-FINAL
Hardware: PC All
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2014-03-05 10:47 UTC by thaichat04
Modified: 2015-03-23 21:27 UTC (History)
0 users

Patch check NPE with test case (30.95 KB, text/plain)
2014-03-05 10:47 UTC, thaichat04

Note You need to log in before you can comment on or make changes to this bug.
Description thaichat04 2014-03-05 10:47:10 UTC
Created attachment 31367 [details]
Patch check NPE with test case

Read attached XLSX file, NPE raised
Caused by: java.lang.NullPointerException
	at org.apache.poi.xssf.usermodel.XSSFSimpleShape.<init>(XSSFSimpleShape.java:84)
	at org.apache.poi.xssf.usermodel.XSSFDrawing.getShapes(XSSFDrawing.java:377)
	at org.apache.poi.xssf.eventusermodel.XSSFReader$SheetIterator.getShapes(XSSFReader.java:295)
	at org.apache.tika.parser.microsoft.ooxml.XSSFExcelExtractorDecorator.buildXHTML(XSSFExcelExtractorDecorator.java:148)
	at org.apache.tika.parser.microsoft.ooxml.AbstractOOXMLExtractor.getXHTML(AbstractOOXMLExtractor.java:105)
	at org.apache.tika.parser.microsoft.ooxml.XSSFExcelExtractorDecorator.getXHTML(XSSFExcelExtractorDecorator.java:94)
	at org.apache.tika.parser.microsoft.ooxml.OOXMLExtractorFactory.parse(OOXMLExtractorFactory.java:112)
	at org.apache.tika.parser.microsoft.ooxml.OOXMLParser.parse(OOXMLParser.java:82)
	at org.apache.tika.parser.ParserDecorator.parse(ParserDecorator.java:91)
	at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:242)
	... 24 more

On line 84 of org.apache.poi.xssf.usermodel.XSSFSimpleShape, We would check that  body is not null (some shape has no text info, eg. lines).
Comment 1 Dominik Stadler 2014-03-16 19:50:34 UTC
Thanks for the patch, unfortunately it contains many unrelated changes like tab/space changes and formatting changes, making it hard to only apply the actual changes. Any chance you can re-do it so that it does not contain all these changes?

Also you will need to attach the test-file separately, as it is not contained in a text-only patch.
Comment 2 Dominik Stadler 2015-03-23 21:27:04 UTC
This is actually already fixed in r1595127 via 56514.

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