[ https://issues.apache.org/jira/browse/AXIS-2029?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andreas Veithen updated AXIS-2029: ---------------------------------- Labels: dom-compatibility (was: ) > SOAPHeader.appendChild() throws unexpected ClassCastException > ------------------------------------------------------------- > > Key: AXIS-2029 > URL: https://issues.apache.org/jira/browse/AXIS-2029 > Project: Axis > Issue Type: Bug > Components: Basic Architecture, SAAJ > Affects Versions: 1.2 > Environment: Windows XP Pro/WebSphere 4.0 > Reporter: Mark Tye > Assignee: Ashutosh Shahi > Labels: dom-compatibility > 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, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscr...@axis.apache.org For additional commands, e-mail: java-dev-h...@axis.apache.org