pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1751717 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/encoding/DictionaryEncoding.java
Date Wed, 06 Jul 2016 17:52:28 GMT
Author: tilman
Date: Wed Jul  6 17:52:28 2016
New Revision: 1751717

URL: http://svn.apache.org/viewvc?rev=1751717&view=rev
Log:
PDFBOX-3403: Sonar fixes

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/encoding/DictionaryEncoding.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/encoding/DictionaryEncoding.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/encoding/DictionaryEncoding.java?rev=1751717&r1=1751716&r2=1751717&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/encoding/DictionaryEncoding.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/encoding/DictionaryEncoding.java
Wed Jul  6 17:52:28 2016
@@ -128,11 +128,16 @@ public class DictionaryEncoding extends
     private void applyDifferences()
     {
         // now replace with the differences
-        COSArray differences = (COSArray)encoding.getDictionaryObject( COSName.DIFFERENCES
);
+        COSBase base = encoding.getDictionaryObject(COSName.DIFFERENCES);
+        if (!(base instanceof COSArray))
+        {
+            return;
+        }
+        COSArray diffArray = (COSArray) base;
         int currentIndex = -1;
-        for( int i=0; differences != null && i<differences.size(); i++ )
+        for (int i = 0; i < diffArray.size(); i++)
         {
-            COSBase next = differences.getObject( i );
+            COSBase next = diffArray.getObject(i);
             if( next instanceof COSNumber)
             {
                 currentIndex = ((COSNumber)next).intValue();



Mime
View raw message