You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ju...@apache.org on 2010/10/14 11:54:49 UTC
svn commit: r1022444 -
/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
Author: jukka
Date: Thu Oct 14 09:54:49 2010
New Revision: 1022444
URL: http://svn.apache.org/viewvc?rev=1022444&view=rev
Log:
PDFBOX-813: ClassCastException: COSInteger cannot be cast to COSDictionary
Avoid the CCE by explicitly checking for the type of the ROOT object.
Modified:
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java?rev=1022444&r1=1022443&r2=1022444&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java Thu Oct 14 09:54:49 2010
@@ -413,14 +413,12 @@ public class PDDocument implements Pagea
if( documentCatalog == null )
{
COSDictionary trailer = document.getTrailer();
- COSDictionary infoDic = (COSDictionary)trailer.getDictionaryObject( COSName.ROOT );
- if( infoDic == null )
- {
- documentCatalog = new PDDocumentCatalog( this );
- }
- else
- {
- documentCatalog = new PDDocumentCatalog( this, infoDic );
+ COSBase dictionary = trailer.getDictionaryObject( COSName.ROOT );
+ if (dictionary instanceof COSDictionary) {
+ documentCatalog =
+ new PDDocumentCatalog(this, (COSDictionary) dictionary);
+ } else {
+ documentCatalog = new PDDocumentCatalog(this);
}
}