aboutsummaryrefslogtreecommitdiff
path: root/spss.server/src/at/gv/egovernment/moa/spss/MOAException.java
diff options
context:
space:
mode:
authormcentner <mcentner@d688527b-c9ab-4aba-bd8d-4036d912da1d>2007-08-08 07:25:32 +0000
committermcentner <mcentner@d688527b-c9ab-4aba-bd8d-4036d912da1d>2007-08-08 07:25:32 +0000
commit43e57a42832ea8b4ceb0317f3c9028a4174ffa7b (patch)
treef5ed9074b8d7b89b2dd5b22d326f63be103e7551 /spss.server/src/at/gv/egovernment/moa/spss/MOAException.java
parent10889e9dea2cc2f70b475e6ff7af37fdba1621d9 (diff)
downloadmoa-id-spss-43e57a42832ea8b4ceb0317f3c9028a4174ffa7b.tar.gz
moa-id-spss-43e57a42832ea8b4ceb0317f3c9028a4174ffa7b.tar.bz2
moa-id-spss-43e57a42832ea8b4ceb0317f3c9028a4174ffa7b.zip
Adapted project directory structure to suit the new maven based build process.
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@909 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'spss.server/src/at/gv/egovernment/moa/spss/MOAException.java')
-rw-r--r--spss.server/src/at/gv/egovernment/moa/spss/MOAException.java161
1 files changed, 0 insertions, 161 deletions
diff --git a/spss.server/src/at/gv/egovernment/moa/spss/MOAException.java b/spss.server/src/at/gv/egovernment/moa/spss/MOAException.java
deleted file mode 100644
index f9eb12d63..000000000
--- a/spss.server/src/at/gv/egovernment/moa/spss/MOAException.java
+++ /dev/null
@@ -1,161 +0,0 @@
-package at.gv.egovernment.moa.spss;
-import java.io.PrintStream;
-import java.io.PrintWriter;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import at.gv.egovernment.moa.util.Constants;
-
-import at.gv.egovernment.moa.spss.util.MessageProvider;
-
-/**
- * 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 <code>getClause()</code> method) but will not be used
- * because of required compatibility with JDK1.3.
- *
- * @author Patrick Peck
- * @version $Id$
- */
-public abstract class MOAException extends Exception {
- /** The message ID. */
- private 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 parameters The parameters needed to fill in the message arguments.
- */
- public MOAException(String messageId, Object[] parameters) {
- super(MessageProvider.getInstance().getMessage(messageId, parameters));
- this.messageId = messageId;
- }
-
- /**
- * Create a <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>.
- */
- public MOAException(String messageId, Object[] parameters, Throwable wrapped) {
-
- super(MessageProvider.getInstance().getMessage(messageId, parameters));
- this.messageId = messageId;
- this.wrapped = wrapped;
- }
-
- /**
- * Returns the message ID of this exception.
- *
- * @return The message ID as provided in the constructor.
- */
- public String getMessageId() {
- return messageId;
- }
-
- /**
- * Returns the exception wrapped by this <code>MOAException</code>.
- *
- * @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>MOAException</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.
- */
- public Element toErrorResponse() {
- DocumentBuilder builder;
- DOMImplementation impl;
- Document doc;
- Element errorResponse;
- Element errorCode;
- Element info;
-
- // create a new document
- try {
- builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- impl = builder.getDOMImplementation();
- } catch (ParserConfigurationException e) {
- return null;
- }
-
- // build the ErrorResponse element
- doc = impl.createDocument(Constants.MOA_NS_URI, "ErrorResponse", null);
- errorResponse = doc.getDocumentElement();
-
- // add MOA namespace declaration
- errorResponse.setAttributeNS(
- Constants.XMLNS_NS_URI,
- "xmlns",
- Constants.MOA_NS_URI);
-
- // 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");
- info.appendChild(doc.createTextNode(getMessage()));
- errorResponse.appendChild(errorCode);
- errorResponse.appendChild(info);
- return errorResponse;
- }
-
- /**
- * Print a stack trace of this exception to <code>System.err</code>.
- *
- * @see java.lang.Throwable#printStackTrace()
- */
- 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)
- */
- public void printStackTrace(PrintStream s) {
- super.printStackTrace(s);
- if (getWrapped() != null) {
- s.print("Caused by: ");
- getWrapped().printStackTrace(s);
- }
- }
-
- /**
- * 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)
- */
- public void printStackTrace(PrintWriter s) {
- super.printStackTrace(s);
- if (getWrapped() != null) {
- s.print("Caused by: ");
- getWrapped().printStackTrace(s);
- }
- }
-
-}