[ 
https://issues.apache.org/activemq/browse/AMQ-2083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=49974#action_49974
 ] 

Martin Haslinger commented on AMQ-2083:
---------------------------------------

It turned out that the HashMap was not synchronized correctly and some of the 
data was manipulated while it got serialised, synchronizing solved the problem. 
Anyway I would expect a ConcurrentModificationException or something similar to 
happen and wonder why an OptionalDataException occurs?

> java.io.OptionalDataException when getting a deeply nested HashMap from an 
> ObjectMessage
> ----------------------------------------------------------------------------------------
>
>                 Key: AMQ-2083
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2083
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.2.0
>         Environment: JRE 1.5.0_12
>            Reporter: Martin Haslinger
>
> In rare occasions getting a HashMap from an ObjectMessage leads to the 
> following error:
> javax.jms.JMSException: Failed to build body from bytes. Reason: 
> java.io.OptionalDataException
>       at 
> org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)
>       at 
> org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:183)
> Caused by: java.io.OptionalDataException
>       at java.io.ObjectInputStream.readObject0(Unknown Source)
>       at java.io.ObjectInputStream.readObject(Unknown Source)
>       at java.util.HashMap.readObject(Unknown Source)
>       at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>       at java.lang.reflect.Method.invoke(Unknown Source)
>       at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
>       at java.io.ObjectInputStream.readSerialData(Unknown Source)
>       at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
>       at java.io.ObjectInputStream.readObject0(Unknown Source)
>       at java.io.ObjectInputStream.readObject(Unknown Source)
>       at java.util.HashMap.readObject(Unknown Source)
>       at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>       at java.lang.reflect.Method.invoke(Unknown Source)
>       at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
>       at java.io.ObjectInputStream.readSerialData(Unknown Source)
>       at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
>       at java.io.ObjectInputStream.readObject0(Unknown Source)
>       at java.io.ObjectInputStream.readObject(Unknown Source)
>       at java.util.HashMap.readObject(Unknown Source)
>       at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>       at java.lang.reflect.Method.invoke(Unknown Source)
>       at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
>       at java.io.ObjectInputStream.readSerialData(Unknown Source)
>       at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
>       at java.io.ObjectInputStream.readObject0(Unknown Source)
>       at java.io.ObjectInputStream.readObject(Unknown Source)
>       at 
> org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:177)
>       ... 8 more
> The only difference in the testing application to all other messages is that 
> the object is a deeply nested map, it is: HashMap<String, HashMap<String, 
> HashMap<String,String>>>
> Alltough the OptionalDataException indicates some primitive values being 
> written somewhere, there are absolute no primitive values around there.

-- 
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