PDA

View Full Version : SimpleMessageConverter test for serialization support


keenan
08-15-2008, 09:59 PM
In SimpleMessageConverter.cs, the ToMessage method checks for serialization ability using the following code:


else if (objectToConvert is ISerializable)


I have a class that is marked with the [Serializable] attribute, but it does not implement ISerializable so the above test is false. Is there any harm in changing the test to:


else if (objectToConvert.GetType().IsSerializable)


It would be necessary to overload or change the signature of CreateMessageForSerializable because in the above case we cannot cast the ISerializable, but the method is a one line wrapper around session.CreateObjectMessage() which takes in an object type, so I think it is feasible.

Looking further we would also have to change ExtractSerializableFromMessage as well because of the cast on message.Body to ISerializable.

Comments?

Mark Pollack
08-16-2008, 03:39 PM
Hi,

That sounds perfectly reasonable. I've raised a JIRA issue (http://jira.springframework.org/browse/SPRNET-1008)on the matter for RC1?

Thanks!
Mark