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/05/06 20:50:52 UTC

[jira] Created: (PDFBOX-724) ClassCastException when merging PDFs using PDFMergerUtility

ClassCastException when merging PDFs using PDFMergerUtility
-----------------------------------------------------------

                 Key: PDFBOX-724
                 URL: https://issues.apache.org/jira/browse/PDFBOX-724
             Project: PDFBox
          Issue Type: Bug
          Components: Utilities
         Environment: Windows Vista 32-bit, Java 1.5.0_06, PDFBox Head tag (revision 941850)
            Reporter: Adam Nichols
             Fix For: 1.2.0


On line 496 of PDFMergerUtility, "target" is cast as a COSObject without checking the type.  In some circumstances target will be a COSDictionary which will cause the following ClassCastException.

java.lang.ClassCastException: org.apache.pdfbox.cos.COSDictionary
        at org.apache.pdfbox.util.PDFMergerUtility.cloneMerge(PDFMergerUtility.java:496)
        at org.apache.pdfbox.util.PDFMergerUtility.cloneMerge(PDFMergerUtility.java:533)
        at org.apache.pdfbox.util.PDFMergerUtility.cloneMerge(PDFMergerUtility.java:491)
        at org.apache.pdfbox.util.PDFMergerUtility.appendDocument(PDFMergerUtility.java:283)
        at org.apache.pdfbox.util.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:193)
        at com.xldynamics.common.PdfBoxTest.main(PdfBoxTest.java:40)

I will provide a patch once I've fixed this and tested it thoroughly.  The example PDFs I have contain sensitive information, so unfortunately I can not provide them.

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


[jira] Updated: (PDFBOX-724) ClassCastException when merging PDFs using PDFMergerUtility

Posted by "Adam Nichols (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-724?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adam Nichols updated PDFBOX-724:
--------------------------------

    Attachment: PDFBOX-724_clean.patch

Updated patch which applies cleanly to revision 941882 (this revision includes the PDFBOX-699 patch).

> ClassCastException when merging PDFs using PDFMergerUtility
> -----------------------------------------------------------
>
>                 Key: PDFBOX-724
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-724
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Utilities
>         Environment: Windows Vista 32-bit, Java 1.5.0_06, PDFBox Head tag (revision 941850)
>            Reporter: Adam Nichols
>             Fix For: 1.2.0
>
>         Attachments: PDFBOX-724.patch, PDFBOX-724_clean.patch
>
>
> On line 496 of PDFMergerUtility, "target" is cast as a COSObject without checking the type.  In some circumstances target will be a COSDictionary which will cause the following ClassCastException.
> java.lang.ClassCastException: org.apache.pdfbox.cos.COSDictionary
>         at org.apache.pdfbox.util.PDFMergerUtility.cloneMerge(PDFMergerUtility.java:496)
>         at org.apache.pdfbox.util.PDFMergerUtility.cloneMerge(PDFMergerUtility.java:533)
>         at org.apache.pdfbox.util.PDFMergerUtility.cloneMerge(PDFMergerUtility.java:491)
>         at org.apache.pdfbox.util.PDFMergerUtility.appendDocument(PDFMergerUtility.java:283)
>         at org.apache.pdfbox.util.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:193)
>         at com.xldynamics.common.PdfBoxTest.main(PdfBoxTest.java:40)
> I will provide a patch once I've fixed this and tested it thoroughly.  The example PDFs I have contain sensitive information, so unfortunately I can not provide them.

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


[jira] Updated: (PDFBOX-724) ClassCastException when merging PDFs using PDFMergerUtility

Posted by "Adam Nichols (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-724?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adam Nichols updated PDFBOX-724:
--------------------------------

    Attachment: PDFBOX-724.patch

Line numbers in original report are after the patch for PDFBOX-699 has been applied.  Since this is only a few lines of code, it may be easier to just apply the patch by hand since the line numbers may not line up (depending on the order in which the patches are applied).

> ClassCastException when merging PDFs using PDFMergerUtility
> -----------------------------------------------------------
>
>                 Key: PDFBOX-724
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-724
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Utilities
>         Environment: Windows Vista 32-bit, Java 1.5.0_06, PDFBox Head tag (revision 941850)
>            Reporter: Adam Nichols
>             Fix For: 1.2.0
>
>         Attachments: PDFBOX-724.patch
>
>
> On line 496 of PDFMergerUtility, "target" is cast as a COSObject without checking the type.  In some circumstances target will be a COSDictionary which will cause the following ClassCastException.
> java.lang.ClassCastException: org.apache.pdfbox.cos.COSDictionary
>         at org.apache.pdfbox.util.PDFMergerUtility.cloneMerge(PDFMergerUtility.java:496)
>         at org.apache.pdfbox.util.PDFMergerUtility.cloneMerge(PDFMergerUtility.java:533)
>         at org.apache.pdfbox.util.PDFMergerUtility.cloneMerge(PDFMergerUtility.java:491)
>         at org.apache.pdfbox.util.PDFMergerUtility.appendDocument(PDFMergerUtility.java:283)
>         at org.apache.pdfbox.util.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:193)
>         at com.xldynamics.common.PdfBoxTest.main(PdfBoxTest.java:40)
> I will provide a patch once I've fixed this and tested it thoroughly.  The example PDFs I have contain sensitive information, so unfortunately I can not provide them.

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


[jira] Resolved: (PDFBOX-724) ClassCastException when merging PDFs using PDFMergerUtility

Posted by "Andreas Lehmkühler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-724?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Lehmkühler resolved PDFBOX-724.
---------------------------------------

    Resolution: Fixed

I've applied the patch with version 942551.

Thanks to Adam for the contribution

> ClassCastException when merging PDFs using PDFMergerUtility
> -----------------------------------------------------------
>
>                 Key: PDFBOX-724
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-724
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Utilities
>         Environment: Windows Vista 32-bit, Java 1.5.0_06, PDFBox Head tag (revision 941850)
>            Reporter: Adam Nichols
>             Fix For: 1.2.0
>
>         Attachments: PDFBOX-724.patch, PDFBOX-724_clean.patch
>
>
> On line 496 of PDFMergerUtility, "target" is cast as a COSObject without checking the type.  In some circumstances target will be a COSDictionary which will cause the following ClassCastException.
> java.lang.ClassCastException: org.apache.pdfbox.cos.COSDictionary
>         at org.apache.pdfbox.util.PDFMergerUtility.cloneMerge(PDFMergerUtility.java:496)
>         at org.apache.pdfbox.util.PDFMergerUtility.cloneMerge(PDFMergerUtility.java:533)
>         at org.apache.pdfbox.util.PDFMergerUtility.cloneMerge(PDFMergerUtility.java:491)
>         at org.apache.pdfbox.util.PDFMergerUtility.appendDocument(PDFMergerUtility.java:283)
>         at org.apache.pdfbox.util.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:193)
>         at com.xldynamics.common.PdfBoxTest.main(PdfBoxTest.java:40)
> I will provide a patch once I've fixed this and tested it thoroughly.  The example PDFs I have contain sensitive information, so unfortunately I can not provide them.

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