pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1641459 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
Date Mon, 24 Nov 2014 19:54:30 GMT
Author: lehmi
Date: Mon Nov 24 19:54:30 2014
New Revision: 1641459

URL: http://svn.apache.org/r1641459
Log:
PDFBOX-2521: don't throw IOException in lenient mode if stream length is missing

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
  (contents, props changed)

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java?rev=1641459&r1=1641458&r2=1641459&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
Mon Nov 24 19:54:30 2014
@@ -1792,12 +1792,19 @@ public class NonSequentialPDFParser exte
             COSNumber streamLengthObj = getLength(dic.getItem(COSName.LENGTH));
             if (streamLengthObj == null)
             {
-                throw new IOException("Missing length for stream.");
+                if (isLenient)
+                {
+                   LOG.warn("The stream doesn't provide any stream length, using fallback
readUntilEnd"); 
+                }
+                else
+                {
+                    throw new IOException("Missing length for stream.");
+                }
             }
 
             boolean useReadUntilEnd = false;
             // ---- get output stream to copy data to
-            if (validateStreamLength(streamLengthObj.longValue()))
+            if (streamLengthObj != null && validateStreamLength(streamLengthObj.longValue()))
             {
                 out = stream.createFilteredStream(streamLengthObj);
                 long remainBytes = streamLengthObj.longValue();

Propchange: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Nov 24 19:54:30 2014
@@ -0,0 +1,3 @@
+/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java:1641458
+/pdfbox/branches/no-awt/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java:1618517-1621410
+/pdfbox/no-awt/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java:1618514-1618516



Mime
View raw message