Author: yegor
Date: Sun Nov 25 11:53:50 2012
New Revision: 1413339
URL: http://svn.apache.org/viewvc?rev=1413339&view=rev
Log:
Bugzilla 54188 - Avoid NPE in PPT2PNG
Modified:
poi/trunk/src/documentation/content/xdocs/status.xml
poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Freeform.java
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestFreeform.java
Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL:
http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=1413339&r1=1413338&r2=1413339&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Sun Nov 25 11:53:50
2012
@@ -34,6 +34,7 @@
<changes>
<release version="3.9-beta1" date="2012-??-??">
+ <action dev="poi-developers" type="fix">54188 - Avoid NPE in
PPT2PNG</action>
<action dev="poi-developers" type="fix">52628 - Replace System.err
info messages with a POILogger</action>
<action dev="poi-developers" type="fix">54137 - improved performance
of DataFormatter with Fractions</action>
<action dev="poi-developers" type="fix">54099 - Ensure that CTHMerge
and CTTcBorders go to poi-ooxml-schemas jar</action>
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Freeform.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Freeform.java?rev=1413339&r1=1413338&r2=1413339&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Freeform.java
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Freeform.java Sun
Nov 25 11:53:50 2012
@@ -244,6 +244,11 @@ public final class Freeform extends Auto
public java.awt.Shape getOutline(){
GeneralPath path = getPath();
+ if(path == null) {
+ // return empty path if either GEOMETRY__VERTICES or
GEOMETRY__SEGMENTINFO is missing, see Bugzilla 54188
+ return new GeneralPath();
+ }
+
Rectangle2D anchor = getAnchor2D();
Rectangle2D bounds = path.getBounds2D();
AffineTransform at = new AffineTransform();
Modified:
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestFreeform.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestFreeform.java?rev=1413339&r1=1413338&r2=1413339&view=diff
==============================================================================
---
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestFreeform.java
(original)
+++
poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestFreeform.java
Sun Nov 25 11:53:50 2012
@@ -71,4 +71,16 @@ public final class TestFreeform extends
java.awt.Shape path2 = p.getOutline();
assertTrue(new Area(path1).equals(new Area(path2)));
}
+
+ /**
+ * Avoid NPE in Freeform.getOutline() if either GEOMETRY__VERTICES or
+ * GEOMETRY__SEGMENTINFO is missing, see Bugzilla 54188
+ */
+ public void test54188() {
+
+ Freeform p = new Freeform();
+ GeneralPath path = (GeneralPath)p.getOutline();
+ GeneralPath emptyPath = new GeneralPath();
+ assertEquals(emptyPath.getBounds2D(), path.getBounds2D());
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]