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 2017/03/03 22:14:28 UTC

svn commit: r1785404 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBased.java

Author: tilman
Date: Fri Mar  3 22:14:28 2017
New Revision: 1785404

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

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

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBased.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBased.java?rev=1785404&r1=1785403&r2=1785404&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBased.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/color/PDICCBased.java Fri Mar  3 22:14:28 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;
-            }
         }
     }