poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cen...@apache.org
Subject svn commit: r1725332 - in /poi/trunk: src/java/org/apache/poi/sl/draw/DrawPaint.java test-data/slideshow/br.com.tvcamboriu.www_pps_Pensar_5b1_5d.ppt
Date Mon, 18 Jan 2016 19:56:31 GMT
Author: centic
Date: Mon Jan 18 19:56:30 2016
New Revision: 1725332

URL: http://svn.apache.org/viewvc?rev=1725332&view=rev
Log:
Fix possible NullPointerException with invalid/unsupported image types

Added:
    poi/trunk/test-data/slideshow/br.com.tvcamboriu.www_pps_Pensar_5b1_5d.ppt   (with props)
Modified:
    poi/trunk/src/java/org/apache/poi/sl/draw/DrawPaint.java

Modified: poi/trunk/src/java/org/apache/poi/sl/draw/DrawPaint.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/sl/draw/DrawPaint.java?rev=1725332&r1=1725331&r2=1725332&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/sl/draw/DrawPaint.java (original)
+++ poi/trunk/src/java/org/apache/poi/sl/draw/DrawPaint.java Mon Jan 18 19:56:30 2016
@@ -27,6 +27,7 @@ import java.awt.RadialGradientPaint;
 import java.awt.geom.AffineTransform;
 import java.awt.geom.Point2D;
 import java.awt.geom.Rectangle2D;
+import java.awt.image.BufferedImage;
 import java.io.IOException;
 import java.io.InputStream;
 
@@ -145,8 +146,13 @@ public class DrawPaint {
             renderer.setAlpha(alpha/100000.f);
         }
         
+        BufferedImage image = renderer.getImage();
+        if(image == null) {
+            LOG.log(POILogger.ERROR, "Can't load image data");
+            return null;
+        }
         Rectangle2D textAnchor = shape.getAnchor();
-        Paint paint = new java.awt.TexturePaint(renderer.getImage(), textAnchor);
+        Paint paint = new java.awt.TexturePaint(image, textAnchor);
 
         return paint;
     }

Added: poi/trunk/test-data/slideshow/br.com.tvcamboriu.www_pps_Pensar_5b1_5d.ppt
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/slideshow/br.com.tvcamboriu.www_pps_Pensar_5b1_5d.ppt?rev=1725332&view=auto
==============================================================================
Binary files poi/trunk/test-data/slideshow/br.com.tvcamboriu.www_pps_Pensar_5b1_5d.ppt (added)
and poi/trunk/test-data/slideshow/br.com.tvcamboriu.www_pps_Pensar_5b1_5d.ppt Mon Jan 18 19:56:30
2016 differ

Propchange: poi/trunk/test-data/slideshow/br.com.tvcamboriu.www_pps_Pensar_5b1_5d.ppt
------------------------------------------------------------------------------
    svn:executable = *



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message