aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authortknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-11-30 19:25:19 +0000
committertknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-11-30 19:25:19 +0000
commit34eb6f0a8f9a1c513fee78800cc7c34d52a7295d (patch)
tree9d5305332e49e8b5fbcd1a8537a017423b5384dd /src/main/java
parent6feffb896cd9026481717a06ac754c94f25c0751 (diff)
downloadpdf-as-3-34eb6f0a8f9a1c513fee78800cc7c34d52a7295d.tar.gz
pdf-as-3-34eb6f0a8f9a1c513fee78800cc7c34d52a7295d.tar.bz2
pdf-as-3-34eb6f0a8f9a1c513fee78800cc7c34d52a7295d.zip
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@656 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/demo/SignatureVerificationDemo.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main/java/demo/SignatureVerificationDemo.java b/src/main/java/demo/SignatureVerificationDemo.java
index 950472e..d794028 100644
--- a/src/main/java/demo/SignatureVerificationDemo.java
+++ b/src/main/java/demo/SignatureVerificationDemo.java
@@ -19,6 +19,7 @@ import at.gv.egiz.pdfas.api.verify.VerifyAfterAnalysisParameters;
import at.gv.egiz.pdfas.api.verify.VerifyResult;
import at.gv.egiz.pdfas.api.verify.VerifyResults;
import at.gv.egiz.pdfas.commandline.Main;
+import at.gv.egiz.pdfas.exceptions.ErrorCode;
import at.gv.egiz.pdfas.framework.config.SettingsHelper;
import at.gv.egiz.pdfas.framework.vfilter.VerificationFilterParameters;
import at.gv.egiz.pdfas.io.FileBasedDataSource;
@@ -40,6 +41,8 @@ public class SignatureVerificationDemo {
File configdir = new File("./work");
File signedFile = new File(args[0]);
+
+ AnalyzeResult analyzeResult = null;
try {
@@ -69,7 +72,7 @@ public class SignatureVerificationDemo {
// analyze
System.out.println("Analyzing...");
- AnalyzeResult analyzeResult = pdfasAPI.analyze(analyzeParameters);
+ analyzeResult = pdfasAPI.analyze(analyzeParameters);
System.out.println("Successfully analyzed.");
// information on non-textual objects can be used after analysis step and/or after verification
@@ -141,7 +144,11 @@ public class SignatureVerificationDemo {
out.flush();
} catch (PdfAsException e) {
- e.printStackTrace();
+ if (ErrorCode.DOCUMENT_NOT_SIGNED == e.getErrorCode() && analyzeResult != null && analyzeResult.hasBeenCorrected()) {
+ System.err.println("\nThe document could not been processed, maybe due to modification by third party tools. An attempt to correct the document was successful but no verifiable signatures could be found. This/these signature(s) - if any - might got lost.");
+ } else {
+ e.printStackTrace();
+ }
} catch (IOException e) {
e.printStackTrace();
}