From fb3344c1e4d4ac8e8a6aa5605d052cee8cd4c3b1 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Thu, 30 Oct 2014 17:15:54 +0100 Subject: Introduced Process Information Map in PDFASError and SignResult --- .../pdfas/common/exceptions/ErrorConstants.java | 3 ++ .../egiz/pdfas/common/exceptions/PDFASError.java | 57 +++++++++++++++------- 2 files changed, 43 insertions(+), 17 deletions(-) (limited to 'pdf-as-common/src/main/java/at/gv/egiz') diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/exceptions/ErrorConstants.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/exceptions/ErrorConstants.java index 14e1027e..8ab02028 100644 --- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/exceptions/ErrorConstants.java +++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/exceptions/ErrorConstants.java @@ -1,6 +1,9 @@ package at.gv.egiz.pdfas.common.exceptions; public interface ErrorConstants { + public static final String STATUS_INFO_SIGDEVICE = "SigDevice"; + public static final String STATUS_INFO_SIGDEVICEVERSION = "SigDeviceVersion"; + // Code below 10000 are reserved for SL Error Codes public static final long ERROR_GENERIC = 10000; diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/exceptions/PDFASError.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/exceptions/PDFASError.java index bcd3375b..a4cb0649 100644 --- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/exceptions/PDFASError.java +++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/exceptions/PDFASError.java @@ -1,5 +1,8 @@ package at.gv.egiz.pdfas.common.exceptions; +import java.util.HashMap; +import java.util.Map; + import at.gv.egiz.pdfas.common.messages.ErrorCodeResolver; /** @@ -9,48 +12,58 @@ public class PDFASError extends Exception implements ErrorConstants { /** The Constant serialVersionUID. */ private static final long serialVersionUID = 1233586898708485346L; - + /** The code. */ private long code; - + + private Map metaInformations = new HashMap(); + /** * Instantiates a new PDFAS error. * - * @param code the code + * @param code + * the code */ public PDFASError(long code) { super(ErrorCodeResolver.resolveMessage(code)); this.code = code; } - + /** * Instantiates a new PDFAS error. * - * @param code the code - * @param e the e + * @param code + * the code + * @param e + * the e */ public PDFASError(long code, Throwable e) { super(ErrorCodeResolver.resolveMessage(code), e); this.code = code; } - + /** * Instantiates a new PDFAS error. * - * @param code the code - * @param info the info - * @param e the e + * @param code + * the code + * @param info + * the info + * @param e + * the e */ public PDFASError(long code, String info, Throwable e) { super(info, e); this.code = code; } - + /** * Instantiates a new PDFAS error. * - * @param code the code - * @param info the info + * @param code + * the code + * @param info + * the info */ public PDFASError(long code, String info) { super(info); @@ -65,7 +78,7 @@ public class PDFASError extends Exception implements ErrorConstants { public long getCode() { return code; } - + /** * Gets the info. * @@ -74,7 +87,7 @@ public class PDFASError extends Exception implements ErrorConstants { public String getInfo() { return this.getMessage(); } - + /** * Gets the code info. * @@ -83,8 +96,18 @@ public class PDFASError extends Exception implements ErrorConstants { public String getCodeInfo() { return ErrorCodeResolver.resolveMessage(code); } - - public static String buildInfoString(long code, Object ... args) { + + /** + * Gets the meta informations for the Error. This Map + * is never null, but no information + * + * @return the meta informations + */ + public Map getProcessInformations() { + return metaInformations; + } + + public static String buildInfoString(long code, Object... args) { return String.format(ErrorCodeResolver.resolveMessage(code), args); } } -- cgit v1.2.3