[ 
https://issues.apache.org/jira/browse/CXF-2720?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Berkowitz updated CXF-2720:
-----------------------------------

    Description: 
Given an object of type {{Map<TKey, TValue>}}, where, say, {{TValue}} is a base 
class extended by {{TValuePrime}}, when a serialized instance contains a value 
of type {{TValuePrime}}, *MapType* will try to deserialize it as a {{TValue}}, 
ignoring the fact that it's really an instance of {{TValuePrime}}. In many 
cases this will throw an exception when trying to _set_ a member that exists 
only in {{TValuePrime}}.   (We have observed this for the value class, but it 
should be true of the key class as well).

We have fixed this - as far as we can tell - by swiping code from *ArrayType*, 
which handles these things correctly.  We're attaching our new version of 
*MapType.java*.

Lacking a deep understand of the Aegis code, we did this by intuition and 
trial-and-error, so it may be inefficient or even technically incorrect, but so 
far it works for us.  Please get this fix, or its functional equivalent, into 
the codebase.

Thanks in advance.

  was:
Given an object of type {{Map<TKey, TValue>}}, where, say, {{TValue}} is a base 
class extended by {{TValuePrime}}, when a serialized instance contains a value 
of type {{TValuePrime}}, *MapType* will try to deserialize it as a {{TValue}}, 
ignoring the fact that it's really an instance of {{TValuePrime}}. In many 
cases this will throw an exception when trying to _set_ a member that exists 
only in {{TValuePrime}}.   (We have observed this for the value class, but it 
should be true of the key class as well).

We have fixed this - as far as we can tell - by swiping code from *ArrayType*, 
which handles these things correctly.  We're attaching our new version of 
*MapType.readObject()*.

Lacking a deep understand of the Aegis code, we did this by intuition and 
trial-and-error, so it may be inefficient or even technically incorrect, but so 
far it works for us.  Please get this fix, or its functional equivalent, into 
the codebase.

Thanks in advance.


> MapType doesn't deserialize subclass instances
> ----------------------------------------------
>
>                 Key: CXF-2720
>                 URL: https://issues.apache.org/jira/browse/CXF-2720
>             Project: CXF
>          Issue Type: Bug
>          Components: Aegis Databinding
>    Affects Versions: 2.2.6
>         Environment: All
>            Reporter: Michael Berkowitz
>         Attachments: MapType.java
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Given an object of type {{Map<TKey, TValue>}}, where, say, {{TValue}} is a 
> base class extended by {{TValuePrime}}, when a serialized instance contains a 
> value of type {{TValuePrime}}, *MapType* will try to deserialize it as a 
> {{TValue}}, ignoring the fact that it's really an instance of 
> {{TValuePrime}}. In many cases this will throw an exception when trying to 
> _set_ a member that exists only in {{TValuePrime}}.   (We have observed this 
> for the value class, but it should be true of the key class as well).
> We have fixed this - as far as we can tell - by swiping code from 
> *ArrayType*, which handles these things correctly.  We're attaching our new 
> version of *MapType.java*.
> Lacking a deep understand of the Aegis code, we did this by intuition and 
> trial-and-error, so it may be inefficient or even technically incorrect, but 
> so far it works for us.  Please get this fix, or its functional equivalent, 
> into the codebase.
> Thanks in advance.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to