Top Description Inners Fields Constructors Methods
org.wildfly.common.rpc

public final Class RemoteExceptionCause

extends Throwable
Class Inheritance
Imports
java.io.DataInput, .DataOutput, .IOException, .Serializable, java.lang.reflect.Field, .Modifier, java.util.ArrayList, .Arrays, .Collections, .HashMap, .IdentityHashMap, .Iterator, .Map, .Set, .TreeMap, java.util.function.Function, org.wildfly.common.Assert, org.wildfly.common._private.CommonMessages

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

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private static final StackTraceElement[]
private final String
private static final ClassValue<Function<Throwable, Map<String, String>>>
private final Map<String, String>
private static final RemoteExceptionCause[]
private static final String[]
private static final long
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private transient String

Constructor Summary

AccessConstructor and Description
pack-priv
RemoteExceptionCause(final String msg, final RemoteExceptionCause cause, final String exceptionClassName, final Map<String, String> fields, boolean cloneFields)

public
RemoteExceptionCause(final String
the message
msg
,
final String
the name of the exception's class (must not be null)
exceptionClassName
)

Constructs a new RemoteExceptionCause instance with an initial message.

public
RemoteExceptionCause(final String
the message
msg
,
final RemoteExceptionCause
the cause
cause
,
final String
the name of the exception's class (must not be null)
exceptionClassName
)

Constructs a new RemoteExceptionCause instance with an initial message and cause.

public
RemoteExceptionCause(final String
the message
msg
,
final String
the name of the exception's class (must not be null)
exceptionClassName
,
final Map<String, String>
the public fields of the remote exception (must not be null)
fields
)

Constructs a new RemoteExceptionCause instance with an initial message.

public
RemoteExceptionCause(final String
the message
msg
,
final RemoteExceptionCause
the cause
cause
,
final String
the name of the exception's class (must not be null)
exceptionClassName
,
final Map<String, String>
the public fields of the remote exception (must not be null)
fields
)

Constructs a new RemoteExceptionCause instance with an initial message and cause.

Method Summary

Modifier and TypeMethod and Description
public RemoteExceptionCause
getCause()

Overrides java.lang.Throwable.getCause.

Returns the cause of this throwable or null if the cause is nonexistent or unknown.
public String

Returns:

the original exception class name (not null)
getExceptionClassName
()

Get the original exception class name.

public Set<String>

Returns:

the field names of the remote exception
getFieldNames
()

Get the field names of the remote exception.

public String

Returns:

the string value of the given field name
getFieldValue
(String
the name of the field (must not be null)
fieldName
)

Get the string value of the given field name.

public static RemoteExceptionCause

Returns:

the remote exception cause, or null if null was passed in
of
(Throwable
the throwable, or null
t
)

Get a remote exception cause for the given Throwable.

private static RemoteExceptionCause
public static RemoteExceptionCause
private static <T> T
readObject(DataInput input, Class<T> expect, ArrayList<Object> cache, final boolean allowNull)

private static int
public Throwable

Returns:

the throwable (not null)
toPlainThrowable
()

Convert this remote exception cause to a plain throwable for sending to peers which use serialization and do not have this class present.

public String

Returns:

the string representation of the exception
toString
()

Overrides java.lang.Throwable.toString.

Get a string representation of this exception.
private int
writeFields(final DataOutput output, final Map<String, String> fields, final IdentityIntMap<Object> seen, final HashMap<String, String> stringCache, int cnt)

private static void
pack-priv Object
private int
writeStackElement(final DataOutput output, final StackTraceElement element, final IdentityIntMap<Object> seen, final HashMap<String, String> stringCache, int cnt)

private int
writeStackTrace(final DataOutput output, final StackTraceElement[] stackTrace, final IdentityIntMap<Object> seen, final HashMap<String, String> stringCache, int cnt)

private int
writeString(final DataOutput output, String string, final IdentityIntMap<Object> seen, final HashMap<String, String> stringCache, final int cnt)

private int
writeThrowable(final DataOutput output, final Throwable throwable, final IdentityIntMap<Object> seen, final HashMap<String, String> stringCache, final int cnt)

public void
writeToStream(DataOutput
the output stream (must not be null)
output
)

Write this remote exception cause to the given stream, without using serialization.

private int
writeToStream(DataOutput output, IdentityIntMap<Object> seen, HashMap<String, String> stringCache, int cnt)

Inherited from java.lang.Throwable:
addSuppressedfillInStackTracegetLocalizedMessagegetMessagegetStackTracegetSuppressedinitCauseprintStackTraceprintStackTraceprintStackTracesetStackTrace

Field Detail

EMPTY_STACKback to summary
private static final StackTraceElement[] EMPTY_STACK
exceptionClassNameback to summary
private final String exceptionClassName
fieldGetterValueback to summary
private static final ClassValue<Function<Throwable, Map<String, String>>> fieldGetterValue
fieldsback to summary
private final Map<String, String> fields
NO_REMOTE_EXCEPTION_CAUSESback to summary
private static final RemoteExceptionCause[] NO_REMOTE_EXCEPTION_CAUSES
NO_STRINGSback to summary
private static final String[] NO_STRINGS
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.Throwable.serialVersionUID.

ST_BACKREF_FARback to summary
private static final int ST_BACKREF_FAR
ST_BACKREF_NEARback to summary
private static final int ST_BACKREF_NEAR
ST_INT16back to summary
private static final int ST_INT16
ST_INT32back to summary
private static final int ST_INT32
ST_INT8back to summary
private static final int ST_INT8
ST_INT_MINIback to summary
private static final int ST_INT_MINI
ST_NEW_EXCEPTION_CAUSEback to summary
private static final int ST_NEW_EXCEPTION_CAUSE
ST_NEW_STACK_ELEMENT_V8back to summary
private static final int ST_NEW_STACK_ELEMENT_V8
ST_NEW_STACK_ELEMENT_V9back to summary
private static final int ST_NEW_STACK_ELEMENT_V9
ST_NEW_STRINGback to summary
private static final int ST_NEW_STRING
ST_NULLback to summary
private static final int ST_NULL
toStringback to summary
private transient String toString

Constructor Detail

RemoteExceptionCauseback to summary
pack-priv RemoteExceptionCause(final String msg, final RemoteExceptionCause cause, final String exceptionClassName, final Map<String, String> fields, boolean cloneFields)
RemoteExceptionCauseback to summary
public RemoteExceptionCause(final String msg, final String exceptionClassName)

Constructs a new RemoteExceptionCause instance with an initial message. No cause is specified.

Parameters
msg:String

the message

exceptionClassName:String

the name of the exception's class (must not be null)

RemoteExceptionCauseback to summary
public RemoteExceptionCause(final String msg, final RemoteExceptionCause cause, final String exceptionClassName)

Constructs a new RemoteExceptionCause instance with an initial message and cause.

Parameters
msg:String

the message

cause:RemoteExceptionCause

the cause

exceptionClassName:String

the name of the exception's class (must not be null)

RemoteExceptionCauseback to summary
public RemoteExceptionCause(final String msg, final String exceptionClassName, final Map<String, String> fields)

Constructs a new RemoteExceptionCause instance with an initial message. No cause is specified.

Parameters
msg:String

the message

exceptionClassName:String

the name of the exception's class (must not be null)

fields:Map<String, String>

the public fields of the remote exception (must not be null)

RemoteExceptionCauseback to summary
public RemoteExceptionCause(final String msg, final RemoteExceptionCause cause, final String exceptionClassName, final Map<String, String> fields)

Constructs a new RemoteExceptionCause instance with an initial message and cause.

Parameters
msg:String

the message

cause:RemoteExceptionCause

the cause

exceptionClassName:String

the name of the exception's class (must not be null)

fields:Map<String, String>

the public fields of the remote exception (must not be null)

Method Detail

getCauseback to summary
public RemoteExceptionCause getCause()

Overrides java.lang.Throwable.getCause.

Doc from java.lang.Throwable.getCause.

Returns the cause of this throwable or null if the cause is nonexistent or unknown. (The cause is the throwable that caused this throwable to get thrown.)

This implementation returns the cause that was supplied via one of the constructors requiring a Throwable, or that was set after creation with the initCause(Throwable) method. While it is typically unnecessary to override this method, a subclass can override it to return a cause set by some other means. This is appropriate for a "legacy chained throwable" that predates the addition of chained exceptions to Throwable. Note that it is not necessary to override any of the PrintStackTrace methods, all of which invoke the getCause method to determine the cause of a throwable.

Returns:RemoteExceptionCause

the cause of this throwable or null if the cause is nonexistent or unknown.

getExceptionClassNameback to summary
public String getExceptionClassName()

Get the original exception class name.

Returns:String

the original exception class name (not null)

getFieldNamesback to summary
public Set<String> getFieldNames()

Get the field names of the remote exception.

Returns:Set<String>

the field names of the remote exception

getFieldValueback to summary
public String getFieldValue(String fieldName)

Get the string value of the given field name.

Parameters
fieldName:String

the name of the field (must not be null)

Returns:String

the string value of the given field name

ofback to summary
public static RemoteExceptionCause of(Throwable t)

Get a remote exception cause for the given Throwable. All of the cause and suppressed exceptions will also be converted.

Parameters
t:Throwable

the throwable, or null

Returns:RemoteExceptionCause

the remote exception cause, or null if null was passed in

ofback to summary
private static RemoteExceptionCause of(Throwable t, IdentityHashMap<Throwable, RemoteExceptionCause> seen)
readFromStreamback to summary
public static RemoteExceptionCause readFromStream(DataInput input) throws IOException
readObjectback to summary
private static <T> T readObject(DataInput input, Class<T> expect, ArrayList<Object> cache, final boolean allowNull) throws IOException
readPackedIntback to summary
private static int readPackedInt(DataInput is) throws IOException
toPlainThrowableback to summary
public Throwable 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:Throwable

the throwable (not null)

toStringback to summary
public String toString()

Overrides java.lang.Throwable.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.

Returns:String

the string representation of the exception

writeFieldsback to summary
private int writeFields(final DataOutput output, final Map<String, String> fields, final IdentityIntMap<Object> seen, final HashMap<String, String> stringCache, int cnt) throws IOException
writePackedIntback to summary
private static void writePackedInt(DataOutput os, int val) throws IOException
writeReplaceback to summary
pack-priv Object writeReplace()
writeStackElementback to summary
private int writeStackElement(final DataOutput output, final StackTraceElement element, final IdentityIntMap<Object> seen, final HashMap<String, String> stringCache, int cnt) throws IOException
writeStackTraceback to summary
private int writeStackTrace(final DataOutput output, final StackTraceElement[] stackTrace, final IdentityIntMap<Object> seen, final HashMap<String, String> stringCache, int cnt) throws IOException
writeStringback to summary
private int writeString(final DataOutput output, String string, final IdentityIntMap<Object> seen, final HashMap<String, String> stringCache, final int cnt) throws IOException
writeThrowableback to summary
private int writeThrowable(final DataOutput output, final Throwable throwable, final IdentityIntMap<Object> seen, final HashMap<String, String> stringCache, final int cnt) throws IOException
writeToStreamback to summary
public void writeToStream(DataOutput output) throws IOException

Write this remote exception cause to the given stream, without using serialization.

Parameters
output:DataOutput

the output stream (must not be null)

Exceptions
IOException:
if an error occurs writing the data
writeToStreamback to summary
private int writeToStream(DataOutput output, IdentityIntMap<Object> seen, HashMap<String, String> stringCache, int cnt) throws IOException
org.wildfly.common.rpc back to summary

pack-priv final Class RemoteExceptionCause.Serialized

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable

Field Summary

Modifier and TypeField and Description
pack-priv final RemoteExceptionCause
c

pack-priv final String
pack-priv final String[]
f

pack-priv final String
m

pack-priv final RemoteExceptionCause[]
s

private static final long
pack-priv final StackTraceElement[]

Constructor Summary

AccessConstructor and Description
pack-priv
Serialized(final String m, final String cn, final RemoteExceptionCause c, final RemoteExceptionCause[] s, final StackTraceElement[] st, final String[] f)

Method Summary

Modifier and TypeMethod and Description
pack-priv Object
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cback to summary
pack-priv final RemoteExceptionCause c
cnback to summary
pack-priv final String cn
fback to summary
pack-priv final String[] f
mback to summary
pack-priv final String m
sback to summary
pack-priv final RemoteExceptionCause[] s
serialVersionUIDback to summary
private static final long serialVersionUID
stback to summary
pack-priv final StackTraceElement[] st

Constructor Detail

Serializedback to summary
pack-priv Serialized(final String m, final String cn, final RemoteExceptionCause c, final RemoteExceptionCause[] s, final StackTraceElement[] st, final String[] f)

Method Detail

readResolveback to summary
pack-priv Object readResolve()