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 2019/06/15 15:39:24 UTC

svn commit: r1861406 - /pdfbox/branches/issue4569/preflight/src/main/java/org/apache/pdfbox/preflight/process/CatalogValidationProcess.java

Author: tilman
Date: Sat Jun 15 15:39:24 2019
New Revision: 1861406

URL: http://svn.apache.org/viewvc?rev=1861406&view=rev
Log:
PDFBOX-4071: SonarQube fix (introduce a new variable instead of reusing the parameter); correct comment

Modified:
    pdfbox/branches/issue4569/preflight/src/main/java/org/apache/pdfbox/preflight/process/CatalogValidationProcess.java

Modified: pdfbox/branches/issue4569/preflight/src/main/java/org/apache/pdfbox/preflight/process/CatalogValidationProcess.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue4569/preflight/src/main/java/org/apache/pdfbox/preflight/process/CatalogValidationProcess.java?rev=1861406&r1=1861405&r2=1861406&view=diff
==============================================================================
--- pdfbox/branches/issue4569/preflight/src/main/java/org/apache/pdfbox/preflight/process/CatalogValidationProcess.java (original)
+++ pdfbox/branches/issue4569/preflight/src/main/java/org/apache/pdfbox/preflight/process/CatalogValidationProcess.java Sat Jun 15 15:39:24 2019
@@ -325,10 +325,11 @@ public class CatalogValidationProcess ex
                 return;
             }
 
+            COSBase localDestOutputProfile = destOutputProfile;
             // destOutputProfile should be an instance of COSObject because of this is a object reference
-            if (destOutputProfile instanceof COSObject)
+            if (localDestOutputProfile instanceof COSObject)
             {
-                if (mapDestOutputProfile.containsKey(new COSObjectKey((COSObject) destOutputProfile)))
+                if (mapDestOutputProfile.containsKey(new COSObjectKey((COSObject) localDestOutputProfile)))
                 {
                     // the profile is already checked. continue
                     return;
@@ -340,23 +341,21 @@ public class CatalogValidationProcess ex
                             "More than one ICCProfile is defined"));
                     return;
                 }
-                // else the profile will be kept in the tmpDestOutputProfile if it is valid
+                // else the profile will be kept in the mapDestOutputProfile if it is valid
+
+                localDestOutputProfile = ((COSObject) localDestOutputProfile).getObject();
             }
 
             // keep reference to avoid multiple profile definition
             mapDestOutputProfile.put(new COSObjectKey((COSObject) destOutputProfile), true);
-            if (destOutputProfile instanceof COSObject) 
-            {
-                destOutputProfile = ((COSObject)destOutputProfile).getObject();
-            }
-            COSStream stream = destOutputProfile instanceof COSStream
-                    ? (COSStream) destOutputProfile : null;
-            if (stream == null)
+
+            if (!(localDestOutputProfile instanceof COSStream))
             {
                 addValidationError(ctx, new ValidationError(ERROR_GRAPHIC_OUTPUT_INTENT_INVALID_ENTRY,
-                        "OutputIntent object uses a NULL Object"));
+                        "OutputIntent object must be a stream"));
                 return;
             }
+            COSStream stream = (COSStream) localDestOutputProfile;
 
             ICC_Profile iccp;
             try (InputStream is = stream.createInputStream())