Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-2225

ClassCastException in PDFMergerUtility.appendDocument

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8.1, 1.8.6, 1.8.7, 2.0.0
    • Fix Version/s: 1.8.7, 2.0.0
    • Component/s: Utilities
    • Labels:
      None
    • Environment:
      Windows 7 64-bit, JDK8

      Description

      Edit: Problem confirmed to exist in 1.8.1 and 1.8.6

      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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                Etherous Brandon Lyon
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: