pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1792081 - /pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cmap/CMapParser.java
Date Thu, 20 Apr 2017 16:30:55 GMT
Author: tilman
Date: Thu Apr 20 16:30:54 2017
New Revision: 1792081

URL: http://svn.apache.org/viewvc?rev=1792081&view=rev
Log:
PDFBOX-2852: use JDK7 syntax

Modified:
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cmap/CMapParser.java

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cmap/CMapParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cmap/CMapParser.java?rev=1792081&r1=1792080&r2=1792081&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cmap/CMapParser.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cmap/CMapParser.java Thu Apr 20
16:30:54 2017
@@ -96,34 +96,34 @@ public class CMapParser
             if (token instanceof Operator)
             {
                 Operator op = (Operator) token;
-                if (op.op.equals("usecmap"))
-                {
-                    parseUsecmap(previousToken, result);
-                }
-                else if (op.op.equals("endcmap"))
+                if (op.op.equals("endcmap"))
                 {
                     // end of CMap reached, stop reading as there isn't any interesting info
anymore
                     break;
                 }
-                else if (op.op.equals("begincodespacerange"))
-                {
-                    parseBegincodespacerange(previousToken, cmapStream, result);
-                }
-                else if (op.op.equals("beginbfchar"))
-                {
-                    parseBeginbfchar(previousToken, cmapStream, result);
-                }
-                else if (op.op.equals("beginbfrange"))
-                {
-                    parseBeginbfrange(previousToken, cmapStream, result);
-                }
-                else if (op.op.equals("begincidchar"))
-                {
-                    parseBegincidchar(previousToken, cmapStream, result);
-                }
-                else if (op.op.equals("begincidrange"))
+
+                switch (op.op)
                 {
-                    parseBegincidrange(previousToken, cmapStream, result);
+                    case "usecmap":
+                        parseUsecmap(previousToken, result);
+                        break;
+                    case "begincodespacerange":
+                        parseBegincodespacerange(previousToken, cmapStream, result);
+                        break;
+                    case "beginbfchar":
+                        parseBeginbfchar(previousToken, cmapStream, result);
+                        break;
+                    case "beginbfrange":
+                        parseBeginbfrange(previousToken, cmapStream, result);
+                        break;
+                    case "begincidchar":
+                        parseBegincidchar(previousToken, cmapStream, result);
+                        break;
+                    case "begincidrange":
+                        parseBegincidrange(previousToken, cmapStream, result);
+                        break;
+                    default:
+                        break;
                 }
             }
             else if (token instanceof LiteralName)
@@ -146,65 +146,77 @@ public class CMapParser
     private void parseLiteralName(Object token, PushbackInputStream cmapStream, CMap result)
throws IOException
     {
         LiteralName literal = (LiteralName) token;
-        if ("WMode".equals(literal.name))
+        switch (literal.name)
         {
-            Object next = parseNextToken(cmapStream);
-            if (next instanceof Integer)
+            case "WMode":
             {
-                result.setWMode((Integer) next);
-            }
-        }
-        else if ("CMapName".equals(literal.name))
-        {
-            Object next = parseNextToken(cmapStream);
-            if (next instanceof LiteralName)
-            {
-                result.setName(((LiteralName) next).name);
+                Object next = parseNextToken(cmapStream);
+                if (next instanceof Integer)
+                {
+                    result.setWMode((Integer) next);
+                }
+                break;
             }
-        }
-        else if ("CMapVersion".equals(literal.name))
-        {
-            Object next = parseNextToken(cmapStream);
-            if (next instanceof Number)
+            case "CMapName":
             {
-                result.setVersion(next.toString());
+                Object next = parseNextToken(cmapStream);
+                if (next instanceof LiteralName)
+                {
+                    result.setName(((LiteralName) next).name);
+                }
+                break;
             }
-            else if (next instanceof String)
+            case "CMapVersion":
             {
-                result.setVersion((String) next);
+                Object next = parseNextToken(cmapStream);
+                if (next instanceof Number)
+                {
+                    result.setVersion(next.toString());
+                }
+                else if (next instanceof String)
+                {
+                    result.setVersion((String) next);
+                }
+                break;
             }
-        }
-        else if ("CMapType".equals(literal.name))
-        {
-            Object next = parseNextToken(cmapStream);
-            if (next instanceof Integer)
+            case "CMapType":
             {
-                result.setType((Integer) next);
+                Object next = parseNextToken(cmapStream);
+                if (next instanceof Integer)
+                {
+                    result.setType((Integer) next);
+                }
+                break;
             }
-        }
-        else if ("Registry".equals(literal.name))
-        {
-            Object next = parseNextToken(cmapStream);
-            if (next instanceof String)
+            case "Registry":
             {
-                result.setRegistry((String) next);
+                Object next = parseNextToken(cmapStream);
+                if (next instanceof String)
+                {
+                    result.setRegistry((String) next);
+                }
+                break;
             }
-        }
-        else if ("Ordering".equals(literal.name))
-        {
-            Object next = parseNextToken(cmapStream);
-            if (next instanceof String)
+            case "Ordering":
             {
-                result.setOrdering((String) next);
+                Object next = parseNextToken(cmapStream);
+                if (next instanceof String)
+                {
+                    result.setOrdering((String) next);
+                }
+                break;
             }
-        }
-        else if ("Supplement".equals(literal.name))
-        {
-            Object next = parseNextToken(cmapStream);
-            if (next instanceof Integer)
+            case "Supplement":
             {
-                result.setSupplement((Integer) next);
+                Object next = parseNextToken(cmapStream);
+                if (next instanceof Integer)
+                {
+                    result.setSupplement((Integer) next);
+                }
+                break;
             }
+            default:
+                break;
         }
     }
 



Mime
View raw message