[ 
https://issues.apache.org/jira/browse/WSCOMMONS-340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12620569#action_12620569
 ] 

Chris Borrill commented on WSCOMMONS-340:
-----------------------------------------

I have attached a junit class which demonstrates this problem.  It contains two 
tests, one calls getTextCharacters() to get the comment (fails) and one calls 
getText() (succeeds).

Two execute this junit drop into the directory:

axiom-1.2.6\modules\axiom-tests\src\test\java\org\apache\axiom\om\impl\llom

The javadoc for the interface javax.xml.stream.XMLStreamReader

http://java.sun.com/javase/6/docs/api/javax/xml/stream/XMLStreamReader.html

which contains getTextCharacters() and getText(), clearly says that getText() 
can be used to get a comment, but the javadoc for getTextCharacters() does not 
mention comments.  If it is valid to use getTextCharacters() to obtain a 
comment, then this is definitely a bug in Axiom, which can easily be fix by 
changing the implemention of the method 
org.apache.axiom.om.impl.OMStaxWrapper.getTextCharacters()  to:

    public char[] getTextCharacters() {
        return getText().toCharArray();
    }



> Error calling getTextCharacters() on a comment node
> ---------------------------------------------------
>
>                 Key: WSCOMMONS-340
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-340
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>            Reporter: Stephen Duncan Jr
>            Priority: Critical
>
> When using Axiom to parse a SOAP message with comments inside an element, I 
> got the following error:
> java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMCommentImpl 
> cannot be cast to org.apache.axiom.om.OMText
>         at 
> org.apache.axiom.om.impl.llom.OMStAXWrapper.getTextCharacters(OMStAXWrapper.java:403)
>  
> This was while using the Spring WebServices Framework with Axiom, so you can 
> see the initial report there that indicates this is a bug in Axiom: 
> http://jira.springframework.org/browse/SWS-347

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to