Package org.wildfly.common.rpc
Class RemoteExceptionCause
java.lang.Object
java.lang.Throwable
org.wildfly.common.rpc.RemoteExceptionCause
- All Implemented Interfaces:
Serializable
A remote exception cause. Instances of this class are intended to aid with diagnostics and are not intended to be
directly thrown. They may be added to other exception types as a cause or suppressed throwable.
- Author:
- David M. Lloyd
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionRemoteExceptionCause(String msg, String exceptionClassName) Constructs a newRemoteExceptionCauseinstance with an initial message.Constructs a newRemoteExceptionCauseinstance with an initial message.RemoteExceptionCause(String msg, RemoteExceptionCause cause, String exceptionClassName) Constructs a newRemoteExceptionCauseinstance with an initial message and cause.RemoteExceptionCause(String msg, RemoteExceptionCause cause, String exceptionClassName, Map<String, String> fields) Constructs a newRemoteExceptionCauseinstance with an initial message and cause. -
Method Summary
Modifier and TypeMethodDescriptiongetCause()Get the original exception class name.Get the field names of the remote exception.getFieldValue(String fieldName) Get the string value of the given field name.static RemoteExceptionCauseGet a remote exception cause for the givenThrowable.static RemoteExceptionCausereadFromStream(DataInput input) Convert this remote exception cause to a plain throwable for sending to peers which use serialization and do not have this class present.toString()Get a string representation of this exception.voidwriteToStream(DataOutput output) Write this remote exception cause to the given stream, without using serialization.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
Constructor Details
-
RemoteExceptionCause
Constructs a newRemoteExceptionCauseinstance with an initial message. No cause is specified.- Parameters:
msg- the messageexceptionClassName- the name of the exception's class (must not benull)
-
RemoteExceptionCause
Constructs a newRemoteExceptionCauseinstance with an initial message and cause.- Parameters:
msg- the messagecause- the causeexceptionClassName- the name of the exception's class (must not benull)
-
RemoteExceptionCause
Constructs a newRemoteExceptionCauseinstance with an initial message. No cause is specified.- Parameters:
msg- the messageexceptionClassName- the name of the exception's class (must not benull)fields- the public fields of the remote exception (must not benull)
-
RemoteExceptionCause
public RemoteExceptionCause(String msg, RemoteExceptionCause cause, String exceptionClassName, Map<String, String> fields) Constructs a newRemoteExceptionCauseinstance with an initial message and cause.- Parameters:
msg- the messagecause- the causeexceptionClassName- the name of the exception's class (must not benull)fields- the public fields of the remote exception (must not benull)
-
-
Method Details
-
of
Get a remote exception cause for the givenThrowable. All of the cause and suppressed exceptions will also be converted.- Parameters:
t- the throwable, ornull- Returns:
- the remote exception cause, or
nullifnullwas passed in
-
toPlainThrowable
Convert this remote exception cause to a plain throwable for sending to peers which use serialization and do not have this class present. Note that this does not recursively apply; normally, a serialization framework will handle the recursive application of this operation through object resolution.- Returns:
- the throwable (not
null)
-
getExceptionClassName
Get the original exception class name.- Returns:
- the original exception class name (not
null)
-
getFieldNames
Get the field names of the remote exception.- Returns:
- the field names of the remote exception
-
getFieldValue
Get the string value of the given field name.- Parameters:
fieldName- the name of the field (must not benull)- Returns:
- the string value of the given field name
-
toString
Get a string representation of this exception. The representation will return an indication of the fact that this was a remote exception, the remote exception type, and optionally details of the exception content, followed by the exception message. -
writeToStream
Write this remote exception cause to the given stream, without using serialization.- Parameters:
output- the output stream (must not benull)- Throws:
IOException- if an error occurs writing the data
-
readFromStream
- Throws:
IOException
-
getCause
-