You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2003/05/15 17:58:50 UTC

DO NOT REPLY [Bug 19956] New: - SAAJ SOAPBody.getChildElements faulty implementation

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19956>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19956

SAAJ SOAPBody.getChildElements faulty implementation

           Summary: SAAJ SOAPBody.getChildElements faulty implementation
           Product: Axis
           Version: current (nightly)
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Basic Architecture
        AssignedTo: axis-dev@ws.apache.org
        ReportedBy: kevinj@develop.com


the org.apache.axis.message.SOAPBody implementation of getChildElements(Name
name) is faulty. The code looks like this

    public java.util.Iterator getChildElements(Name name) {
        Vector v = new Vector();
        Enumeration e = bodyElements.elements();
        SOAPElement bodyEl;
        while (e.hasMoreElements()) {
            bodyEl = (SOAPElement)e.nextElement();
            if (bodyEl.getElementName().equals(name)) {
                v.addElement(bodyEl);
            }
        }
        return v.iterator();
    }

It calls equals on the name object. Unfortunately the equals method doesn't do
what you want. The implementation of Name is a PrefixedQName and it's equals
method compares prefixes as well as URIs and Names, this is invalid for
getChildElements when all you need to compare are the local names and namespace
URIs.

SOAPBody extends MessageElement which also has a getChildElements(Name) method
that has the correct implementation so the simplest fix would be to remove the
getChildElement override from SOAPBody