|
|||||||||||
| 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 the description
of exception message and with a chained BaseFault with
STACK_TRACE error code dialect.
| Field Summary | |
static org.apache.axis.types.URI |
EXCEPTION
Exception error code URI |
private BaseFaultType |
fault
|
private static org.globus.util.I18n |
i18n
|
private static java.lang.String |
LS
|
static org.apache.axis.types.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(java.lang.String description)
Adds a description to the description list of the fault. |
private void |
addFaultCause(BaseFaultType fault)
|
void |
addFaultCause(java.lang.Throwable exception)
Adds a fault cause to the fault. |
private void |
addStackTraceFault()
|
private void |
addStackTraceFault(java.lang.Throwable exception)
|
private static BaseFaultType |
createStackFault(java.lang.String message,
java.lang.String stackTrace)
|
java.lang.String[] |
getDescription()
Returns descriptions of the fault. |
java.lang.String |
getDescriptionAsString()
Returns all the descriptions of the fault as a simple string. |
BaseFaultType |
getFault()
Gets the fault. |
java.lang.String |
getMessage()
Gets error message of the fault. |
static java.lang.String |
getMessage(java.lang.Throwable exception)
Gets the error message of the exception. |
java.lang.String |
getStackTrace()
Gets stack trace of the fault. |
void |
printStackTrace()
Prints stack trace of the fault to System.err. |
void |
printStackTrace(java.io.PrintStream s)
Writes stack trace of the fault to stream. |
void |
printStackTrace(java.io.PrintWriter s)
Writes stack trace of the fault to writer. |
static void |
printStackTrace(java.lang.Throwable exception)
Gets the stack trace of the exception. |
void |
setDescription(java.lang.String description)
Sets the description of the fault. |
void |
setDescription(java.lang.String[] description)
Sets the description of the fault. |
static BaseFaultType |
toBaseFault(java.lang.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 |
private static final java.lang.String LS
public static final org.apache.axis.types.URI STACK_TRACE
public static final org.apache.axis.types.URI EXCEPTION
private static org.globus.util.I18n i18n
private BaseFaultType fault
| 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 java.lang.String getDescriptionAsString()
public java.lang.String[] getDescription()
public void setDescription(java.lang.String description)
description - the new description of the fault.public void setDescription(java.lang.String[] description)
description - the new descriptions of the fault.public void addDescription(java.lang.String description)
description - the description to add.public void addFaultCause(java.lang.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.private void addFaultCause(BaseFaultType fault)
private void addStackTraceFault()
private void addStackTraceFault(java.lang.Throwable exception)
private static BaseFaultType createStackFault(java.lang.String message,
java.lang.String stackTrace)
public static BaseFaultType toBaseFault(java.lang.Throwable exception)
exception - the exception to convert.
STACK_TRACE
error code dialect and error code value that contains the
exception stack trace.public static java.lang.String getMessage(java.lang.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(java.lang.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(java.io.PrintStream s)
getStackTrace() for more information.
public void printStackTrace(java.io.PrintWriter s)
getStackTrace() for more information.
public java.lang.String getMessage()
STACK_TRACE null is returned. Otherwise, the error message
is composed of all descriptions of the fault and descriptions
of the chained faults.public java.lang.String getStackTrace()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||