William Palmer created PDFBOX-1759:
--------------------------------------

             Summary: NullPointerException when loading/saving a PDF
                 Key: PDFBOX-1759
                 URL: https://issues.apache.org/jira/browse/PDFBOX-1759
             Project: PDFBox
          Issue Type: Bug
          Components: Parsing
    Affects Versions: 1.8.2
         Environment: Ubuntu Linux & Windows 7 (both JDK6)
            Reporter: William Palmer
            Priority: Minor


Loading and saving a PDF causes a NullPointerException:
java.lang.NullPointerException
        at org.apache.pdfbox.pdmodel.PDPageNode.updateCount(PDPageNode.java:98)
        at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1319)
        at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1305)

Files that cause this exception:
https://github.com/openplanets/format-corpus/blob/master/pdfCabinetOfHorrors/encryption_openpassword.pdf
https://github.com/openplanets/format-corpus/blob/master/pdfCabinetOfHorrors/encryption_notextaccess.pdf
https://github.com/openplanets/format-corpus/blob/master/pdfCabinetOfHorrors/encryption_noprinting.pdf
https://github.com/openplanets/format-corpus/blob/master/pdfCabinetOfHorrors/encryption_nocopy.pdf

Code to reproduce:
PDFParser parser = new PDFParser(new FileInputStream("file"));
parser.parse();
File temp = File.createTempFile("temp-", ".pdf");
parser.getPDDocument().save(temp);
parser.getDocument().close();

I imagine the exception is thrown because the files have restrictions within 
them but I would not expect to get a NullPointerException if that is the case.





--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to