pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jahew...@apache.org
Subject svn commit: r1648891 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/
Date Thu, 01 Jan 2015 17:06:16 GMT
Author: jahewson
Date: Thu Jan  1 17:06:15 2015
New Revision: 1648891

URL: http://svn.apache.org/r1648891
Log:
PDFBOX-1094: Avoid NPE when an IOException occurs in a Paint subclass

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/AxialShadingPaint.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/RadialShadingPaint.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type1ShadingPaint.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type4ShadingPaint.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type5ShadingPaint.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type6ShadingPaint.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type7ShadingPaint.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/AxialShadingPaint.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/AxialShadingPaint.java?rev=1648891&r1=1648890&r2=1648891&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/AxialShadingPaint.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/AxialShadingPaint.java
Thu Jan  1 17:06:15 2015
@@ -16,6 +16,7 @@
  */
 package org.apache.pdfbox.pdmodel.graphics.shading;
 
+import java.awt.Color;
 import java.awt.Paint;
 import java.awt.PaintContext;
 import java.awt.Rectangle;
@@ -67,10 +68,10 @@ public class AxialShadingPaint implement
         {
             return new AxialShadingContext(shading, cm, xform, matrix, deviceBounds);
         }
-        catch (IOException ex)
+        catch (IOException e)
         {
-            LOG.error(ex);
-            return null;
+            LOG.error("An error occurred while painting", e);
+            return new Color(0, 0, 0, 0).createContext(cm, deviceBounds, userBounds, xform,
hints);
         }
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/RadialShadingPaint.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/RadialShadingPaint.java?rev=1648891&r1=1648890&r2=1648891&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/RadialShadingPaint.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/RadialShadingPaint.java
Thu Jan  1 17:06:15 2015
@@ -16,6 +16,7 @@
  */
 package org.apache.pdfbox.pdmodel.graphics.shading;
 
+import java.awt.Color;
 import java.awt.Paint;
 import java.awt.PaintContext;
 import java.awt.Rectangle;
@@ -67,10 +68,10 @@ public class RadialShadingPaint implemen
         {
             return new RadialShadingContext(shading, cm, xform, matrix, deviceBounds);
         }
-        catch (IOException ex)
+        catch (IOException e)
         {
-            LOG.error(ex);
-            return null;
+            LOG.error("An error occurred while painting", e);
+            return new Color(0, 0, 0, 0).createContext(cm, deviceBounds, userBounds, xform,
hints);
         }
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type1ShadingPaint.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type1ShadingPaint.java?rev=1648891&r1=1648890&r2=1648891&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type1ShadingPaint.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type1ShadingPaint.java
Thu Jan  1 17:06:15 2015
@@ -16,6 +16,7 @@
  */
 package org.apache.pdfbox.pdmodel.graphics.shading;
 
+import java.awt.Color;
 import java.awt.Paint;
 import java.awt.PaintContext;
 import java.awt.Rectangle;
@@ -65,10 +66,10 @@ class Type1ShadingPaint implements Paint
         {
             return new Type1ShadingContext(shading, cm, xform, matrix, deviceBounds);
         }
-        catch (IOException ex)
+        catch (IOException e)
         {
-            LOG.error(ex);
-            return null;
+            LOG.error("An error occurred while painting", e);
+            return new Color(0, 0, 0, 0).createContext(cm, deviceBounds, userBounds, xform,
hints);
         }
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type4ShadingPaint.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type4ShadingPaint.java?rev=1648891&r1=1648890&r2=1648891&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type4ShadingPaint.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type4ShadingPaint.java
Thu Jan  1 17:06:15 2015
@@ -16,6 +16,7 @@
  */
 package org.apache.pdfbox.pdmodel.graphics.shading;
 
+import java.awt.Color;
 import java.awt.Paint;
 import java.awt.PaintContext;
 import java.awt.Rectangle;
@@ -65,10 +66,10 @@ class Type4ShadingPaint implements Paint
         {
             return new Type4ShadingContext(shading, cm, xform, matrix, deviceBounds);
         }
-        catch (IOException ex)
+        catch (IOException e)
         {
-            LOG.error(ex);
-            return null;
+            LOG.error("An error occurred while painting", e);
+            return new Color(0, 0, 0, 0).createContext(cm, deviceBounds, userBounds, xform,
hints);
         }
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type5ShadingPaint.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type5ShadingPaint.java?rev=1648891&r1=1648890&r2=1648891&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type5ShadingPaint.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type5ShadingPaint.java
Thu Jan  1 17:06:15 2015
@@ -16,6 +16,7 @@
  */
 package org.apache.pdfbox.pdmodel.graphics.shading;
 
+import java.awt.Color;
 import java.awt.Paint;
 import java.awt.PaintContext;
 import java.awt.Rectangle;
@@ -65,10 +66,10 @@ class Type5ShadingPaint implements Paint
         {
             return new Type5ShadingContext(shading, cm, xform, matrix, deviceBounds);
         }
-        catch (IOException ex)
+        catch (IOException e)
         {
-            LOG.error(ex);
-            return null;
+            LOG.error("An error occurred while painting", e);
+            return new Color(0, 0, 0, 0).createContext(cm, deviceBounds, userBounds, xform,
hints);
         }
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type6ShadingPaint.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type6ShadingPaint.java?rev=1648891&r1=1648890&r2=1648891&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type6ShadingPaint.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type6ShadingPaint.java
Thu Jan  1 17:06:15 2015
@@ -15,6 +15,7 @@
  */
 package org.apache.pdfbox.pdmodel.graphics.shading;
 
+import java.awt.Color;
 import java.awt.Paint;
 import java.awt.PaintContext;
 import java.awt.Rectangle;
@@ -66,10 +67,10 @@ class Type6ShadingPaint implements Paint
         {
             return new Type6ShadingContext(shading, cm, xform, matrix, deviceBounds);
         }
-        catch (IOException ex)
+        catch (IOException e)
         {
-            LOG.error(ex);
-            return null;
+            LOG.error("An error occurred while painting", e);
+            return new Color(0, 0, 0, 0).createContext(cm, deviceBounds, userBounds, xform,
hints);
         }
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type7ShadingPaint.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type7ShadingPaint.java?rev=1648891&r1=1648890&r2=1648891&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type7ShadingPaint.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Type7ShadingPaint.java
Thu Jan  1 17:06:15 2015
@@ -15,6 +15,7 @@
  */
 package org.apache.pdfbox.pdmodel.graphics.shading;
 
+import java.awt.Color;
 import java.awt.Paint;
 import java.awt.PaintContext;
 import java.awt.Rectangle;
@@ -66,10 +67,10 @@ class Type7ShadingPaint implements Paint
         {
             return new Type7ShadingContext(shading, cm, xform, matrix, deviceBounds);
         }
-        catch (IOException ex)
+        catch (IOException e)
         {
-            LOG.error(ex);
-            return null;
+            LOG.error("An error occurred while painting", e);
+            return new Color(0, 0, 0, 0).createContext(cm, deviceBounds, userBounds, xform,
hints);
         }
     }
 }



Mime
View raw message