pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1789714 - in /pdfbox/trunk: pdfbox/src/main/java/org/apache/pdfbox/filter/Filter.java pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/JPEGFactory.java tools/src/main/java/org/apache/pdfbox/tools/imageio/ImageIOUtil.java
Date Fri, 31 Mar 2017 17:12:31 GMT
Author: tilman
Date: Fri Mar 31 17:12:31 2017
New Revision: 1789714

URL: http://svn.apache.org/viewvc?rev=1789714&view=rev
Log:
PDFBOX-3739: avoid NPE

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/Filter.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/JPEGFactory.java
    pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/imageio/ImageIOUtil.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/Filter.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/Filter.java?rev=1789714&r1=1789713&r2=1789714&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/Filter.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/Filter.java Fri Mar 31 17:12:31
2017
@@ -118,7 +118,7 @@ public abstract class Filter
         while (readers.hasNext())
         {
             reader = readers.next();
-            if (reader.canReadRaster())
+            if (reader != null && reader.canReadRaster())
             {
                 break;
             }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/JPEGFactory.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/JPEGFactory.java?rev=1789714&r1=1789713&r2=1789714&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/JPEGFactory.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/image/JPEGFactory.java
Fri Mar 31 17:12:31 2017
@@ -253,6 +253,10 @@ public final class JPEGFactory
                 writer.dispose();
             }
             writer = writers.next();
+            if (writer == null)
+            {
+                continue;
+            }
             // PDFBOX-3566: avoid CLibJPEGImageWriter, which is not a JPEGImageWriteParam
             if (writer.getDefaultWriteParam() instanceof JPEGImageWriteParam)
             {

Modified: pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/imageio/ImageIOUtil.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/imageio/ImageIOUtil.java?rev=1789714&r1=1789713&r2=1789714&view=diff
==============================================================================
--- pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/imageio/ImageIOUtil.java (original)
+++ pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/imageio/ImageIOUtil.java Fri
Mar 31 17:12:31 2017
@@ -184,6 +184,10 @@ public final class ImageIOUtil
                     writer.dispose();
                 }
                 writer = writers.next();
+                if (writer == null)
+                {
+                    continue;
+                }
                 param = writer.getDefaultWriteParam();
                 metadata = writer.getDefaultImageMetadata(new ImageTypeSpecifier(image),
param);
                 if (metadata != null



Mime
View raw message