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 "Davanum Srinivas (JIRA)" <ax...@ws.apache.org> on 2005/06/10 15:50:51 UTC

[jira] Assigned: (AXIS-2029) SOAPHeader.appendChild() throws unexpected ClassCastException

     [ http://issues.apache.org/jira/browse/AXIS-2029?page=all ]

Davanum Srinivas reassigned AXIS-2029:
--------------------------------------

    Assign To: Ashutosh Shahi

> SOAPHeader.appendChild() throws unexpected ClassCastException
> -------------------------------------------------------------
>
>          Key: AXIS-2029
>          URL: http://issues.apache.org/jira/browse/AXIS-2029
>      Project: Axis
>         Type: Bug
>   Components: Basic Architecture, SAAJ
>     Versions: 1.2
>  Environment: Windows XP Pro/WebSphere 4.0
>     Reporter: Mark Tye
>     Assignee: Ashutosh Shahi
>  Attachments: 2029.diff
>
> The class org.apache.axis.message.SOAPHeader overrides the appendChild(org.w3c.dom.Node) method of org.apache.axis.message.NodeImpl in such a way that it breaks the contract of the org.3c.dom.Node.appendChild(org.w3c.dom.Node) interface.
> Here's the implementation of appendChild(Node) in SOAPHeader:
> 390    public Node appendChild(Node newChild) throws DOMException {
> 391        SOAPHeaderElement headerElement = null;
> 392        if(newChild instanceof SOAPHeaderElement)
> 393            headerElement = (SOAPHeaderElement)newChild;
> 394        else 
> 395            headerElement = new SOAPHeaderElement((Element)newChild);
> 396        try {
> 397            addChildElement(headerElement);
> 398        } catch (SOAPException e) {
> 399            throw new DOMException(DOMException.INVALID_STATE_ERR,e.toString());
> 400        }
> 401        return headerElement;
> 402    }
> This works fine if the newChild Node parameter is an instance of SOAPHeaderElement or org.w3c.dom.Element, but any other subclass of Node will cause a ClassCastException to be thrown at line 395.
> It's reasonable to expect that in most cases, the Node being appended to a SOAP Header will be DOM Element representing a header entry. However, there is no prohibition in the SOAP 1.1 Note or the SOAP 1.2 Recommendation against whitespace before, after, or in between the header entries of a SOAP Header. Some parsers will render such whitespace as Text nodes, which will cause a ClassCastException in the appendChild() method.
> Even if a deliberate design decision has been made not to support whitespace in the SOAPHeader class, the appendChild(Node) method should probably do something more elegant than throw a ClassCastException if the Node parameter is a Text node containing whitespace.

-- 
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
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira