public class ExceptionProxy extends Object implements Externalizable
Constructor and Description |
---|
ExceptionProxy() |
ExceptionProxy(Throwable throwable) |
Modifier and Type | Method and Description |
---|---|
Throwable |
createException()
Constructs an instance of the proxied exception based on the class name,
message, stack trace and if applicable, the cause.
|
static ExceptionProxy |
createForException(Throwable throwable)
Static method to create an exception proxy for the passed in
Throwable class. |
ArquillianProxyException |
createProxyException(String reason) |
Throwable |
getCause()
Returns the cause of the exception represented by this proxy
|
boolean |
hasException()
Indicates whether this proxy wraps an exception
|
void |
readExternal(ObjectInput in)
Custom Serialization logic.
|
String |
toString() |
void |
writeExternal(ObjectOutput out) |
public ExceptionProxy()
public ExceptionProxy(Throwable throwable)
public static ExceptionProxy createForException(Throwable throwable)
Throwable
class. If null is passed in, null is returned as the
exception proxythrowable
- Exception to proxypublic boolean hasException()
public Throwable createException()
Throwable
instancepublic ArquillianProxyException createProxyException(String reason)
public Throwable getCause()
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
If possible, we try to keep the original Exception form the Container side.
If we can't load the Exception on the client side, return a ArquillianProxyException that keeps the original stack trace etc.
We can't use in.readObject() on the Throwable cause, because if a ClassNotFoundException is thrown, the stream is marked with the exception and that stream is the same stream that is deserializing us, so we will fail outside of our control. Store the Throwable cause as a serialized byte array instead, so we can deserialize it outside of our own stream.
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
Copyright © 2017 JBoss by Red Hat. All rights reserved.