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 2016/07/06 17:52:44 UTC

svn commit: r1751718 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/encoding/DictionaryEncoding.java

Author: tilman
Date: Wed Jul  6 17:52:44 2016
New Revision: 1751718

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

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

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/encoding/DictionaryEncoding.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/encoding/DictionaryEncoding.java?rev=1751718&r1=1751717&r2=1751718&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/encoding/DictionaryEncoding.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/encoding/DictionaryEncoding.java Wed Jul  6 17:52:44 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();