Mantis - Resin
Viewing Issue Advanced Details
70 minor always 03-31-05 00:00 02-03-06 09:43
user102  
ferg  
normal  
closed  
fixed  
none    
none 3.0.17  
0000070: hessian ThrowableSerializer does not serialize fields of subclasses of Throwable
RSN-61
The hessian ThrowableSerializer does not serialize fields in subclasses of Throwable.
this results in all data in the fields of the Exception being lost.
for example if i make a subclass of Exception with a new field "int code", this will never be
serialized, leaving it always to its default of null;

The reason for this is that throwable serializer extends JavaSerializer, and passes java.lang.Throwable.class as an argument to the super() constructor.
since the JavaSerializer gets the fields of this value, none of the actual instances class fields
are serialized.

The problem is solve if the following code is modified:
public class ThrowableSerializer extends JavaSerializer {
  public ThrowableSerializer()
  {
    super(Throwable.class);
  }
.........
to
public class ThrowableSerializer extends JavaSerializer {
  public ThrowableSerializer(Class clazz)
  {
    super(clazz);
  }
and the Method Constructing the ThrowableSerializer passes the actual class of the Exception
object to the constructor.
linux

Notes
(0000859)
ferg   
02-03-06 09:43   
ejb/234e