Dear iText developers,
I am not sure if your team is actually making submissions to Maven
repository. Anyway I have a suggestion concerning optional dependencies,
which are listed in pom.xml
<http://repo1.maven.org/maven2/com/itextpdf/itextpdf/5.4.2/itextpdf-5.4.2.pom>:
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.48</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.48</version>
<optional>true</optional>
</dependency>
I think that the use of optional dependencies assume that application
can still function correctly if these dependencies are missing. However
iText crashes with this exception:
java.lang.NoClassDefFoundError: org/bouncycastle/asn1/ASN1OctetString
at
com.itextpdf.text.pdf.PdfEncryption.<init>(PdfEncryption.java:148)
at
com.itextpdf.text.pdf.PdfReader.readDecryptedDocObj(PdfReader.java:914)
at com.itextpdf.text.pdf.PdfReader.readDocObj(PdfReader.java:1294)
at com.itextpdf.text.pdf.PdfReader.readPdf(PdfReader.java:643)
at com.itextpdf.text.pdf.PdfReader.<init>(PdfReader.java:187)
at com.itextpdf.text.pdf.PdfReader.<init>(PdfReader.java:322)
at com.itextpdf.text.pdf.PdfReader.<init>(PdfReader.java:343)
which of course gives a right signal to library consumer that there is
some library missing. To my mind, PdfEncryption should check the
availability of a needed library (e.g. via
Class.forName("org/bouncycastle/asn1/ASN1OctetString")) and throw more
user-friendly exception e.g.
throw new UnsupportedPdfException("Given PDF is encrypted, but
optional library \"org.bouncycastle:bcprov\" to support decryption
is missing in your classpath. Add it to classpath and try again.");
Thanks.
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php