Inherited attributes are not serialized by BeanSerializer
---------------------------------------------------------

         Key: AXIS-1917
         URL: http://issues.apache.org/jira/browse/AXIS-1917
     Project: Axis
        Type: Bug
  Components: Serialization/Deserialization  
    Versions: 1.2RC3    
    Reporter: Peter Tandara-Kuhns
    Priority: Blocker


If the WSDL file contains a complexContent extension of a complexType that has 
attributes, and the extended type does not itself define any attributes, the 
attributes of the base type are not included in the serialized XML stream.

After running the Axis client in the debugger, I noticed the following:

The getObjectAttributes method of org.apache.axis.encoding.ser.BeanSerializer 
contains this check:

        if (typeDesc == null || !typeDesc.hasAttributes())
            return attributes;

The hasAttributes method of org.apache.axis.description.TypeDesc just checks if 
the current bean class has any attributes defined, but does not check for 
attributes in any of its parent classes.

I then made this change to the hasAttributes method, which seems to fix the 
problem:

    public boolean hasAttributes() {
        if (_hasAttributes) {
            return true;
        }
        else {
            // check superclasses if they exist
            Class cls = javaClass.getSuperclass();
            if (cls != null && !cls.getName().startsWith("java.")) {
                TypeDesc superDesc = getTypeDescForClass(cls);
                if (superDesc != null && superDesc.hasAttributes()) {
                    return true;
                }
            }
        }
        return false;
    }



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira

Reply via email to