From 34eb6f0a8f9a1c513fee78800cc7c34d52a7295d Mon Sep 17 00:00:00 2001 From: tknall Date: Tue, 30 Nov 2010 19:25:19 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@656 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- src/main/java/demo/SignatureVerificationDemo.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/main/java') 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(); } -- cgit v1.2.3