Class RemoteWrappedException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.identityconnectors.framework.common.exceptions.ConnectorException
-
- org.identityconnectors.framework.impl.api.remote.RemoteWrappedException
-
- All Implemented Interfaces:
Serializable
public final class RemoteWrappedException extends ConnectorException
RemoteWrappedException wraps every exception which are received from Remote Connector Server. This Exception is not allowed to use in Connectors!!! This type of exception is not allowed to be serialise because this exception represents any after deserialization. This code example show how to get the remote stack trace and how to use the same catches to handle the exceptions regardless its origin.String stackTrace = null; try { try { facade.getObject(ObjectClass.ACCOUNT, uid, null); } catch (RemoteWrappedException e) { stackTrace = e.getStackTrace() } } catch (Throwable t) { if (null != stackTrace) { System.err.println(stackTrace); } else { t.printStackTrace(); } }
- Since:
- 1.4
- Author:
- Laszlo Hordos
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
FIELD_CAUSE
static String
FIELD_CLASS
static String
FIELD_MESSAGE
static String
FIELD_STACK_TRACE
-
Constructor Summary
Constructors Constructor Description RemoteWrappedException(String throwableClass, String message, RemoteWrappedException cause, String stackTrace)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static HashMap<String,Object>
convert(Throwable throwable)
Converts the throwable object to a new Map object that representing itself.RemoteWrappedException
getCause()
Returns the cause of original throwable ornull
if the cause is nonexistent or unknown.String
getExceptionClass()
Gets the class name of the original exception.static String
getStackTrace(Throwable throwable)
Gets the stack trace from a Throwable as a String.boolean
is(Class<? extends Throwable> expected)
Checks if the exception is the expected class.void
printStackTrace(PrintStream s)
void
printStackTrace(PrintWriter s)
String
readStackTrace()
static RemoteWrappedException
wrap(Throwable ex)
Wraps the Throwable into a RemoteWrappedException instance.-
Methods inherited from class org.identityconnectors.framework.common.exceptions.ConnectorException
rethrow
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, setStackTrace, toString
-
-
-
-
Field Detail
-
FIELD_CLASS
public static final String FIELD_CLASS
- See Also:
- Constant Field Values
-
FIELD_MESSAGE
public static final String FIELD_MESSAGE
- See Also:
- Constant Field Values
-
FIELD_CAUSE
public static final String FIELD_CAUSE
- See Also:
- Constant Field Values
-
FIELD_STACK_TRACE
public static final String FIELD_STACK_TRACE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RemoteWrappedException
public RemoteWrappedException(String throwableClass, String message, RemoteWrappedException cause, String stackTrace)
-
-
Method Detail
-
getExceptionClass
public String getExceptionClass()
Gets the class name of the original exception. This value is constructed bythrowable.getClass().getName()
.- Returns:
- name of the original exception.
-
is
public boolean is(Class<? extends Throwable> expected)
Checks if the exception is the expected class.- Parameters:
expected
- the expected throwable class.- Returns:
true
if the class name are equals.
-
getCause
public RemoteWrappedException getCause()
Returns the cause of original throwable ornull
if the cause is nonexistent or unknown. (The cause is the throwable that caused the original throwable to get thrown.)
-
printStackTrace
public void printStackTrace(PrintStream s)
- Overrides:
printStackTrace
in classThrowable
-
printStackTrace
public void printStackTrace(PrintWriter s)
- Overrides:
printStackTrace
in classThrowable
-
readStackTrace
public String readStackTrace()
-
getStackTrace
public static String getStackTrace(Throwable throwable)
Gets the stack trace from a Throwable as a String.- Parameters:
throwable
- theThrowable
to be examined- Returns:
- the stack trace as generated by the exception's
printStackTrace(PrintWriter)
method
-
wrap
public static RemoteWrappedException wrap(Throwable ex)
Wraps the Throwable into a RemoteWrappedException instance.- Parameters:
ex
- Exception to wrap or cast and return.- Returns:
- a
RemoteWrappedException
that either is the specified exception or contains the specified exception.
-
-