You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2021/05/07 03:43:16 UTC

svn commit: r1889583 - in /pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight: graphic/ICCProfileWrapper.java process/CatalogValidationProcess.java

Author: tilman
Date: Fri May  7 03:43:16 2021
New Revision: 1889583

URL: http://svn.apache.org/viewvc?rev=1889583&view=rev
Log:
PDFBOX-4892: remove redundant null check for loops, as suggested by valerybokov

Modified:
    pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/graphic/ICCProfileWrapper.java
    pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/CatalogValidationProcess.java

Modified: pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/graphic/ICCProfileWrapper.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/graphic/ICCProfileWrapper.java?rev=1889583&r1=1889582&r2=1889583&view=diff
==============================================================================
--- pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/graphic/ICCProfileWrapper.java (original)
+++ pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/graphic/ICCProfileWrapper.java Fri May  7 03:43:16 2021
@@ -127,7 +127,11 @@ public class ICCProfileWrapper
         COSBase cBase = catalog.getCOSObject().getItem(COSName.getPDFName(DOCUMENT_DICTIONARY_KEY_OUTPUT_INTENTS));
         COSArray outputIntents = COSUtils.getAsArray(cBase, document.getDocument());
 
-        for (int i = 0; outputIntents != null && i < outputIntents.size(); ++i)
+        if (outputIntents == null)
+        {
+            return null;
+        }
+        for (int i = 0; i < outputIntents.size(); ++i)
         {
             COSDictionary outputIntentDict = COSUtils.getAsDictionary(outputIntents.get(i), document.getDocument());
             COSBase destOutputProfile = outputIntentDict.getItem(OUTPUT_INTENT_DICTIONARY_KEY_DEST_OUTPUT_PROFILE);

Modified: pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/CatalogValidationProcess.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/CatalogValidationProcess.java?rev=1889583&r1=1889582&r2=1889583&view=diff
==============================================================================
--- pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/CatalogValidationProcess.java (original)
+++ pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/CatalogValidationProcess.java Fri May  7 03:43:16 2021
@@ -246,7 +246,11 @@ public class CatalogValidationProcess ex
         COSArray outputIntents = COSUtils.getAsArray(cBase, cosDocument);
 
         Map<COSObjectKey, Boolean> tmpDestOutputProfile = new HashMap<COSObjectKey, Boolean>();
-        for (int i = 0; outputIntents != null && i < outputIntents.size(); ++i)
+        if (outputIntents == null)
+        {
+            return;
+        }
+        for (int i = 0; i < outputIntents.size(); ++i)
         {
             COSDictionary outputIntentDict = COSUtils.getAsDictionary(outputIntents.get(i), cosDocument);