You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Guillaume Nodet (JIRA)" <ji...@apache.org> on 2006/07/25 17:37:23 UTC

[jira] Resolved: (SM-498) StaxSource: Bug in parse() method for character streams

     [ https://issues.apache.org/activemq/browse/SM-498?page=all ]

Guillaume Nodet resolved SM-498.
--------------------------------

    Fix Version/s: 3.0-M3
       Resolution: Fixed
         Assignee: Guillaume Nodet

Author: gnodet
Date: Tue Jul 25 08:34:53 2006
New Revision: 425425

URL: http://svn.apache.org/viewvc?rev=425425&view=rev
Log:
SM-498: StaxSource: Bug in parse() method for character streams

Modified:
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/jaxp/StaxSource.java
    incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/jaxp/StaxSourceTest.java
    incubator/servicemix/trunk/servicemix-core/src/test/resources/org/apache/servicemix/jbi/jaxp/test.xml



> 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
>         Assigned To: Guillaume Nodet
>             Fix For: 3.0-M3
>
>
> 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