pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1861405 - /pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/CatalogValidationProcess.java
Date Sat, 15 Jun 2019 15:39:19 GMT
Author: tilman
Date: Sat Jun 15 15:39:19 2019
New Revision: 1861405

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

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

Modified: pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/CatalogValidationProcess.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/CatalogValidationProcess.java?rev=1861405&r1=1861404&r2=1861405&view=diff
==============================================================================
--- pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/CatalogValidationProcess.java
(original)
+++ pdfbox/trunk/preflight/src/main/java/org/apache/pdfbox/preflight/process/CatalogValidationProcess.java
Sat Jun 15 15:39:19 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())



Mime
View raw message