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

StringIndexOutOfBound on DateConverter.toCalendar

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.8.3
    • 1.8.5
    • PDModel, Utilities
    • None

    Description

      Some PDF have an empty string as CreationDate & ModDate in the Information Dictionary.

      According to the PDF specification, this two element are optional.

      My first fix was to test the null & the empty string in the toCalendar(String, String[]) method and I return null if one of the both condition is verified.
      But according to a test case(TestDateUtil) a NullPointer is expected on null value of text. Can you explain why this behaviour has been adopted?

      To fixe this unexpected exception in my execution path, I have added a test on the empty string in the deprecated method toCalendar(String). (Patch in attachment)

      I'm waiting your comment before commit this patch (or change it by my first implementation)

      BR,
      Eric

      Attachments

        1. PDFBox-DateConverter-Trunk.patch
          1 kB
          Eric Leleu
        2. PDFBox-DateConverter-Br18.patch
          1 kB
          Eric Leleu
        3. PDFBOX-DateConverter-1.8-fred.patch
          9 kB
          Fred Hansen
        4. PDFBOX-1803-Trunk-USETHISONE.patch
          13 kB
          Fred Hansen
        5. PDFBOX-1803-Trunk-tba.patch
          10 kB
          Tim Allison

        Issue Links

          Activity

            People

              Unassigned Unassigned
              leleueri Eric Leleu
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: