diff options
author | pdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2010-12-09 10:57:31 +0000 |
---|---|---|
committer | pdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2010-12-09 10:57:31 +0000 |
commit | 71af11797a51acf6ecdfc7832af4b5eb6a3c2621 (patch) | |
tree | 030928d06bc1174f200b9956f54fd20fe6c27ede | |
parent | 1a6f73ffadd8032cd25814e1e17f55ba46c7371f (diff) | |
download | pdf-as-3-71af11797a51acf6ecdfc7832af4b5eb6a3c2621.tar.gz pdf-as-3-71af11797a51acf6ecdfc7832af4b5eb6a3c2621.tar.bz2 pdf-as-3-71af11797a51acf6ecdfc7832af4b5eb6a3c2621.zip |
added suppress_validate_exceptions parameter
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@695 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
-rw-r--r-- | src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java index 6a19b42..6d5e399 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java @@ -32,7 +32,6 @@ import org.apache.commons.logging.LogFactory; import at.gv.egiz.pdfas.api.analyze.NonTextObjectInfo;
import at.gv.egiz.pdfas.api.commons.DynamicSignatureProfileImpl;
-import at.gv.egiz.pdfas.api.exceptions.PdfAsException;
import at.gv.egiz.pdfas.api.commons.SignatureInformation;
import at.gv.egiz.pdfas.api.timestamp.TimeStamper;
import at.gv.egiz.pdfas.api.xmldsig.ExtendedSignatureInformation;
@@ -914,14 +913,33 @@ public abstract class PdfAS cp.setVerificationTime(verificationTime);
Connector c = at.gv.egiz.pdfas.framework.ConnectorFactory.createConnector(connectorId, cp);
- SignatureResponse res = null;
- try {
- return c.doVerify(sd, so, dsig);
- } catch (PdfAsException e) {
- res = new SignatureResponse();
- res.setVerificationImpossibleEx(e);
- }
- return res;
+ return executeVerify(dsig, so, sd, c);
+ }
+
+ private static SignatureResponse executeVerify(XMLDsigData dsig, SignSignatureObject so,
+ SignatureData sd, Connector c) throws ConnectorException {
+ SignatureResponse res = null;
+ try {
+ return c.doVerify(sd, so, dsig);
+ } catch (ConnectorException e) {
+ if (suppressVerifyException()) {
+ res = new SignatureResponse();
+ res.setVerificationImpossibleEx(e);
+ } else {
+ throw e;
+ }
+ }
+ return res;
+ }
+
+ private static boolean suppressVerifyException() {
+ String propKey = "suppress_validate_exceptions";
+ try {
+ return SettingsReader.getInstance().getSetting(propKey).equalsIgnoreCase("true");
+ } catch (Exception e) {
+ log.debug("'" + propKey + "' property not found, using default value 'false'");
+ return false;
+ }
}
public static SignatureResponse verifyWeb(SignatureHolder signature_holder, String connector, String loc_ref) throws NormalizeException, PDFDocumentException, SignatureException, ConnectorException
@@ -960,15 +978,7 @@ public abstract class PdfAS String profile = so_to_be_verified.getSignatureTypeDefinition().getType();
Connector c = ConnectorChooser.chooseWebConnectorForVerify(connector, so_to_be_verified.getKZ(), so.id, profile, loc_ref);
- SignatureResponse res = null;
- try {
- return c.doVerify(sd, so, null);
- } catch (PdfAsException e) {
- res = new SignatureResponse();
- res.setVerificationImpossibleEx(e);
- }
-
- return res;
+ return executeVerify(null, so, sd, c);
}
|