Problem serializing a Bean with a List attribute of simple types with 
doAutoTypes=true
--------------------------------------------------------------------------------------

                 Key: AXIS-2627
                 URL: https://issues.apache.org/jira/browse/AXIS-2627
             Project: Axis
          Issue Type: Bug
          Components: Serialization/Deserialization
    Affects Versions: 1.3, 1.4
            Reporter: Rodolfo Mendilola Badaracco
            Priority: Blocker


I ve detected a problem serializing java beans with the flag doAutoTypes set to 
true.

When a java bean contains an attribute of type List containing simple types 
like a String, the axis serializer cannot find any typemappings for the 
elements of the list because it is (I suppose) in a different serialization 
context. 

As the only known parameter in this case is the java class type, it generates a 
new QName based on its packagename and register a new typemapping with a 
BeanSerializer/Deserializer ... :( ....A String is not a java Bean !!!

And once again, as we look for typemappings first in the registry for the 
"autoType" generation context (I suppose), all the calls after this, uses this 
typemapping.

Ive found a workaround for this which is working for me (as far as I know)

By putting a with commas separated list of classes, that should be ignored for 
the "autoType" case and setting it in the AxisProperties.

After that in the TypeMappingImpl I ve change the 

public QName getTypeQName(Class javaType, TypeMappingDelegate next);

method to check against this list before the registry gets initialized.....

public class TypeMappingImpl implements Serializable
{

    //...............

    public QName getTypeQName(Class javaType, TypeMappingDelegate next) {
        
            //....................
                
        /* If the class isn't an array or List and auto-typing is turned on,
        * register the class and it's type as beans.
        */
        if (xmlType == null && shouldDoAutoTypes())
        {
                // This is a patch to avoid the auto generation of typemappings
                // for determied classes, the property may be setted in the 
wsdd file
            String types = 
(String)AxisProperties.getProperties().get("axis.ignoreAutoTypes");
            List typeClasses = getClasses(types);

            if (!contains(javaType, typeClasses)) {
                xmlType = new QName(
                                Namespaces.makeNamespace( javaType.getName() ),
                                Types.getLocalNameFromFullName( 
javaType.getName() ) );
                internalRegister( javaType,
                                xmlType,
                                new BeanSerializerFactory(javaType, xmlType),
                                new BeanDeserializerFactory(javaType, xmlType) 
);
            } else {
                log.info("Ignorig auto types for " + javaType);
            }
                }
        }
        
        //....................
}


Is this problem fixed in the Axis 2 version???
        


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

Reply via email to