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 --- .../at/gv/egovernment/moa/spss/MOAException.java | 76 ++++++++++++---------- 1 file changed, 40 insertions(+), 36 deletions(-) (limited to 'moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOAException.java') diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOAException.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOAException.java index bf7f9af..0aff639 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOAException.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOAException.java @@ -21,8 +21,8 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moa.spss; + import java.io.PrintStream; import java.io.PrintWriter; @@ -39,30 +39,30 @@ import at.gv.egovernment.moaspss.util.Constants; /** * Base class of MOA specific exceptions. - * - * This class has the ability to wrap other exceptions which may be seen - * as the root cause for this exception. A similar mechanism is in place - * since JDK1.4 (see the getClause() method) but will not be used - * because of required compatibility with JDK1.3. - * + * + * This class has the ability to wrap other exceptions which may be seen as the + * root cause for this exception. A similar mechanism is in place since JDK1.4 + * (see the getClause() method) but will not be used because of + * required compatibility with JDK1.3. + * * @author Patrick Peck * @version $Id$ */ public abstract class MOAException extends Exception { /** - * - */ - private static final long serialVersionUID = 7115301799538771949L; -/** The message ID. */ - private String messageId; + * + */ + private static final long serialVersionUID = 7115301799538771949L; + /** The message ID. */ + private final String messageId; /** The wrapped Throwable. */ private Throwable wrapped; /** * Create a MOAException. - * - * @param messageId The message ID of the message contained in the created - * MOAException. + * + * @param messageId The message ID of the message contained in the created + * MOAException. * @param parameters The parameters needed to fill in the message arguments. */ public MOAException(String messageId, Object[] parameters) { @@ -72,15 +72,15 @@ public abstract class MOAException extends Exception { /** * Create a MOAException. - * - * @param messageId The message ID of the message contained in the created - * MOAException. + * + * @param messageId The message ID of the message contained in the created + * MOAException. * @param parameters The parameters needed to fill in the message arguments. - * @param wrapped The exception wrapped by the created - * MOAException. + * @param wrapped The exception wrapped by the created + * MOAException. */ public MOAException(String messageId, Object[] parameters, Throwable wrapped) { - // TODO: remove wrapped again from super constructor + // TODO: remove wrapped again from super constructor super(MessageProvider.getInstance().getMessage(messageId, parameters), wrapped); this.messageId = messageId; this.wrapped = wrapped; @@ -88,7 +88,7 @@ public abstract class MOAException extends Exception { /** * Returns the message ID of this exception. - * + * * @return The message ID as provided in the constructor. */ public String getMessageId() { @@ -97,9 +97,9 @@ public abstract class MOAException extends Exception { /** * Returns the exception wrapped by this MOAException. - * - * @return The exception wrapped by this exception. Possibly - * null, if none was provided at construction time. + * + * @return The exception wrapped by this exception. Possibly null, + * if none was provided at construction time. */ public Throwable getWrapped() { return wrapped; @@ -108,9 +108,10 @@ public abstract class MOAException extends Exception { /** * Convert this MOAException to an ErrorResponse * element from the MOA namespace. - * + * * @return An ErrorResponse element, containing the subelements - * ErrorCode and Info required by the MOA schema. + * ErrorCode and Info required by the MOA + * schema. */ public Element toErrorResponse() { DocumentBuilder builder; @@ -124,7 +125,7 @@ public abstract class MOAException extends Exception { try { builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); impl = builder.getDOMImplementation(); - } catch (ParserConfigurationException e) { + } catch (final ParserConfigurationException e) { return null; } @@ -134,11 +135,11 @@ public abstract class MOAException extends Exception { // add MOA namespace declaration errorResponse.setAttributeNS( - Constants.XMLNS_NS_URI, - "xmlns", - Constants.MOA_NS_URI); + Constants.XMLNS_NS_URI, + "xmlns", + Constants.MOA_NS_URI); - // build the child elements + // build the child elements errorCode = doc.createElementNS(Constants.MOA_NS_URI, "ErrorCode"); errorCode.appendChild(doc.createTextNode(messageId)); info = doc.createElementNS(Constants.MOA_NS_URI, "Info"); @@ -147,22 +148,24 @@ public abstract class MOAException extends Exception { errorResponse.appendChild(info); return errorResponse; } - + /** * Print a stack trace of this exception to System.err. - * + * * @see java.lang.Throwable#printStackTrace() */ + @Override public void printStackTrace() { printStackTrace(System.err); } /** * Print a stack trace of this exception, including the wrapped exception. - * + * * @param s The stream to write the stack trace to. * @see java.lang.Throwable#printStackTrace(java.io.PrintStream) */ + @Override public void printStackTrace(PrintStream s) { super.printStackTrace(s); if (getWrapped() != null) { @@ -173,10 +176,11 @@ public abstract class MOAException extends Exception { /** * Print a stack trace of this exception, including the wrapped exception. - * + * * @param s The stream to write the stacktrace to. * @see java.lang.Throwable#printStackTrace(java.io.PrintWriter) */ + @Override public void printStackTrace(PrintWriter s) { super.printStackTrace(s); if (getWrapped() != null) { -- cgit v1.2.3