[ 
https://issues.apache.org/jira/browse/PDFBOX-1973?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13931474#comment-13931474
 ] 

John Hewson commented on PDFBOX-1973:
-------------------------------------

SignatureException can also be removed (perhaps this is not surprising by now). 
It is thrown only twice, both times in PDDocument#addSignature.

The first use is to indicate that an attempt was made to add a signature to a 
PDF with zero pages, I've replaced this with an IllegalStateException, because 
the cause is API misuse. Perhaps a better behaviour would be to simply add a 
blank page to the document if is empty, we could consider doing this as an 
improvement.

The second use occurs when an attempt is made to add a visual signature to a 
document, but the signature content does not contain the required objects. The 
cause of this exception is, again, API misuse, specifically that invalid 
SignatureOptions were passed to the method, so I've changed this to an 
IllegalArgumentException.

Revision 1576603 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)

Reply via email to