Bug 61584 - NPE in XDGFPage getPageOffset: check for x instead of y
Summary: NPE in XDGFPage getPageOffset: check for x instead of y
Alias: None
Product: POI
Classification: Unclassified
Component: XDGF (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2017-10-05 11:58 UTC by Marko Friedemann
Modified: 2017-10-16 01:37 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
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());
  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*