Bug 61584

Summary: NPE in XDGFPage getPageOffset: check for x instead of y
Product: POI Reporter: Marko Friedemann <marko>
Component: XDGFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal CC: marko
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Marko Friedemann 2017-10-05 11:58:07 UTC
XDGFPage getPageOffset contains a wrong check for null, causing an NPE for .vsdx documents that don't have the YRulerOrigin set.

The code in question has been there ever since this was contributed, so it appears to affect all versions.

,-- XDGFPage.java, lines 99ff [1] --
   99    if (xoffcell != null)
  100        xoffset = Double.parseDouble(xoffcell.getValue());
  101
  102    if (xoffcell != null)
  103        yoffset = Double.parseDouble(yoffcell.getValue());
`-----

The fix is trivial, line 102 should check yoffcell for being null.

[1] https://apache.googlesource.com/poi/+/refs/heads/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/XDGFPage.java#102
Comment 1 Dominik Stadler 2017-10-06 11:51:54 UTC
Can you provide a sample document that we can use to verify the fix?
Comment 2 Marko Friedemann 2017-10-11 08:14:29 UTC
I am afraid I can't, as the document in question originated with a customer and I don't have a Visio version capable of generating .vsdx.

While I can understand the question of reproducability and verification, could an exception be made here, as this specific bug should be trivial and obvious enough to be handled?

If it helps, I added the fix to my copy and can now import the document without issue.
Comment 3 virtuald 2017-10-16 01:36:16 UTC
I no longer have Visio installed with, but you're right that this is obviously a typo. Pushed fix @ 1812240.
Comment 4 virtuald 2017-10-16 01:37:50 UTC
No longer have Visio installed either*