pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1792325 - in /pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff: CharStringHandler.java Type1CharString.java Type2CharString.java
Date Sat, 22 Apr 2017 20:18:04 GMT
Author: tilman
Date: Sat Apr 22 20:18:04 2017
New Revision: 1792325

URL: http://svn.apache.org/viewvc?rev=1792325&view=rev
Log:
PDFBOX-2852: return empty list instead of null

Modified:
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CharStringHandler.java
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/Type1CharString.java
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/Type2CharString.java

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CharStringHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CharStringHandler.java?rev=1792325&r1=1792324&r2=1792325&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CharStringHandler.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/CharStringHandler.java Sat Apr
22 20:18:04 2017
@@ -44,10 +44,7 @@ public abstract class CharStringHandler
             {
                 List<Number> results = handleCommand(stack, (CharStringCommand)obj);
                 stack.clear();  // this is basically returning the new stack
-                if (results != null)
-                {
-                    stack.addAll(results);
-                }
+                stack.addAll(results);
             }
             else
             {
@@ -62,6 +59,7 @@ public abstract class CharStringHandler
      *
      * @param numbers a list of numbers
      * @param command the CharStringCommand
+     * @return a list of commands. This can be empty but never be null.
      */
     public abstract List<Number> handleCommand(List<Number> numbers, CharStringCommand
command);
 }
\ No newline at end of file

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/Type1CharString.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/Type1CharString.java?rev=1792325&r1=1792324&r2=1792325&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/Type1CharString.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/Type1CharString.java Sat Apr
22 20:18:04 2017
@@ -23,6 +23,7 @@ import java.awt.geom.Point2D;
 import java.awt.geom.Rectangle2D;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 import org.apache.commons.logging.Log;
@@ -338,7 +339,7 @@ public class Type1CharString
             LOG.warn("Unknown charstring command: " + command.getKey() + " in glyph " + glyphName
+
                      " of font " + fontName);
         }
-        return null;
+        return Collections.emptyList();
     }
 
     /**

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/Type2CharString.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/Type2CharString.java?rev=1792325&r1=1792324&r2=1792325&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/Type2CharString.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/cff/Type2CharString.java Sat Apr
22 20:18:04 2017
@@ -101,7 +101,7 @@ public class Type2CharString extends Typ
         if (name == null)
         {
             addCommand(numbers, command);
-            return null;
+            return Collections.emptyList();
         }
         switch (name)
         {
@@ -246,7 +246,7 @@ public class Type2CharString extends Typ
                 addCommand(numbers, command);
                 break;
         }
-        return null;
+        return Collections.emptyList();
     }
 
     private List<Number> clearStack(List<Number> numbers, boolean flag)



Mime
View raw message