aboutsummaryrefslogtreecommitdiff
path: root/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOARuntimeException.java
diff options
context:
space:
mode:
Diffstat (limited to 'moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOARuntimeException.java')
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOARuntimeException.java84
1 files changed, 44 insertions, 40 deletions
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOARuntimeException.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOARuntimeException.java
index 3a65c48..d7522ff 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOARuntimeException.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/MOARuntimeException.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 runtime 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 <code>getClause()</code> 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 <code>getClause()</code> method) but will not be used because of
+ * required compatibility with JDK1.3.
+ *
* @author Patrick Peck
* @version $Id$
*/
public class MOARuntimeException extends RuntimeException {
/**
- *
- */
- private static final long serialVersionUID = 8516197293435621864L;
-/** The message ID. */
- private String messageId;
+ *
+ */
+ private static final long serialVersionUID = 8516197293435621864L;
+ /** The message ID. */
+ private final String messageId;
/** The wrapped <code>Throwable</code>. */
private Throwable wrapped;
/**
* Create a <code>MOAException</code>.
- *
- * @param messageId The message ID of the message contained in the created
- * <code>MOAException</code>.
+ *
+ * @param messageId The message ID of the message contained in the created
+ * <code>MOAException</code>.
* @param parameters The parameters needed to fill in the message arguments.
*/
public MOARuntimeException(String messageId, Object[] parameters) {
@@ -72,17 +72,17 @@ public class MOARuntimeException extends RuntimeException {
/**
* Create a <code>MOAException</code>.
- *
- * @param messageId The message ID of the message contained in the created
- * <code>MOAException</code>.
+ *
+ * @param messageId The message ID of the message contained in the created
+ * <code>MOAException</code>.
* @param parameters The parameters needed to fill in the message arguments.
- * @param wrapped The exception wrapped by the created
- * <code>MOAException</code>.
+ * @param wrapped The exception wrapped by the created
+ * <code>MOAException</code>.
*/
public MOARuntimeException(
- String messageId,
- Object[] parameters,
- Throwable wrapped) {
+ String messageId,
+ Object[] parameters,
+ Throwable wrapped) {
super(MessageProvider.getInstance().getMessage(messageId, parameters));
this.messageId = messageId;
@@ -91,7 +91,7 @@ public class MOARuntimeException extends RuntimeException {
/**
* Returns the message ID of this exception.
- *
+ *
* @return The message ID as provided in the constructor.
*/
public String getMessageId() {
@@ -100,20 +100,21 @@ public class MOARuntimeException extends RuntimeException {
/**
* Returns the exception wrapped by this <code>MOARuntimeException</code>.
- *
- * @return The exception wrapped by this exception. Possibly
- * <code>null</code>, if none was provided at construction time.
+ *
+ * @return The exception wrapped by this exception. Possibly <code>null</code>,
+ * if none was provided at construction time.
*/
public Throwable getWrapped() {
return wrapped;
}
/**
- * Convert this <code>MOARuntimeException</code> to an <code>ErrorResponse</code>
- * element from the MOA namespace.
- *
+ * Convert this <code>MOARuntimeException</code> to an
+ * <code>ErrorResponse</code> element from the MOA namespace.
+ *
* @return An <code>ErrorResponse</code> element, containing the subelements
- * <code>ErrorCode</code> and <code>Info</code> required by the MOA schema.
+ * <code>ErrorCode</code> and <code>Info</code> required by the MOA
+ * schema.
*/
public Element toErrorResponse() {
DocumentBuilder builder;
@@ -127,7 +128,7 @@ public class MOARuntimeException extends RuntimeException {
try {
builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
impl = builder.getDOMImplementation();
- } catch (ParserConfigurationException e) {
+ } catch (final ParserConfigurationException e) {
return null;
}
@@ -137,11 +138,11 @@ public class MOARuntimeException extends RuntimeException {
// 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");
@@ -150,22 +151,24 @@ public class MOARuntimeException extends RuntimeException {
errorResponse.appendChild(info);
return errorResponse;
}
-
+
/**
* Print a stack trace of this exception to <code>System.err</code>.
- *
+ *
* @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) {
@@ -176,10 +179,11 @@ public class MOARuntimeException extends RuntimeException {
/**
* 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) {