Mantis - Resin
Viewing Issue Advanced Details
1657 major always 03-28-07 02:12 06-05-07 11:44
dbrakhane  
ferg  
normal  
closed 3.0.20  
fixed  
none    
none 3.1.2  
0001657: Hessian 3.0.20 can't handle Singleton(Map)s
I recently tried upgrading from (the Java) Hessianlib 3.0.8 to 3.0.20 because the latter supports enums. However, it seems like 3.0.20 (in contrast to 3.0.8) can't handle Maps that are an instance of Collections.singletonMap:

Caused by: com.caucho.hessian.io.IOExceptionWrapper: java.lang.InstantiationException: java.util.Collections$SingletonMap
        at com.caucho.hessian.io.MapDeserializer.readMap(MapDeserializer.java)
        at com.caucho.hessian.io.HessianInput.readObject(HessianInput.java)
        at com.caucho.hessian.io.HessianInput.readReply(HessianInput.java:285)
        at com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java)

The problem seems to be that MapDeserializer - as long as the class is not Map.class or SortedMap.class, tries to instanciate a new object of the given type. However, Collections$SingletonMap cannot be instanciated.

I think, modifiying MapDeserializer (and ListDeserializer) so that it, when it cannot instanciate the original type, instanciates an object of HashMap (or ArrayList, respectively) instead, should fix the problem

Notes
(0001903)
dbrakhane   
05-10-07 06:29   
Any thoughts on this one? This bug is keeping me from upgrading and using enums, respectively
(0002009)
ferg   
06-05-07 11:44   
hessian/331a