pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1771774 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/DCTFilter.java
Date Mon, 28 Nov 2016 17:13:59 GMT
Author: tilman
Date: Mon Nov 28 17:13:59 2016
New Revision: 1771774

URL: http://svn.apache.org/viewvc?rev=1771774&view=rev
Log:
PDFBOX-2852: replace chain of ifs with switch

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/DCTFilter.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/DCTFilter.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/DCTFilter.java?rev=1771774&r1=1771773&r2=1771774&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/DCTFilter.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/filter/DCTFilter.java Mon Nov
28 17:13:59 2016
@@ -118,20 +118,21 @@ final class DCTFilter extends Filter
                         Field field = reader.getClass().getDeclaredField("colorSpaceCode");
                         field.setAccessible(true);
                         int colorSpaceCode = field.getInt(reader);
-                        
-                        if (colorSpaceCode == 7 || colorSpaceCode == 8 || colorSpaceCode
== 9 || colorSpaceCode == 11)
+                        switch (colorSpaceCode)
                         {
-                            // YCCK
-                            transform = 2;
-                        }
-                        else if (colorSpaceCode == 4)
-                        {
-                            // CMYK
-                            transform = 0;
-                        }
-                        else
-                        {
-                            throw new IOException("Unexpected color space: " + colorSpaceCode);
+                            case 7:
+                            case 8:
+                            case 9:
+                            case 11:
+                                // YCCK
+                                transform = 2;
+                                break;
+                            case 4:
+                                // CMYK
+                                transform = 0;
+                                break;
+                            default:
+                                throw new IOException("Unexpected color space: " + colorSpaceCode);
                         }
                     }
                     catch (NoSuchFieldException e1)



Mime
View raw message