pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1801490 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java
Date Mon, 10 Jul 2017 16:17:57 GMT
Author: tilman
Date: Mon Jul 10 16:17:57 2017
New Revision: 1801490

URL: http://svn.apache.org/viewvc?rev=1801490&view=rev
Log:
PDFBOX-3861: avoid ClassCastException

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=1801490&r1=1801489&r2=1801490&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 Mon
Jul 10 16:17:57 2017
@@ -784,8 +784,12 @@ public class COSDictionary extends COSBa
      */
     public Calendar getDate(COSName key)
     {
-        COSString date = (COSString) getDictionaryObject(key);
-        return DateConverter.toCalendar(date);
+        COSBase base = getDictionaryObject(key);
+        if (base instanceof COSString)
+        {
+            return DateConverter.toCalendar((COSString) base);
+        }
+        return null;
     }
 
     /**



Mime
View raw message