You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by Holger <ho...@atosorigin.com> on 2006/07/25 15:47:21 UTC

Bug in StaxSource class

We are playing around with servicemix and the jsr181 component when we run
into a strange problem. We are sending a SOAP request to a defined Service
by the jsr181 component with a long parameter value inside. The strange
thing is that the parameter value won't be send correctly to the NMR.
Instead the value is repeated several times for the first 1024 characters.
We took a look in your source files and found the responsible location for
that behaviour. It looks like there's a bug in the class
org.apache.servicemix.jbi.jaxp.StaxSource, line 66:


    protected void parse() throws SAXException {
        try {
            contentHandler.startDocument();
            while (true) {
                switch (streamReader.getEventType()) {
                case XMLStreamConstants.ATTRIBUTE:
                case XMLStreamConstants.CDATA:
                    break;
                case XMLStreamConstants.CHARACTERS:
                    if (!streamReader.isWhiteSpace()) {
                        for (int textLength = streamReader.getTextLength();
textLength > 0; textLength -= chars.length) {
                            int l = Math.min(textLength, chars.length);
==>                      streamReader.getTextCharacters(0, chars, 0, l);
                            contentHandler.characters(chars, 0, l);
                        }
                    }
                    break;

The first parameter of the method XMLStreamReader.getTextCharacters()
defines the sourceStart (index of the first character in the source array to
copy) parameter. In your  implementation this value is 0 every time. That's
the reason why we run into our problem...

-- 
View this message in context: http://www.nabble.com/Bug-in-StaxSource-class-tf1998365.html#a5485611
Sent from the ServiceMix - Dev forum at Nabble.com.


Re: Bug in StaxSource class

Posted by Holger <ho...@atosorigin.com>.
Ok, i raised a JIRA #SM-498
-- 
View this message in context: http://www.nabble.com/Bug-in-StaxSource-class-tf1998365.html#a5487080
Sent from the ServiceMix - Dev forum at Nabble.com.


Re: Bug in StaxSource class

Posted by Guillaume Nodet <gn...@gmail.com>.
Could you please raise a JIRA and attach any patch / test case you have,
please ?

Cheers,
Guillaume Nodet

On 7/25/06, Holger <ho...@atosorigin.com> wrote:
>
>
> We are playing around with servicemix and the jsr181 component when we run
> into a strange problem. We are sending a SOAP request to a defined Service
> by the jsr181 component with a long parameter value inside. The strange
> thing is that the parameter value won't be send correctly to the NMR.
> Instead the value is repeated several times for the first 1024 characters.
> We took a look in your source files and found the responsible location for
> that behaviour. It looks like there's a bug in the class
> org.apache.servicemix.jbi.jaxp.StaxSource, line 66:
>
>
>     protected void parse() throws SAXException {
>         try {
>             contentHandler.startDocument();
>             while (true) {
>                 switch (streamReader.getEventType()) {
>                 case XMLStreamConstants.ATTRIBUTE:
>                 case XMLStreamConstants.CDATA:
>                     break;
>                 case XMLStreamConstants.CHARACTERS:
>                     if (!streamReader.isWhiteSpace()) {
>                         for (int textLength = streamReader.getTextLength
> ();
> textLength > 0; textLength -= chars.length) {
>                             int l = Math.min(textLength, chars.length);
> ==>                      streamReader.getTextCharacters(0, chars, 0, l);
>                             contentHandler.characters(chars, 0, l);
>                         }
>                     }
>                     break;
>
> The first parameter of the method XMLStreamReader.getTextCharacters()
> defines the sourceStart (index of the first character in the source array
> to
> copy) parameter. In your  implementation this value is 0 every time.
> That's
> the reason why we run into our problem...
>
> --
> View this message in context:
> http://www.nabble.com/Bug-in-StaxSource-class-tf1998365.html#a5485611
> Sent from the ServiceMix - Dev forum at Nabble.com.
>
>