pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1663086 - /pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/BodyParseException.java
Date Sun, 01 Mar 2015 12:11:51 GMT
Author: tilman
Date: Sun Mar  1 12:11:51 2015
New Revision: 1663086

URL: http://svn.apache.org/r1663086
Log:
PDFBOX-2576: combine if statements; use foreach loop

Modified:
    pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/BodyParseException.java

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/BodyParseException.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/BodyParseException.java?rev=1663086&r1=1663085&r2=1663086&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/BodyParseException.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/exception/BodyParseException.java
Sun Mar  1 12:11:51 2015
@@ -80,30 +80,26 @@ public class BodyParseException extends
         // default error code
         this.errorCode = PreflightConstants.ERROR_SYNTAX_BODY;
 
-        if (!isTokenMgrError)
+        // it is a parse error, according to the ExpectedTokens data
+        // some error code can be returned
+        if (!isTokenMgrError && this.expectedTokenSequences != null)
         {
-            // it is a parse error, according to the ExpectedTokens data
-            // some error code can be returned
-            if (this.expectedTokenSequences != null)
+            // check object delimiters error
+            for (int expectedTokenSequence[] : this.expectedTokenSequences)
             {
-                // check object delimiters error
-                for (int i = 0; i < this.expectedTokenSequences.length; ++i)
+                // Check only the first expected token on each array.
+                // Others can be checked if some choice can started by the same token
+                // in this case, a factorization is possible
+                switch (expectedTokenSequence[0])
                 {
-                    // Check only the first Expected token on each array.
-                    // Others can be check if some choice can start by the same token
-                    // in this case, a factorization is possible
-                    switch (this.expectedTokenSequences[i][0])
-                    {
                     case PDFParserConstants.START_OBJECT:
                     case PDFParserConstants.END_OBJECT:
                         this.errorCode = PreflightConstants.ERROR_SYNTAX_OBJ_DELIMITER;
                         break;
-                    }
                 }
-                // add here other error code
             }
+            // add other error code here
         }
-
         return errorCode;
     }
 }



Mime
View raw message