Author: tilman
Date: Thu Oct 13 17:13:24 2016
New Revision: 1764740

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

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

Modified: 
pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/WriteDecodedDoc.java
URL: 
http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/WriteDecodedDoc.java?rev=1764740&r1=1764739&r2=1764740&view=diff
==============================================================================
--- 
pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/WriteDecodedDoc.java 
(original)
+++ 
pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/WriteDecodedDoc.java 
Thu Oct 13 17:13:24 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);


Reply via email to