Hessian serialization mechanism converts Floats to Doubles
----------------------------------------------------------

         Key: CAY-605
         URL: http://issues.apache.org/cayenne/browse/CAY-605
     Project: Cayenne
        Type: Bug

  Components: Cayenne Core Library  
    Versions: 1.2 [STABLE], 3.0    
    Reporter: Andrus Adamchik
 Assigned to: Andrus Adamchik 
    Priority: Minor
     Fix For: 1.2 [STABLE], 3.0


If an entity has a field defined as java.lang.Float, then sending a client 
object to the server, and then retrieving it back results in this exception:

java.lang.IllegalArgumentException
        at 
sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
        at java.lang.reflect.Field.set(Field.java:656)
        at 
org.objectstyle.cayenne.property.FieldAccessor.writePropertyDirectly(FieldAccessor.java:115)
        at 
org.objectstyle.cayenne.property.SimpleProperty.writePropertyDirectly(SimpleProperty.java:119)
        at 
org.objectstyle.cayenne.property.SimpleProperty.writeProperty(SimpleProperty.java:90)
        at 
org.objectstyle.cayenne.map.EntityDescriptor$SimplePersistentProperty.writeProperty(EntityDescriptor.java:341)
        at 
org.objectstyle.cayenne.util.ObjectDetachOperation$1.visitProperty(ObjectDetachOperation.java:195)
        at 
org.objectstyle.cayenne.property.SimpleProperty.visit(SimpleProperty.java:98)
        at 
org.objectstyle.cayenne.property.BaseClassDescriptor.visitProperties(BaseClassDescriptor.java:250)
        at 
org.objectstyle.cayenne.util.ObjectDetachOperation.detach(ObjectDetachOperation.java:134)
        at 
org.objectstyle.cayenne.access.ClientServerChannelQueryAction.toClientObjects(ClientServerChannelQueryAction.java:221)
        at 
org.objectstyle.cayenne.access.ClientServerChannelQueryAction.interceptObjectConversion(ClientServerChannelQueryAction.java:181)
        at 
org.objectstyle.cayenne.access.ClientServerChannelQueryAction.execute(ClientServerChannelQueryAction.java:106)
        at 
org.objectstyle.cayenne.access.ClientServerChannel.onQuery(ClientServerChannel.java:99)
        at 
org.objectstyle.cayenne.remote.service.DispatchHelper.dispatch(DispatchHelper.java:76)
        at 
org.objectstyle.cayenne.remote.service.BaseRemoteService.processMessage(BaseRemoteService.java:182)
 

As it turned out Hessian serializes Floats as Doubles... Will have to add a 
custom handler.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/cayenne/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to