Hi,

I have found the following Exception when experimenting with the PDFBox
trunk:

java.lang.ClassCastException: org.apache.pdfbox.cos.COSNull
    at org.apache.pdfbox.cos.COSArray.getInt(COSArray.java:240)
    at org.apache.pdfbox.cos.COSArray.getInt(COSArray.java:224)
    at
org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination.PDPageX
YZDestination.getLeft(PDPageXYZDestination.java:67)
    at ...

As a fix I have changed the method from
------------------------------------------------------
    public int getInt( int index, int defaultValue )
    {
        int retval = defaultValue;
        if( defaultValue < size() )
        {
            COSNumber number = (COSNumber)get( index );
            if( number != null )
            {
                retval = number.intValue();
            }
        }
        return retval;
    }
------------------------------------------------------
to
------------------------------------------------------
    public int getInt( int index, int defaultValue )
    {
        int retval = defaultValue;
        if( defaultValue < size() )
        {
            Object number = get( index );
            if( number != null && number instanceof COSNumber )
            {
                retval = ((COSNumber)number).intValue();
            }
        }
        return retval;
    }
------------------------------------------------------
.

I was wondering whether this was the best solution for this issue.

If it is, could you please add it to the SVN trunk?

Thanks

Bernhard


Reply via email to