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

NPE in saveIncremental() / fix javadoc

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0, 2.0.1, 3.0.0 PDFBox
    • Fix Version/s: 2.0.1, 3.0.0 PDFBox
    • Component/s: Signing
    • Labels:
      None

      Description

      Cyril Bremaud mentioned in PDFBOX-2716:

      You may want to change the javadoc because this is now possible to use saveIncremental() function on PDDocument loaded with InputStream.

      I checked this and yes, it works with a stream, because since the rewrite of the caching stuff, the stream contents are stored in a file or in memory when the PDF is loaded from a stream. The javadoc wasn't changed in rev 1688018.

      Then I tried this:

      new PDDocument().saveIncremental(new FileOutputStream(new File("huhu.pdf")));
      

      this results in an NPE. So I'm adding a check in saveIncremental(), similar to the check that was removed in 1688018, likely because nobody thought about the weird code above.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                tilman Tilman Hausherr
                Reporter:
                tilman Tilman Hausherr
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: