From 061129ed699a214818e7f62e2850fbe3b8b7b0ab Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 12 Jan 2023 14:50:17 +0100 Subject: chore(sl): check Security-Layer error-codes to distinguish between critical and non-critical errors Issue: #71 --- .../gv/egiz/pdfas/common/exceptions/SLPdfAsException.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'pdf-as-common/src') diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/exceptions/SLPdfAsException.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/exceptions/SLPdfAsException.java index a0ee44d9..e7aa6099 100644 --- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/exceptions/SLPdfAsException.java +++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/exceptions/SLPdfAsException.java @@ -23,8 +23,13 @@ ******************************************************************************/ package at.gv.egiz.pdfas.common.exceptions; +import java.util.Arrays; +import java.util.List; + public class SLPdfAsException extends PdfAsException { + private static final List ERRORCODES_ON_INFO_LEVEL = Arrays.asList(6001); + /** * */ @@ -47,6 +52,16 @@ public class SLPdfAsException extends PdfAsException { return info; } + /** + * Classify SL error between critical and non-critical types. + * + * @return true in case of a critical error, otherwise false + */ + public boolean isCriticalError() { + return !ERRORCODES_ON_INFO_LEVEL.contains(code); + + } + protected String localizeMessage(String msgId) { return String.format("%d : %s", code, info); } -- cgit v1.2.3