pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1861935 - in /pdfbox/branches/issue45: ./ preflight/src/main/java/org/apache/pdfbox/preflight/process/StreamValidationProcess.java
Date Sun, 23 Jun 2019 14:34:24 GMT
Author: lehmi
Date: Sun Jun 23 14:34:23 2019
New Revision: 1861935

URL: http://svn.apache.org/viewvc?rev=1861935&view=rev
Log:
PDFBOX-4578: use the correct error number

Modified:
    pdfbox/branches/issue45/   (props changed)
    pdfbox/branches/issue45/preflight/src/main/java/org/apache/pdfbox/preflight/process/StreamValidationProcess.java

Propchange: pdfbox/branches/issue45/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Jun 23 14:34:23 2019
@@ -2,4 +2,4 @@
 /pdfbox/branches/issue4569:1861285,1861586
 /pdfbox/branches/no-awt:1618517-1621410
 /pdfbox/no-awt:1618514-1618516
-/pdfbox/trunk:1736223,1736227,1736615,1737043,1737130,1737599-1737600,1738755,1740160,1742437,1742442,1743248,1745595,1745606,1745772,1745774,1745776,1745779,1746032,1746151,1749162,1749165,1749432,1766088,1766213,1767585,1768061,1770985,1770988,1772528,1778172,1782679,1786586,1786603,1787546,1789414,1790745,1794073,1794090,1794620,1794753,1794859,1794891,1800566,1812426,1814226,1826836,1859501,1859510,1859664,1859686,1861927
+/pdfbox/trunk:1736223,1736227,1736615,1737043,1737130,1737599-1737600,1738755,1740160,1742437,1742442,1743248,1745595,1745606,1745772,1745774,1745776,1745779,1746032,1746151,1749162,1749165,1749432,1766088,1766213,1767585,1768061,1770985,1770988,1772528,1778172,1782679,1786586,1786603,1787546,1789414,1790745,1794073,1794090,1794620,1794753,1794859,1794891,1800566,1812426,1814226,1826836,1859501,1859510,1859664,1859686,1861927,1861933

Modified: pdfbox/branches/issue45/preflight/src/main/java/org/apache/pdfbox/preflight/process/StreamValidationProcess.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/preflight/src/main/java/org/apache/pdfbox/preflight/process/StreamValidationProcess.java?rev=1861935&r1=1861934&r2=1861935&view=diff
==============================================================================
--- pdfbox/branches/issue45/preflight/src/main/java/org/apache/pdfbox/preflight/process/StreamValidationProcess.java
(original)
+++ pdfbox/branches/issue45/preflight/src/main/java/org/apache/pdfbox/preflight/process/StreamValidationProcess.java
Sun Jun 23 14:34:23 2019
@@ -22,6 +22,7 @@
 package org.apache.pdfbox.preflight.process;
 
 import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_SYNTAX_STREAM_DAMAGED;
+import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_SYNTAX_STREAM_DELIMITER;
 import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_SYNTAX_STREAM_FX_KEYS;
 import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_SYNTAX_STREAM_INVALID_FILTER;
 import static org.apache.pdfbox.preflight.PreflightConstants.ERROR_SYNTAX_STREAM_LENGTH_INVALID;
@@ -229,14 +230,12 @@ public class StreamValidationProcess ext
                 {
                     int c = ra.read();
                     // "stream" has to be followed by a LF or CRLF
-                    if (c != '\r' && c != '\n')
+                    if ((c != '\r' && c != '\n') //
+                            || (c == '\r' && ra.read() != '\n'))
                     {
-                        addStreamLengthValidationError(context, cObj, length, "");
-                        return;
-                    }
-                    if (c == '\r' && ra.read() != '\n')
-                    {
-                        addStreamLengthValidationError(context, cObj, length, "");
+                        addValidationError(context,
+                                new ValidationError(ERROR_SYNTAX_STREAM_DELIMITER,
+                                        "Expected 'EOL' after the stream keyword not found"));
                         return;
                     }
                     // ---- Here is the true beginning of the Stream Content.
@@ -280,6 +279,9 @@ public class StreamValidationProcess ext
                             || (buffer2[0] == '\n' && buffer2[1] != 'e') //
                             || !endStream.contains(ENDSTREAM))
                     {
+                        // TODO in some cases it is hard to say if the reason for this issue
is a missing EOL or a wrong
+                        // stream length, see isartor-6-1-7-t03-fail-a.pdf
+                        // the implementation has to be adjusted similar to PreflightParser#parseCOSStream
                         addStreamLengthValidationError(context, cObj, length, endStream);
                     }
                 }



Mime
View raw message