You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Maruan Sahyoun (JIRA)" <ji...@apache.org> on 2013/04/06 16:59:15 UTC

[jira] [Closed] (PDFBOX-177) getAnnotations throws ClassCastException

     [ https://issues.apache.org/jira/browse/PDFBOX-177?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Maruan Sahyoun closed PDFBOX-177.
---------------------------------

    Resolution: Cannot Reproduce

there were no samples provided so can't verify if the issue is fixed. Closing as the suggested improvements were made prior to being an Apache project
                
> getAnnotations throws ClassCastException
> ----------------------------------------
>
>                 Key: PDFBOX-177
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-177
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>            Priority: Minor
>
> [imported from SourceForge]
> http://sourceforge.net/tracker/index.php?group_id=78314&atid=552832&aid=1506189
> Originally submitted by nobody on 2006-06-14 09:31.
>  The following code:
> 1.        PDDocument lPDDoc2    =
> PDDocument.load("myPdf.pdf");
> 2.        PDPage lPage        = (PDPage)
> lPDDoc2.getDocumentCatalog().getAllPages().get(0);
> 3.        List   lAnnotations = lPage.getAnnotations();
> Leads to the following exception being thrown on line 3:
> Exception in thread "main"
> java.lang.ClassCastException: org.pdfbox.cos.COSName
>         at
> org.pdfbox.cos.COSDictionary.getString(COSDictionary.java:572)
>         at
> org.pdfbox.pdmodel.interactive.annotation.PDAnnotation.createAnnotation(PDAnnotation.java:107)
>         at
> org.pdfbox.pdmodel.PDPage.getAnnotations(PDPage.java:714)
> [comment on SourceForge]
> Originally sent by nobody.
> Logged In: NO 
> Fixed in latest nightly builds
> [comment on SourceForge]
> Originally sent by nobody.
> Logged In: NO 
> Think this can be fixed by chaning line 107 of PDAnnotation from
>             String subtype = annotDic.getString(
> COSName.SUBTYPE );
> to
>             String subtype = annotDic.getNameAsString(
> COSName.SUBTYPE );

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira