Josue Martinez Buenrrostro created PDFBOX-1474:
--------------------------------------------------

             Summary: PDDocument.decrypt does not throws 
InvalidPasswordException
                 Key: PDFBOX-1474
                 URL: https://issues.apache.org/jira/browse/PDFBOX-1474
             Project: PDFBox
          Issue Type: Bug
          Components: PDModel
    Affects Versions: 1.7.1
         Environment: All
            Reporter: Josue Martinez Buenrrostro
             Fix For: 1.8.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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to