|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.globus.wsrf.utils.FaultHelper
This class provides convenience functions around BaseFault API. It also
provides a common way of including stack traces with Faults. A stack trace
of a Fault is added as a chained BaseFault with an error code dialect
attribute set to STACK_TRACE. A regular Java
exception is automatically converted into a BaseFault with an error code
dialect attribute set to EXCEPTION.
| Field Summary | |
static URI |
EXCEPTION
Exception error code URI |
static URI |
STACK_TRACE
Stack trace error code URI |
| Constructor Summary | |
FaultHelper(BaseFaultType fault)
Creates FaultHelper with a fault. |
|
FaultHelper(BaseFaultType fault,
boolean convertStackTrace)
Creates FaultHelper with a fault. |
|
| Method Summary | |
void |
addDescription(String description)
Adds a description to the description list of the fault. |
void |
addFaultCause(Throwable exception)
Adds a fault cause to the fault. |
String[] |
getDescription()
Returns descriptions of the fault. |
String |
getDescriptionAsString()
Returns all the descriptions of the fault as a simple string. |
BaseFaultType |
getFault()
Gets the fault. |
String |
getMessage()
Gets error message of the fault. |
static String |
getMessage(Throwable exception)
Gets the error message of the exception. |
String |
getStackTrace()
Gets stack trace of the fault. |
void |
printStackTrace()
Prints stack trace of the fault to System.err. |
void |
printStackTrace(PrintStream s)
Writes stack trace of the fault to stream. |
void |
printStackTrace(PrintWriter s)
Writes stack trace of the fault to writer. |
static void |
printStackTrace(Throwable exception)
Gets the stack trace of the exception. |
void |
setDescription(String description)
Sets the description of the fault. |
void |
setDescription(String[] description)
Sets the description of the fault. |
static BaseFaultType |
toBaseFault(Throwable exception)
Converts exception to a BaseFault. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final URI STACK_TRACE
public static final URI EXCEPTION
| Constructor Detail |
public FaultHelper(BaseFaultType fault)
FaultHelper with a fault.
If the fault contains a stack trace it will be automatically converted
into a chained BaseFault with an error code dialect attribute set to
set to STACK_TRACE.
fault - fault
public FaultHelper(BaseFaultType fault,
boolean convertStackTrace)
FaultHelper with a fault.
fault - faultconvertStackTrace - if true and if the fault contains a stack trace
it will be automatically converted into a chained BaseFault with
an error code dialect attribute set to set to
STACK_TRACE.| Method Detail |
public BaseFaultType getFault()
public String getDescriptionAsString()
public String[] getDescription()
public void setDescription(String description)
description - the new description of the fault.public void setDescription(String[] description)
description - the new descriptions of the fault.public void addDescription(String description)
description - the description to add.public void addFaultCause(Throwable exception)
exception - the exception to add as a cause of this fault.
If the exception is of BaseFault type then it is
just added as is as a fault cause. Otherwise, the
exception is converted into a new BaseFault and then
added as a fault cause. The new BaseFault is created
with an error code dialect attribute set to
EXCEPTION.public static BaseFaultType toBaseFault(Throwable exception)
exception - the exception to convert.
EXCEPTION.public static String getMessage(Throwable exception)
exception - if exception is of type BaseFaultType
getMessage() is
called to get the error message. Otherwise,
getMessage operation is called on the
exception.public static void printStackTrace(Throwable exception)
exception - if exception is of type BaseFaultType
printStackTrace() is
called to get the error message. Otherwise,
printStackTrace operation is called on the
exception.public void printStackTrace()
System.err.
See getStackTrace() for more information.
public void printStackTrace(PrintStream s)
getStackTrace() for more information.
public void printStackTrace(PrintWriter s)
getStackTrace() for more information.
public String getMessage()
STACK_TRACE null is returned. If the fault has error code
dialect of EXCEPTION the exception error
message is returned. Otherwise, the error message is composed
of all descriptions of the fault and descriptions of the chained
faults.public String getStackTrace()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||