pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1785403 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBased.java
Date Fri, 03 Mar 2017 22:14:23 GMT
Author: tilman
Date: Fri Mar  3 22:14:23 2017
New Revision: 1785403

URL: http://svn.apache.org/viewvc?rev=1785403&view=rev
Log:
PDFBOX-2852: use switch

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBased.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBased.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBased.java?rev=1785403&r1=1785402&r2=1785403&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBased.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBased.java
Fri Mar  3 22:14:23 2017
@@ -333,26 +333,19 @@ public final class PDICCBased extends PD
         {
             return iccProfile.getColorSpaceType();
         }
-        else
+
+        // if the ICC Profile could not be read
+        switch (alternateColorSpace.getNumberOfComponents())
         {
-            // if the ICC Profile could not be read
-            if (alternateColorSpace.getNumberOfComponents() == 1)
-            {
+            case 1:
                 return ICC_ColorSpace.TYPE_GRAY;
-            }
-            else if (alternateColorSpace.getNumberOfComponents() == 3)
-            {
+            case 3:
                 return ICC_ColorSpace.TYPE_RGB;
-            }
-            else if (alternateColorSpace.getNumberOfComponents() == 4)
-            {
+            case 4:
                 return ICC_ColorSpace.TYPE_CMYK;
-            }
-            else
-            {
+            default:
                 // should not happen as all ICC color spaces in PDF must have 1,3, or 4 components
                 return -1;
-            }
         }
     }
 



Mime
View raw message