You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2014/09/14 20:49:33 UTC
[jira] [Created] (PDFBOX-2347) NPE while creating security handler
for decryption
Tilman Hausherr created PDFBOX-2347:
---------------------------------------
Summary: NPE while creating security handler for decryption
Key: PDFBOX-2347
URL: https://issues.apache.org/jira/browse/PDFBOX-2347
Project: PDFBox
Issue Type: Bug
Components: Parsing
Affects Versions: 1.8.6, 1.8.7, 2.0.0
Reporter: Tilman Hausherr
Assignee: Tilman Hausherr
Fix For: 1.8.7, 2.0.0
The attached file has a NPE with the non sequential parser only:
{code}
Exception in thread "main" java.io.IOException: Error (NullPointerException) while creating security handler for decryption
at org.apache.pdfbox.pdfparser.NonSequentialPDFParser.initialParse(NonSe
quentialPDFParser.java:493)
at org.apache.pdfbox.pdfparser.NonSequentialPDFParser.parse(NonSequentialPDFParser.java:794)
at org.apache.pdfbox.pdmodel.PDDocument.loadNonSeq(PDDocument.java:1156)
at org.apache.pdfbox.pdmodel.PDDocument.loadNonSeq(PDDocument.java:1139)
at org.apache.pdfbox.tools.PDFToImage.main(PDFToImage.java:197)
at org.apache.pdfbox.tools.PDFBox.main(PDFBox.java:89)
Caused by: java.lang.NullPointerException
at org.apache.pdfbox.pdmodel.encryption.PDEncryption.getFilter(PDEncrypt
ion.java:159)
at org.apache.pdfbox.pdmodel.encryption.PDEncryption.<init>(PDEncryption.java:96)
at org.apache.pdfbox.pdfparser.NonSequentialPDFParser.initialParse(NonSe
quentialPDFParser.java:464)
{code}
The file has this:
{code}
trailer
<<
/Size
53
/Info
29 0 R
/Encrypt
null
/Root
35 0 R
/Prev
256729
/ID
[
<f571e5c0c658cb76cfe7ad0662f8f6a1>
<1c11ae9224c83622f7682d9e00bd2581>
]
>>
{code}
so the encryption item is COSNull which is not the same as "null" when using getItem(). So the solution is to use getDictionaryObject() instead, because it checks for COSNull. This method is already used elsewhere in PDFBox to get /Encrypt.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)