pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1764741 - /pdfbox/branches/2.0/tools/src/main/java/org/apache/pdfbox/tools/WriteDecodedDoc.java
Date Thu, 13 Oct 2016 17:13:30 GMT
Author: tilman
Date: Thu Oct 13 17:13:30 2016
New Revision: 1764741

URL: http://svn.apache.org/viewvc?rev=1764741&view=rev
Log:
PDFBOX-3526: skip objects that don't decode

Modified:
    pdfbox/branches/2.0/tools/src/main/java/org/apache/pdfbox/tools/WriteDecodedDoc.java

Modified: pdfbox/branches/2.0/tools/src/main/java/org/apache/pdfbox/tools/WriteDecodedDoc.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/tools/src/main/java/org/apache/pdfbox/tools/WriteDecodedDoc.java?rev=1764741&r1=1764740&r2=1764741&view=diff
==============================================================================
--- pdfbox/branches/2.0/tools/src/main/java/org/apache/pdfbox/tools/WriteDecodedDoc.java (original)
+++ pdfbox/branches/2.0/tools/src/main/java/org/apache/pdfbox/tools/WriteDecodedDoc.java Thu
Oct 13 17:13:30 2016
@@ -75,7 +75,19 @@ public class WriteDecodedDoc
                     {
                         continue;
                     }
-                    byte[] bytes = new PDStream(stream).toByteArray();
+                    byte[] bytes;
+                    try
+                    {
+                        bytes = new PDStream(stream).toByteArray();
+                    }
+                    catch (IOException ex)
+                    {
+                        System.err.println("skip " + 
+                                cosObject.getObjectNumber() + " " + 
+                                cosObject.getGenerationNumber() + " obj: " + 
+                                ex.getMessage());
+                        continue;
+                    }
                     stream.removeItem(COSName.FILTER);
                     OutputStream streamOut = stream.createOutputStream();
                     streamOut.write(bytes);



Mime
View raw message