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

NPE when saving encrypted file

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.9, 1.8.10, 2.0.0
    • 1.8.10, 2.0.0
    • Crypto, Writing
    • None

    Description

      Mailing list user gets this when loading and then saving an encrypted file (of which he didn't know it was encrypted):

      java.lang.NullPointerException
          at org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.computeRevisionNumber(StandardSecurityHandler.java:129)
          at org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.prepareDocumentForEncryption(StandardSecurityHandler.java:332)
          at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1254)
          at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1215)
          at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:958)
          at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:930) 
      

      At the very least, we should bring an IllegalStateException with a useful message telling what to do.

      Attachments

        1. PDFBOX-2769.pdf
          46 kB
          Tilman Hausherr

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: