Tilman Hausherr created PDFBOX-3051:
---------------------------------------

             Summary: COSArray.getObject() incorrect handling of indirect 
reference to COSNull
                 Key: PDFBOX-3051
                 URL: https://issues.apache.org/jira/browse/PDFBOX-3051
             Project: PDFBox
          Issue Type: Bug
          Components: PDModel
    Affects Versions: 1.8.10, 1.8.11, 2.0.0
            Reporter: Tilman Hausherr
            Assignee: Tilman Hausherr
             Fix For: 1.8.11, 2.0.0


The attached (broken) file has this exception when displaying page 10:
{code}
java.lang.RuntimeException: java.util.concurrent.ExecutionException: 
java.io.IOException: Error: Unknown annotation type COSNull{}
    
org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.done(PagePane.java:175)
    sun.swing.AccumulativeRunnable.run(Unknown Source)
    java.security.AccessController.doPrivileged(Native Method)
    java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
Caused by: java.util.concurrent.ExecutionException: java.io.IOException: Error: 
Unknown annotation type COSNull{}
    
org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.done(PagePane.java:164)
    sun.swing.AccumulativeRunnable.run(Unknown Source)
    java.security.AccessController.doPrivileged(Native Method)
    java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
Caused by: java.io.IOException: Error: Unknown annotation type COSNull{}
    
org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation.createAnnotation(PDAnnotation.java:164)
    org.apache.pdfbox.pdmodel.PDPage.getAnnotations(PDPage.java:664)
    org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:181)
    org.apache.pdfbox.rendering.PDFRenderer.renderPage(PDFRenderer.java:208)
    org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:139)
    org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:68)
    
org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.doInBackground(PagePane.java:155)
    
org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.doInBackground(PagePane.java:138)
    java.lang.Thread.run(Unknown Source)
{code}

The cause is this code:
{code}
    public COSBase getObject( int index )
    {
        Object obj = objects.get( index );
        if( obj instanceof COSObject )
        {
            obj = ((COSObject)obj).getObject();
        }
        else if( obj instanceof COSNull )
        {
            obj = null;
        }
        return (COSBase)obj;
    }
{code}
i.e. a COSObject that points to a COSNull object isn't returned as null, but as 
COSNull. COSDictionary.getDictionaryObject() does not have this bug.

Solution: remove the "else".



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to