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 2019/04/20 12:02:35 UTC
svn commit: r1857872 -
/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java
Author: tilman
Date: Sat Apr 20 12:02:35 2019
New Revision: 1857872
URL: http://svn.apache.org/viewvc?rev=1857872&view=rev
Log:
PDFBOX-4521: avoid ClassCastException
Modified:
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java?rev=1857872&r1=1857871&r2=1857872&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java Sat Apr 20 12:02:35 2019
@@ -310,22 +310,22 @@ public class COSDocument extends COSBase
public boolean isEncrypted()
{
boolean encrypted = false;
- if( trailer != null )
+ if (trailer != null)
{
- encrypted = trailer.getDictionaryObject( COSName.ENCRYPT ) != null;
+ encrypted = trailer.getDictionaryObject(COSName.ENCRYPT) instanceof COSDictionary;
}
return encrypted;
}
/**
- * This will get the encryption dictionary if the document is encrypted or null
- * if the document is not encrypted.
+ * This will get the encryption dictionary if the document is encrypted or null if the document
+ * is not encrypted.
*
* @return The encryption dictionary.
*/
public COSDictionary getEncryptionDictionary()
{
- return (COSDictionary)trailer.getDictionaryObject( COSName.ENCRYPT );
+ return trailer.getCOSDictionary(COSName.ENCRYPT);
}
/**
@@ -346,7 +346,7 @@ public class COSDocument extends COSBase
*/
public COSArray getDocumentID()
{
- return (COSArray) getTrailer().getDictionaryObject(COSName.ID);
+ return getTrailer().getCOSArray(COSName.ID);
}
/**