Bug 56514

Summary: NullPointerException in XSSFSimpleShape constructor
Product: POI Reporter: Joachim Herrmann <j.herrmann>
Component: XSSFAssignee: POI Developers List <dev>
Severity: normal CC: hong-thai.nguyen
Priority: P2    
Version: 3.11-dev   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Attachments: test sample file
Unit test case

Description Joachim Herrmann 2014-05-12 13:32:58 UTC
Created attachment 31607 [details]
test sample file


I encountered a NullPointerException in XSSFDrawing.getShapes()

The cause is the constructor
  protected XSSFSimpleShape(XSSFDrawing drawing, CTShape ctShape) 
which runs the loop
  for(int i = 0; i < body.sizeOfPArray(); i++) 
without checking if the "body" variable is null

The attached test class "TestXSSFDrawingGetShapes.java" demonstrates the error with the attached test sample file "shapes.xlsx"

Kind Regards
Comment 1 Joachim Herrmann 2014-05-12 13:33:53 UTC
Created attachment 31608 [details]
Unit test case
Comment 2 Dominik Stadler 2014-05-16 07:12:14 UTC
Fixed in r1595127, a simple null-check in XSSFSimpleShape seems to make it work, I also checked that the resulting XLSX still looks sane in Excel.
Comment 3 Dominik Stadler 2015-03-23 21:27:04 UTC
*** Bug 56218 has been marked as a duplicate of this bug. ***