[
https://issues.apache.org/jira/browse/PDFBOX-1973?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13931428#comment-13931428
]
John Hewson edited comment on PDFBOX-1973 at 3/12/14 5:51 AM:
--------------------------------------------------------------
CryptographyException can likewise be removed, it is used to indicate that the
password used to decrypt a PDF was incorrect, but also to wrap various
decryption exceptions, which means it can't actually be used to detect invalid
passwords. However, CryptographyException itself ends up often being wrapped in
an IOException, which is really what it is: and indication that the file could
not be read. For that reason I've just replaced it with IOException, if we
later decide that we need a specific exception to report invalid passwords (I
think a boolean return value would be more appropriate) then we can easily add
a \*subclass\* of IOException without altering the downstream API.
Here's an example of the kind of thing this revision removes:
{code}
catch(IOException e)
{
throw new CryptographyException(e);
}
{code}
Revision 1576587 makes these changes.
was (Author: jahewson):
CryptographyException can likewise be removed, it is used to indicate that the
password used to decrypt a PDF was incorrect, but also to wrap various
decryption exceptions, which means it can't actually be used to detect invalid
passwords. However, CryptographyException itself ends mostly being wrapped in
an IOException, which is really what it is: and indication that the file could
not be read. For that reason I've just replaced it with IOException, if we
later decide that we need a specific exception to report invalid passwords (I
think a boolean return value would be more appropriate) then we can easily add
a \*subclass\* of IOException without altering the downstream API.
Here's an example of the kind of thing this revision removes:
{code}
catch(IOException e)
{
throw new CryptographyException(e);
}
{code}
Revision 1576587 makes these changes.
> Don't wrap Exceptions with COSVisitorException
> ----------------------------------------------
>
> Key: PDFBOX-1973
> URL: https://issues.apache.org/jira/browse/PDFBOX-1973
> Project: PDFBox
> Issue Type: Improvement
> Reporter: John Hewson
> Assignee: John Hewson
> Priority: Minor
>
> COSVisitorException is redundant, it is a simple wrapper for
> SignatureException, CryptographyException and NoSuchAlgorithmException and
> should be replaced by those exceptions directly.
> For example, we can replace:
> public void write(PDDocument doc) throws COSVisitorException
> With:
> public void write(PDDocument doc) throws IOException, CryptographyException
> and so on...
--
This message was sent by Atlassian JIRA
(v6.2#6252)