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/06/11 17:32:02 UTC
[jira] [Comment Edited] (PDFBOX-1474) PDDocument.decrypt does not
throws InvalidPasswordException
[ https://issues.apache.org/jira/browse/PDFBOX-1474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14027838#comment-14027838 ]
Tilman Hausherr edited comment on PDFBOX-1474 at 6/11/14 3:30 PM:
------------------------------------------------------------------
Fixed files in the 1.8 branch that were catching the exception, in rev 1601920, 1601926, 1601927 (more to come).
was (Author: tilman):
Fixed the examples in the 1.8 branch that were catching the exception, in rev 1601920.
> PDDocument.decrypt does not throws InvalidPasswordException
> -----------------------------------------------------------
>
> Key: PDFBOX-1474
> URL: https://issues.apache.org/jira/browse/PDFBOX-1474
> Project: PDFBox
> Issue Type: Bug
> Components: Documentation
> Affects Versions: 1.7.1, 1.8.5, 1.8.6, 2.0.0
> Environment: All
> Reporter: Josue Martinez Buenrrostro
> Assignee: Tilman Hausherr
> Labels: decrypt
> Fix For: 1.8.6, 2.0.0
>
>
> PDDocument.decrypt does not throws InvalidPasswordException
> The documentation say the method should throw "InvalidPasswordException" but it doest't i suggest either:
> correct the Exception methods throws
> or
> correct the javadoc
> The method for this version is:
> /**
> * This will decrypt a document. This method is provided for compatibility reasons only. User should use
> * the new security layer instead and the openProtection method especially.
> *
> * @param password Either the user or owner password.
> *
> * @throws CryptographyException If there is an error decrypting the document.
> * @throws IOException If there is an error getting the stream data.
> * @throws InvalidPasswordException If the password is not a user or owner password.
> *
> */
> public void decrypt( String password ) throws CryptographyException, IOException, InvalidPasswordException
> {
> try
> {
> StandardDecryptionMaterial m = new StandardDecryptionMaterial(password);
> this.openProtection(m);
> document.dereferenceObjectStreams();
> }
> catch(BadSecurityHandlerException e)
> {
> throw new CryptographyException(e);
> }
> }
--
This message was sent by Atlassian JIRA
(v6.2#6252)