pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1651442 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser: BaseParser.java NonSequentialPDFParser.java
Date Tue, 13 Jan 2015 19:09:17 GMT
Author: tilman
Date: Tue Jan 13 19:09:16 2015
New Revision: 1651442

URL: http://svn.apache.org/r1651442
Log:
PDFBOX-2576: use endstream constant

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java?rev=1651442&r1=1651441&r2=1651442&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java Tue Jan
13 19:09:16 2015
@@ -108,7 +108,7 @@ public abstract class BaseParser
     /**
      * This is a string constant that will be used for comparisons.
      */
-    private static final String ENDSTREAM_STRING = "endstream";
+    protected static final String ENDSTREAM_STRING = "endstream";
     /**
      * This is a string constant that will be used for comparisons.
      */

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=1651442&r1=1651441&r2=1651442&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
Tue Jan 13 19:09:16 2015
@@ -1455,7 +1455,7 @@ public class NonSequentialPDFParser exte
                     endObjectKey = readLine();
 
                     // we have case with a second 'endstream' before endobj
-                    if (!endObjectKey.startsWith("endobj") && endObjectKey.startsWith("endstream"))
+                    if (!endObjectKey.startsWith("endobj") && endObjectKey.startsWith(ENDSTREAM_STRING))
                     {
                         endObjectKey = endObjectKey.substring(9).trim();
                         if (endObjectKey.length() == 0)
@@ -1786,14 +1786,14 @@ public class NonSequentialPDFParser exte
                 // avoid follow-up warning about missing endobj
                 pdfSource.unread("endobj".getBytes(ISO_8859_1));
             }
-            else if (endStream.length() > 9 && isLenient && endStream.substring(0,9).equals("endstream"))
+            else if (endStream.length() > 9 && isLenient && endStream.substring(0,9).equals(ENDSTREAM_STRING))
             {
                 LOG.warn("stream ends with '" + endStream + "' instead of 'endstream' at
offset "
                         + pdfSource.getOffset());
                 // unread the "extra" bytes
                 pdfSource.unread(endStream.substring(9).getBytes(ISO_8859_1));
             }
-            else if (!endStream.equals("endstream"))
+            else if (!endStream.equals(ENDSTREAM_STRING))
             {
                 throw new IOException(
                         "Error reading stream, expected='endstream' actual='"
@@ -1826,7 +1826,7 @@ public class NonSequentialPDFParser exte
         {
             pdfSource.seek(expectedEndOfStream);
             skipSpaces();
-            if (!checkBytesAtOffset("endstream".getBytes(ISO_8859_1)))
+            if (!checkBytesAtOffset(ENDSTREAM_STRING.getBytes(ISO_8859_1)))
             {
                 streamLengthIsValid = false;
                 LOG.error("The end of the stream doesn't point to the correct offset, using
workaround to read the stream");



Mime
View raw message