Mantis - Resin
Viewing Issue Advanced Details
2028 minor always 09-25-07 09:16 09-28-07 13:36
ferg  
ferg  
normal  
closed 3.1.2  
fixed  
none    
none 3.1.3  
0002028: Hessian: Unsupported operation exception
(rep by Jerome Landreau)


I am using Hessian version 3.1.2 and I have an exception when I try to deserialize my object:

java.lang.UnsupportedOperationException: com.caucho.hessian.io.CollectionDeserializer@152dd7b
        at com.caucho.hessian.io.AbstractDeserializer.readLengthList(AbstractDeserializer.java:77)
        at com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1839)
        at com.caucho.hessian.io.MapDeserializer.readMap(MapDeserializer.java:117)
        at com.caucho.hessian.io.SerializerFactory.readMap(SerializerFactory.java:347)
        at com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1845)
        at com.caucho.hessian.io.MapDeserializer.readMap(MapDeserializer.java:117)
        at com.caucho.hessian.io.SerializerFactory.readMap(SerializerFactory.java:347)
        at com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1845)
        at com.caucho.hessian.io.CollectionDeserializer.readList(CollectionDeserializer.java:111)
        at com.caucho.hessian.io.SerializerFactory.readList(SerializerFactory.java:333)
        at com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1827)
        at com.caucho.hessian.io.CollectionDeserializer.readList(CollectionDeserializer.java:111)
        at com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1577)
        at com.caucho.hessian.io.JavaDeserializer$ObjectFieldDeserializer.deserialize(JavaDeserializer.java:375)
        at com.caucho.hessian.io.JavaDeserializer.readObject(JavaDeserializer.java:228)

This is the code that I am using to deserialize my object is:

ByteArrayInputStream bais = new ByteArrayInputStream(data);
Hessian2Input in = new Hessian2Input(bais);
Object o = in.readObject();
in.close();

After some debugging, I have found that the problem is in this part of the method "Hessian2Input.readObject()":

case 'v': {
      int ref = readInt();
      String type = (String) _types.get(ref);
      int length = readInt();
      
      Deserializer reader;
      reader = findSerializerFactory().getObjectDeserializer(type);
      
      return reader.readLengthList(this, length);
    }

The type is a custom class which implements java.util.List and the reader is an instance of CollectionDeserializer wich extends the class AbstractDeserializer.
The problem is that CollectionDeserializer doesnt't override the readLengthList method of the class AbstractDeserializer which throws an UnsuportedException.

Notes
(0002315)
ferg   
09-28-07 13:36   
hessian/3b2j