anon.pay.xml
Class XMLErrorMessage

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by anon.pay.xml.XMLErrorMessage
All Implemented Interfaces:
IXMLEncodable, java.io.Serializable

public class XMLErrorMessage
extends java.lang.Exception
implements IXMLEncodable

This class encapsulates an error or success message. In order to be indipendent from the HTTP protocol on the higher layer, this is now used instead of http errorcodes.

Author:
Bastian Voigt
See Also:
Serialized Form

Field Summary
static int ERR_ACCOUNT_EMPTY
           
static int ERR_BAD_REQUEST
           
static int ERR_BAD_SIGNATURE
           
static int ERR_INTERNAL_SERVER_ERROR
           
static int ERR_KEY_NOT_FOUND
           
static int ERR_NO_ACCOUNTCERT
           
static int ERR_NO_BALANCE
           
static int ERR_NO_CONFIRMATION
           
static int ERR_OK
           
static int ERR_WRONG_DATA
           
static int ERR_WRONG_FORMAT
           
private static java.lang.String[] m_errStrings
          default error descriptions
private  int m_iErrorCode
           
private  java.lang.String m_strErrMsg
           
static java.lang.String XML_ELEMENT_NAME
           
 
Fields inherited from interface anon.util.IXMLEncodable
FIELD_XML_ELEMENT_CONTAINER_NAME, FIELD_XML_ELEMENT_NAME, XML_ATTR_ID, XML_ATTR_VERSION
 
Constructor Summary
XMLErrorMessage(org.w3c.dom.Document doc)
          Parses an XMLErrorMessage object from DOM Document
XMLErrorMessage(org.w3c.dom.Element element)
          XMLErrorMessage
XMLErrorMessage(int errorCode)
          Uses a default description String
XMLErrorMessage(int errorCode, java.lang.String message)
          Creates an errorMessage object.
 
Method Summary
 int getErrorCode()
           
 java.lang.String getErrorDescription()
           
 java.lang.String getMessage()
           
private  void setValues(org.w3c.dom.Element elemRoot)
           
 org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
          Return an element that can be appended to the document.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ERR_OK

public static final int ERR_OK
See Also:
Constant Field Values

ERR_INTERNAL_SERVER_ERROR

public static final int ERR_INTERNAL_SERVER_ERROR
See Also:
Constant Field Values

ERR_WRONG_FORMAT

public static final int ERR_WRONG_FORMAT
See Also:
Constant Field Values

ERR_WRONG_DATA

public static final int ERR_WRONG_DATA
See Also:
Constant Field Values

ERR_KEY_NOT_FOUND

public static final int ERR_KEY_NOT_FOUND
See Also:
Constant Field Values

ERR_BAD_SIGNATURE

public static final int ERR_BAD_SIGNATURE
See Also:
Constant Field Values

ERR_BAD_REQUEST

public static final int ERR_BAD_REQUEST
See Also:
Constant Field Values

ERR_NO_ACCOUNTCERT

public static final int ERR_NO_ACCOUNTCERT
See Also:
Constant Field Values

ERR_NO_BALANCE

public static final int ERR_NO_BALANCE
See Also:
Constant Field Values

ERR_NO_CONFIRMATION

public static final int ERR_NO_CONFIRMATION
See Also:
Constant Field Values

ERR_ACCOUNT_EMPTY

public static final int ERR_ACCOUNT_EMPTY
See Also:
Constant Field Values

m_iErrorCode

private int m_iErrorCode

m_strErrMsg

private java.lang.String m_strErrMsg

m_errStrings

private static final java.lang.String[] m_errStrings
default error descriptions


XML_ELEMENT_NAME

public static final java.lang.String XML_ELEMENT_NAME
See Also:
Constant Field Values
Constructor Detail

XMLErrorMessage

public XMLErrorMessage(org.w3c.dom.Document doc)
                throws java.lang.Exception
Parses an XMLErrorMessage object from DOM Document

Parameters:
document - Document
Throws:
java.lang.Exception

XMLErrorMessage

public XMLErrorMessage(org.w3c.dom.Element element)
                throws java.lang.Exception
XMLErrorMessage

Parameters:
element - Element
Throws:
java.lang.Exception

XMLErrorMessage

public XMLErrorMessage(int errorCode,
                       java.lang.String message)
Creates an errorMessage object. The errorcode should be one of the above ERR_* constants.

Parameters:
errorCode - int one of the above constants
message - String a human-readable description of the error

XMLErrorMessage

public XMLErrorMessage(int errorCode)
Uses a default description String

Parameters:
errorCode - int
Method Detail

toXmlElement

public org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
Description copied from interface: IXMLEncodable
Return an element that can be appended to the document. This Method must not change the document in any way!

Specified by:
toXmlElement in interface IXMLEncodable
Parameters:
a_doc - a document
Returns:
the interface as xml element

getErrorDescription

public java.lang.String getErrorDescription()

getErrorCode

public int getErrorCode()

getMessage

public java.lang.String getMessage()
Overrides:
getMessage in class java.lang.Throwable

setValues

private void setValues(org.w3c.dom.Element elemRoot)
                throws java.lang.Exception
Throws:
java.lang.Exception