[
http://issues.apache.org/jira/browse/AXIS2-330?page=comments#action_12361504 ]
Eran Chinthaka commented on AXIS2-330:
--------------------------------------
Hi,
I checked this and wrote this small sample to test what you are mentioning.
OMFactory factory = OMAbstractFactory.getOMFactory();
OMElement firstElement = factory.createOMElement("FirstElement", null);
OMText text = factory.createText(firstElement, "Sample Text");
System.out.println("firstElement = " + firstElement);
firstElement.setText("Some other text");
System.out.println("firstElement = " + firstElement);
This gives the desired output as follows.
firstElement = <FirstElement>Sample Text</FirstElement>
firstElement = <FirstElement>Some other text</FirstElement>
The way we handle the setText method is that, when you call that method on an
element, that will replace existing texts in OMElement.
Sorry if I understood the problem you are mentioning here, wrong. Like to have
either a test case or some more explanation on this.
> Calling setText on an OMElement whose only child is an OMTextImpl
> concatenates rather than replaces
> ---------------------------------------------------------------------------------------------------
>
> Key: AXIS2-330
> URL: http://issues.apache.org/jira/browse/AXIS2-330
> Project: Apache Axis 2.0 (Axis2)
> Type: Bug
> Components: core
> Versions: 0.93
> Reporter: Craig Chaney
>
> The first time you call setText() on an OMElement that has no children, the
> data structure setup is slightly incorrect. The previousSibling field of the
> OMTextImpl points back to itself (i.e. the same OMTextImpl instance).
> Then, when calling setText() again, the logic that removes all other text
> children doesn't account for this, and the end result is that the old
> OMTextImpl still exists in the linked list of children. So on the wire, both
> text elements appear, the second one appended to the first one.
--
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