Bug 56218

Summary: [PATCH] NPE when reading XLSX file with drawing shapes
Product: POI Reporter: thaichat04 <hong-thai.nguyen>
Component: XSSFAssignee: POI Developers List <dev>
Severity: major    
Priority: P2    
Version: 3.10-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: Patch check NPE with test case

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 ***