You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2019/07/03 14:39:09 UTC
[Bug 63541] New: NullPointerException from XSLFSimpleShape.getAnchor
for empty xfrm tags
https://bz.apache.org/bugzilla/show_bug.cgi?id=63541
Bug ID: 63541
Summary: NullPointerException from XSLFSimpleShape.getAnchor
for empty xfrm tags
Product: POI
Version: 4.0.x-dev
Hardware: PC
OS: Mac OS X 10.1
Status: NEW
Severity: normal
Priority: P2
Component: XSLF
Assignee: dev@poi.apache.org
Reporter: petoalbert32@gmail.com
Target Milestone: ---
Created attachment 36643
--> https://bz.apache.org/bugzilla/attachment.cgi?id=36643&action=edit
pptx file that contains a shape for which getAnchor throws NullPointerException
I have stumbled upon a pptx file that contains a shape for which getAnchor
throws NullPointerException. The issue is with the following two lines from
XSLFSimpleShape:
CTPoint2D off = xfrm.getOff();
double x = Units.toPoints(off.getX());
Apparently the shape in slide1.xml contains an empty xfrm tag and an empty
path, and xfrm.getOff() returns null.
I have attached a simplified pptx file containing the weird shape. The
mentioned shape is not visible in various editors/viewers, but they show other
parts of the presentation correctly.
Test with:
XMLSlideShow pptx = ... // attached file
pptx.getSlides().get(0).getShapes().get(0).getAnchor();
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 63541] NullPointerException from XSLFSimpleShape.getAnchor for
empty xfrm tags
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63541
petoalbert32@gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |petoalbert32@gmail.com
--- Comment #3 from petoalbert32@gmail.com ---
Created attachment 36681
--> https://bz.apache.org/bugzilla/attachment.cgi?id=36681&action=edit
Proposed one-liner change in XSLFSimpleShape
Fixes the NullPointerException in getAnchor when called with the attached pptx
file. I have run TestAllFiles with the file and this was the only place where
the exception occured.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 63541] NullPointerException from XSLFSimpleShape.getAnchor for
empty xfrm tags
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63541
--- Comment #2 from Andreas Beeker <ki...@apache.org> ---
(In reply to petoalbert32 from comment #1)
> Is this valid at all? It seems that other tools can handle it.
I thought its invalid, but the schema validation with ECMA-376 (5th edition)
was positive - be aware that we still use the 1st edition (see also #56205)
> Is there a better solution than explicitly checking for the presence of
> offset everywhere where we use it?
If you access the XmlBeans directly -> nope
If you use the POI API, I'd return NULL as the anchor - I think an empty anchor
doesn't make much sense. Furthermore I would throw your test file in our corpus
and see where it crashes and fix those places.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 63541] NullPointerException from XSLFSimpleShape.getAnchor for
empty xfrm tags
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63541
--- Comment #1 from petoalbert32@gmail.com ---
As for the possible fix: I could wrap the mentioned block of code in a
conditional statement with condition xfrm.isOffSet(), but it seems that xfrm is
also used from other places, and I am not sure how to interpret a shape like
this conceptually.
I could not even reproduce it from an editor, but by manually inserting the
following shape into slide1.xml:
<p:sp>
<p:nvSpPr>
<p:cNvPr id="119" name="Invalid shape"/>
<p:cNvSpPr/>
<p:nvPr/>
</p:nvSpPr>
<p:spPr>
<a:xfrm/>
<a:custGeom>
<a:avLst/>
<a:gdLst/>
<a:ahLst/>
<a:cxnLst/>
<a:rect l="l" t="t" r="r" b="b"/>
<a:pathLst>
<a:path/>
</a:pathLst>
</a:custGeom>
<a:solidFill/>
<a:ln>
<a:solidFill/>
<a:prstDash/>
</a:ln>
</p:spPr>
<p:txBody>
<a:bodyPr rtlCol="0" anchor="ctr"/>
<a:lstStyle/>
<a:p>
<a:pPr algn="ctr"/>
<a:endParaRPr lang="en-US" altLang="zh-CN"/>
</a:p>
</p:txBody>
</p:sp>
Is this valid at all? It seems that other tools can handle it.
Is there a better solution than explicitly checking for the presence of offset
everywhere where we use it?
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 63541] [PATCH] NullPointerException from
XSLFSimpleShape.getAnchor for empty xfrm tags
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63541
petoalbert32@gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|NullPointerException from |[PATCH]
|XSLFSimpleShape.getAnchor |NullPointerException from
|for empty xfrm tags |XSLFSimpleShape.getAnchor
| |for empty xfrm tags
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 63541] [PATCH] NullPointerException from
XSLFSimpleShape.getAnchor for empty xfrm tags
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63541
Andreas Beeker <ki...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #4 from Andreas Beeker <ki...@apache.org> ---
Applied via r1866810
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org