You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Adam Nichols (JIRA)" <ji...@apache.org> on 2010/11/23 18:52:23 UTC

[jira] Resolved: (PDFBOX-902) ClassCastException caused by unhandled Markup Annotations.

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

Adam Nichols resolved PDFBOX-902.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 1.4.0
         Assignee: Adam Nichols

Patch committed in revision 1038227

> ClassCastException caused by unhandled Markup Annotations.
> ----------------------------------------------------------
>
>                 Key: PDFBOX-902
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-902
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 1.3.1
>            Reporter: Kevin Jackson
>            Assignee: Adam Nichols
>             Fix For: 1.4.0
>
>
> Got a ClassCastException in the getParent() method of PDAnnotationPopup because some Markup Annotations are not handled fully by PDFBox and become PDAnnotationUnknown
> Solution to make them generic PDAnnotationMarkup instead.
> ### Eclipse Workspace Patch 1.0
> #P pdfbox
> Index: pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotation.java
> ===================================================================
> --- pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotation.java	(revision 1026306)
> +++ pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotation.java	(working copy)
> @@ -138,6 +138,15 @@
>              {
>                 annot = new PDAnnotationWidget( annotDic );
>              }
> +            else if( subtype.equals( PDAnnotationMarkup.SUB_TYPE_FREETEXT ) ||
> +                    subtype.equals( PDAnnotationMarkup.SUB_TYPE_POLYGON ) ||
> +                    subtype.equals( PDAnnotationMarkup.SUB_TYPE_POLYLINE ) ||
> +                    subtype.equals( PDAnnotationMarkup.SUB_TYPE_CARET ) ||
> +                    subtype.equals( PDAnnotationMarkup.SUB_TYPE_INK ) ||
> +                    subtype.equals( PDAnnotationMarkup.SUB_TYPE_SOUND ))
> +            {
> +                annot = new PDAnnotationMarkup( annotDic );
> +            }
>              else
>              {
>                  annot = new PDAnnotationUnknown( annotDic );
> Index: pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationMarkup.java
> ===================================================================
> --- pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationMarkup.java	(revision 1026306)
> +++ pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationMarkup.java	(working copy)
> @@ -32,8 +32,32 @@
>   * @author Paul King
>   * @version $Revision: 1.1 $
>   */
> -public abstract class PDAnnotationMarkup extends PDAnnotation
> +public class PDAnnotationMarkup extends PDAnnotation
>  {
> +    /**
> +     * Constant for a FreeText type of annotation.
> +     */
> +    public static final String SUB_TYPE_FREETEXT = "FreeText";
> +    /**
> +     * Constant for an Polygon type of annotation.
> +     */
> +    public static final String SUB_TYPE_POLYGON = "Polygon";
> +    /**
> +     * Constant for an PolyLine type of annotation.
> +     */
> +    public static final String SUB_TYPE_POLYLINE = "PolyLine";
> +    /**
> +     * Constant for an Caret type of annotation.
> +     */
> +    public static final String SUB_TYPE_CARET = "Caret";
> +    /**
> +     * Constant for an Ink type of annotation.
> +     */
> +    public static final String SUB_TYPE_INK = "Ink";
> +    /**
> +     * Constant for an Sound type of annotation.
> +     */
> +    public static final String SUB_TYPE_SOUND = "Sound";
>  
>      /*
>       * The various values of the reply type as defined in the PDF 1.7 reference

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.