StaxSource: Bug in parse() method for character streams
-------------------------------------------------------

                 Key: SM-498
                 URL: https://issues.apache.org/activemq/browse/SM-498
             Project: ServiceMix
          Issue Type: Bug
          Components: servicemix-core
    Affects Versions: incubation
            Reporter: Holger Bethke


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... 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to