You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Jean-Philippe Bougie (Created) (JIRA)" <ji...@apache.org> on 2012/03/26 20:10:37 UTC
[jira] [Created] (PDFBOX-1269) ClassCastException on
COSDocument#getDocumentID
ClassCastException on COSDocument#getDocumentID
-----------------------------------------------
Key: PDFBOX-1269
URL: https://issues.apache.org/jira/browse/PDFBOX-1269
Project: PDFBox
Issue Type: Bug
Components: PDModel
Affects Versions: 1.6.0
Reporter: Jean-Philippe Bougie
Priority: Minor
I got this error while trying to save a PDF where I added encryption:
ava.lang.ClassCastException: org.apache.pdfbox.cos.COSObject cannot be cast to org.apache.pdfbox.cos.COSArray
at org.apache.pdfbox.cos.COSDocument.getDocumentID(COSDocument.java:379)
at org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.prepareDocumentForEncryption(StandardSecurityHandler.java:300)
at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1306)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1121)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1102)
Inspecting the pdf in a REPL, I found out that the ID is not a direct array, but a reference to one. I changed the line 401 of COSDocument.java to use getDictionaryObject instead of getItem and it seemed to fix the problem.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (PDFBOX-1269) ClassCastException on
COSDocument#getDocumentID
Posted by "Andreas Lehmkühler (Resolved JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PDFBOX-1269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andreas Lehmkühler resolved PDFBOX-1269.
----------------------------------------
Resolution: Fixed
Fix Version/s: 1.7.0
Assignee: Andreas Lehmkühler
I added the fix in revision 1306178 as proposed.
Thanks for the contribution!
> ClassCastException on COSDocument#getDocumentID
> -----------------------------------------------
>
> Key: PDFBOX-1269
> URL: https://issues.apache.org/jira/browse/PDFBOX-1269
> Project: PDFBox
> Issue Type: Bug
> Components: PDModel
> Affects Versions: 1.6.0
> Reporter: Jean-Philippe Bougie
> Assignee: Andreas Lehmkühler
> Priority: Minor
> Fix For: 1.7.0
>
>
> I got this error while trying to save a PDF where I added encryption:
> ava.lang.ClassCastException: org.apache.pdfbox.cos.COSObject cannot be cast to org.apache.pdfbox.cos.COSArray
> at org.apache.pdfbox.cos.COSDocument.getDocumentID(COSDocument.java:379)
> at org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.prepareDocumentForEncryption(StandardSecurityHandler.java:300)
> at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1306)
> at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1121)
> at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1102)
> Inspecting the pdf in a REPL, I found out that the ID is not a direct array, but a reference to one. I changed the line 401 of COSDocument.java to use getDictionaryObject instead of getItem and it seemed to fix the problem.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira