Author: tilman
Date: Sat Feb 22 14:00:05 2014
New Revision: 1570842

URL: http://svn.apache.org/r1570842
Log:
PDFBOX-1811: don't fail, but put a warning if the parser is lenient and  object 
doesn't end with "endobj" but with the start of a new " obj"

Modified:
    
pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java

Modified: 
pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
URL: 
http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java?rev=1570842&r1=1570841&r2=1570842&view=diff
==============================================================================
--- 
pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
 (original)
+++ 
pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
 Sat Feb 22 14:00:05 2014
@@ -1341,8 +1341,16 @@ public class NonSequentialPDFParser exte
 
                 if (!endObjectKey.startsWith("endobj"))
                 {
-                    throw new IOException("Object (" + readObjNr + ":" + 
readObjGen + ") at offset "
-                            + offsetOrObjstmObNr + " does not end with 
'endobj'.");
+                    if (endObjectKey.endsWith(" obj") && isLenient)
+                    {
+                        LOG.warn("Object (" + readObjNr + ":" + readObjGen + 
") at offset "
+                                + offsetOrObjstmObNr + " does not end with 
'endobj' but with '" + endObjectKey + "'");
+                    }
+                    else
+                    {
+                        throw new IOException("Object (" + readObjNr + ":" + 
readObjGen + ") at offset "
+                                + offsetOrObjstmObNr + " does not end with 
'endobj' but with '" + endObjectKey + "'");
+                    }
                 }
 
                 releasePdfSourceInputStream();


Reply via email to