POJO Properties can be duplicated in WSDL if abstract method is overridden
--------------------------------------------------------------------------

                 Key: XFIRE-786
                 URL: http://jira.codehaus.org/browse/XFIRE-786
             Project: XFire
          Issue Type: Bug
          Components: Aegis Module
    Affects Versions: 1.2.3
            Reporter: Andrew Kerr
         Assigned To: Dan Diephouse
            Priority: Minor


Consider the following example:

public class A
{
    public abstract String getSomething();
}

public class B
{
    public String getSomething() { return "whatever"; }
}

If this class is used in a web service that has overrideTypesList configured, 
etc., the WSDL generated by XFire will include the "something" property twice; 
once in class A's definition, and once in class B's.

The problem is with this code in 
org.codehaus.xfire.aegis.type.basic.BeanType.writeSchema:

                if (pd.getReadMethod().getDeclaringClass() != 
info.getTypeClass())
                {
                    continue;
                }
                
getDeclaringClass() returns A when called on class A, and B on class B, so the 
property is repeated in both definitions.

As a stopgap, I added the following code directly after:

                // Comparing against the read method's declaring class
                // isn't always enough.  For example, we could be overriding
                // an abstract method in the superclass.
                try
                {
                        
info.getTypeClass().getSuperclass().getMethod(pd.getReadMethod().getName(), 
pd.getReadMethod().getParameterTypes());
                        log.debug("Method already exists in superclass!");
                        continue;
                }
                catch (NoSuchMethodException e)
                {
                        // This is ok...
                }

Note that there may be a better way to do this, but I couldn't find anything in 
the reflection API...



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to