[ 
https://issues.apache.org/jira/browse/PDFBOX-2225?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14066627#comment-14066627
 ] 

Brandon Lyon commented on PDFBOX-2225:
--------------------------------------

Replaced jars with latest version. Problem persists. I would include the PDFs, 
but they're being generated dynamically, and I'm probably not at liberty to do 
so anyways. Suffice it to say, they are each two-pages, have several form 
elements (all text), and are identical except for the values of the fields. 
Here's part of the stack-trace (irrelevant data removed):

2014-07-18 11:18:39,159 ERROR [io.undertow.servlet] (default task-12) 
ares.web.DocumentServlet: Ares Servlet: Uncaught exception: : 
java.lang.ClassCastException: java.lang.IndexOutOfBoundsException cannot be 
cast to java.io.IOException
        at 
org.apache.pdfbox.util.PDFMergerUtility.appendDocument(PDFMergerUtility.java:347)
 [pdfbox-1.8.6.jar:]
        at 
org.apache.pdfbox.util.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:240)
 [pdfbox-1.8.6.jar:]
        at 
org.apache.pdfbox.util.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:185)
 [pdfbox-1.8.6.jar:]
        ... (additional trace data is irrelevant)

> ClassCastException in PDFMergerUtility.appendDocument
> -----------------------------------------------------
>
>                 Key: PDFBOX-2225
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2225
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Utilities
>         Environment: Windows 7 64-bit, JDK8, pdfbox-1.8.1.jar
>            Reporter: Brandon Lyon
>            Priority: Minor
>
> Wouldn't allow me to select 1.8.1 as the affected version ("Version with id 
> '1.8.1' does not exist"), so I left it blank
> The following exception will occur if any type of Exception other than 
> IOException is thrown within a particular try-catch in 
> PDFMergerUtility.appendDocument:
> java.lang.ClassCastException: java.lang.IndexOutOfBoundsException cannot be 
> cast to java.io.IOException
> For the version I am using (1.8.1), the problem occurs on line 294
> The problem is that the author mistakenly assumed that the only exception 
> which could be caught was IOException. I recommend that the cast be removed, 
> and that either the additional checked exceptions be thrown by appendDocument 
> or wrapped with an unchecked exception
> Also, anyone seeing this may want to investigate why an 
> IndexOutOfBoundsException is occurring here, though this is obviously a 
> separate issue



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to