package javax.management.modelmbean;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.ObjectStreamField;
import org.jboss.mx.util.Serialization;
public class InvalidTargetObjectTypeException
extends Exception
{
private Exception exception = null;
private static final long serialVersionUID;
private static final ObjectStreamField[] serialPersistentFields;
static
{
switch (Serialization.version)
{
case Serialization.V1R0:
serialVersionUID = 3711724570458346634L;
serialPersistentFields = new ObjectStreamField[]
{
new ObjectStreamField("msgStr", String.class),
new ObjectStreamField("relatedExcept", Exception.class),
};
break;
default:
serialVersionUID = 1190536278266811217L;
serialPersistentFields = new ObjectStreamField[]
{
new ObjectStreamField("exception", Exception.class),
};
}
}
public InvalidTargetObjectTypeException()
{
super();
}
public InvalidTargetObjectTypeException(String s)
{
super(s);
}
public InvalidTargetObjectTypeException(Exception e, String s)
{
super(s);
this.exception = e;
}
public String toString()
{
return "InvalidTargetObjectTypeException: " + getMessage() +
((exception == null) ? "" : " Cause: " + exception.toString());
}
private void readObject(ObjectInputStream ois)
throws IOException, ClassNotFoundException
{
switch (Serialization.version)
{
case Serialization.V1R0:
ObjectInputStream.GetField getField = ois.readFields();
exception = (Exception) getField.get("relatedExcept", null);
break;
default:
ois.defaultReadObject();
}
}
private void writeObject(ObjectOutputStream oos)
throws IOException
{
switch (Serialization.version)
{
case Serialization.V1R0:
ObjectOutputStream.PutField putField = oos.putFields();
putField.put("msgStr", getMessage());
putField.put("relatedExcept", exception);
oos.writeFields();
break;
default:
oos.defaultWriteObject();
}
}
}