pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1822040 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java
Date Tue, 23 Jan 2018 19:35:23 GMT
Author: tilman
Date: Tue Jan 23 19:35:23 2018
New Revision: 1822040

URL: http://svn.apache.org/viewvc?rev=1822040&view=rev
Log:
PDFBOX-4071: avoid potential ClassCastException; improve javadoc

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java?rev=1822040&r1=1822039&r2=1822040&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java Tue
Jan 23 19:35:23 2018
@@ -643,8 +643,8 @@ public class COSDictionary extends COSBa
     }
 
     /**
-     * This is a convenience method that will get the dictionary object that is expected
to be a name and convert it to
-     * a string. Null is returned if the entry does not exist in the dictionary.
+     * This is a convenience method that will get the dictionary object that is expected
to be a
+     * string. Null is returned if the entry does not exist in the dictionary.
      *
      * @param key The key to the item in the dictionary.
      * @return The name converted to a string.
@@ -655,8 +655,8 @@ public class COSDictionary extends COSBa
     }
 
     /**
-     * This is a convenience method that will get the dictionary object that is expected
to be a name and convert it to
-     * a string. Null is returned if the entry does not exist in the dictionary.
+     * This is a convenience method that will get the dictionary object that is expected
to be a
+     * string. Null is returned if the entry does not exist in the dictionary.
      *
      * @param key The key to the item in the dictionary.
      * @return The name converted to a string.
@@ -673,8 +673,8 @@ public class COSDictionary extends COSBa
     }
 
     /**
-     * This is a convenience method that will get the dictionary object that is expected
to be a name and convert it to
-     * a string. Null is returned if the entry does not exist in the dictionary.
+     * This is a convenience method that will get the dictionary object that is expected
to be a
+     * string. Null is returned if the entry does not exist in the dictionary.
      *
      * @param key The key to the item in the dictionary.
      * @param defaultValue The default value to return.
@@ -686,8 +686,8 @@ public class COSDictionary extends COSBa
     }
 
     /**
-     * This is a convenience method that will get the dictionary object that is expected
to be a name and convert it to
-     * a string. Null is returned if the entry does not exist in the dictionary.
+     * This is a convenience method that will get the dictionary object that is expected
to be a
+     * string. Null is returned if the entry does not exist in the dictionary.
      *
      * @param key The key to the item in the dictionary.
      * @param defaultValue The default value to return.
@@ -755,10 +755,10 @@ public class COSDictionary extends COSBa
     public String getEmbeddedString(String embedded, COSName key, String defaultValue)
     {
         String retval = defaultValue;
-        COSDictionary dic = (COSDictionary) getDictionaryObject(embedded);
-        if (dic != null)
+        COSBase base = getDictionaryObject(embedded);
+        if (base instanceof COSDictionary)
         {
-            retval = dic.getString(key, defaultValue);
+            retval = ((COSDictionary) base).getString(key, defaultValue);
         }
         return retval;
     }



Mime
View raw message