[
https://issues.apache.org/jira/browse/MUSE-266?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Bogdan Solomon updated MUSE-266:
--------------------------------
Attachment: SerializerRegistry.java
Fixed SerializerRegistry to ensure that arrays of classes that have
serializable parents/interfaces can be serialized through the respective
parent's/interface's serializers.
> ProxyHandlerProxy and SerializerRegistry treat incorrectly an array of
> XmlSerializable
> --------------------------------------------------------------------------------------
>
> Key: MUSE-266
> URL: https://issues.apache.org/jira/browse/MUSE-266
> Project: Muse
> Issue Type: Bug
> Components: Core Engine - Routing and Serialization
> Affects Versions: 2.2.0
> Environment: Java 5.0
> Reporter: Bogdan Solomon
> Assignee: Dan Jemiolo
> Attachments: SerializerRegistry.java
>
>
> I have an array of custom defined objects that implement the XmlSerializable
> interface. These objects are then sent via a proxy generated by TPTP from a
> client (who is also a Muse resource) to another resource. The invocation
> however results in an exception due to the non existence of a serializer for
> my custom type. I would have expected to have it serialized via the
> XmlSerializable interface.
> The bug results from the way the SerializerRegistry tries to find the
> Serializer for a class. Looking at the code it looks for the class and it's
> parents + interfaces. However doing a small test showed me that Java returns
> for an array of my objects the following interfaces, and no parents:
> class com.ibm.autonomic.util.Test
> interface java.lang.Cloneable
> interface java.io.Serializable
> doing the same test for an object of my type results in the following:
> interface org.apache.muse.util.xml.XmlSerializable
> interface com.ibm.autonomic.util.EstimatedDataNamespace
> So it will be impossible for the current implementation of the
> SerializerRegistry to find how to serialize any array type that should be
> serialized via a parent's or interface's serializer. The solution in my
> opinion would be to check if it is an array class, check if the type of that
> array is serializable and then return the ArraySerializer. This would also
> remove the necessity of adding a serializer for the array type and for the
> basic type.
> In SerializerRegistry line 120 after
> if (type == null)
> throw new NullPointerException(_MESSAGES.get("NullClass"));
> add
> if (type.isArray())
> {
> //figure out if we have a serializer for the base type
> Serializer ser = searchClassHierarchy(type.getComponentType());
>
> if (ser != null)
> {
> //the base type has a serializer, so generate an array
> serializer for the type and return it
> //the type will be our array type and ser is the serializer
> for the base type
> Serializer serArray = new ArraySerializer(type, ser);
> return serArray;
> }
> }
> This would also result in the removal of lines 168, 169, 172 from the
> registrySerializer() method as they will no longer be necessary and they work
> only if the base array type has a serializer. I'll attach a fixed
> SerializerRegistry
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]