From 578ad0d6bc408edf9e6c875156054374f5fd8337 Mon Sep 17 00:00:00 2001
From: Thomas <>
Date: Mon, 22 Mar 2021 18:40:26 +0100
Subject: change to EGIZ codestyle
---
.../egovernment/moaspss/util/MOAErrorHandler.java | 73 ++++++++++++----------
1 file changed, 39 insertions(+), 34 deletions(-)
(limited to 'moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAErrorHandler.java')
diff --git a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAErrorHandler.java b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAErrorHandler.java
index 1842d03..f4acabf 100644
--- a/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAErrorHandler.java
+++ b/moaSig/common/src/main/java/at/gv/egovernment/moaspss/util/MOAErrorHandler.java
@@ -21,7 +21,6 @@
* that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
package at.gv.egovernment.moaspss.util;
import org.apache.xml.utils.DefaultErrorHandler;
@@ -35,42 +34,48 @@ import at.gv.egovernment.moaspss.logging.Logger;
* An ErrorHandler
that logs a message and throws a
* SAXException
upon error
and fatal
* parsing errors.
- *
+ *
* @author Patrick Peck
* @author Sven Aigner
*/
public class MOAErrorHandler extends DefaultErrorHandler {
-
/**
* Logs a warning message.
- *
+ *
* @see org.xml.sax.ErrorHandler#warning(SAXParseException)
*/
+ @Override
public void warning(SAXParseException exception) throws SAXException {
warn("parser.00", messageParams(exception), null);
}
/**
* Logs a warning and rethrows the exception
.
- *
+ *
* @see org.xml.sax.ErrorHandler#error(SAXParseException)
*/
+ @Override
public void error(SAXParseException exception) throws SAXException {
- warn("parser.01", messageParams(exception), null);
-
- // if Target attribute is missing in QualifyingProperties - don't throw exception (bug fix for old MOCCA signatures)
- if (exception.getMessage().startsWith("cvc-complex-type.4: Attribute 'Target' must appear on element"))
- warn("parser.04", new Object[] {"Attribute 'Target' must appear on element 'QualifyingProperties' - ignored for compatibility reasons."}, null);
- else
- throw exception;
+ warn("parser.01", messageParams(exception), null);
+
+ // if Target attribute is missing in QualifyingProperties - don't throw
+ // exception (bug fix for old MOCCA signatures)
+ if (exception.getMessage().startsWith("cvc-complex-type.4: Attribute 'Target' must appear on element")) {
+ warn("parser.04", new Object[] {
+ "Attribute 'Target' must appear on element 'QualifyingProperties' - ignored for compatibility reasons." },
+ null);
+ } else {
+ throw exception;
+ }
}
/**
* Logs a warning and rethrows the exception
.
- *
+ *
* @see org.xml.sax.ErrorHandler#fatalError(SAXParseException)
*/
+ @Override
public void fatalError(SAXParseException exception) throws SAXException {
warn("parser.02", messageParams(exception), null);
throw exception;
@@ -78,38 +83,38 @@ public class MOAErrorHandler extends DefaultErrorHandler {
/**
* Log a warning message.
- *
- * @param messageId The message ID to log.
+ *
+ * @param messageId The message ID to log.
* @param parameters Additional message parameters.
- * @param t The Throwable
to log; usually the cause of this
- * warning.
+ * @param t The Throwable
to log; usually the cause of
+ * this warning.
*/
private static void warn(
- String messageId,
- Object[] parameters,
- Throwable t) {
+ String messageId,
+ Object[] parameters,
+ Throwable t) {
- MessageProvider msg = MessageProvider.getInstance();
+ final MessageProvider msg = MessageProvider.getInstance();
Logger.warn(new LogMsg(msg.getMessage(messageId, parameters)), t);
}
/**
- * Put the system id, line and column number information from the exception
- * into an Object
array, to provide it as a
- * MessageFormat
parameter.
- *
- * @param e The SAXParseException
containing the
- * source system id and line/column numbers.
- * @return An array containing the system id (a String
) as well
- * as line/column numbers (2 Integer
objects) from the
- * SAXParseException
.
+ * Put the system id, line and column number information from the exception into
+ * an Object
array, to provide it as a MessageFormat
+ * parameter.
+ *
+ * @param e The SAXParseException
containing the source system id
+ * and line/column numbers.
+ * @return An array containing the system id (a String
) as well as
+ * line/column numbers (2 Integer
objects) from the
+ * SAXParseException
.
*/
private static Object[] messageParams(SAXParseException e) {
return new Object[] {
- e.getMessage(),
- e.getSystemId(),
- new Integer(e.getLineNumber()),
- new Integer(e.getColumnNumber())};
+ e.getMessage(),
+ e.getSystemId(),
+ new Integer(e.getLineNumber()),
+ new Integer(e.getColumnNumber()) };
}
}
\ No newline at end of file
--
cgit v1.2.3