You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Brian Murray (JIRA)" <ji...@apache.org> on 2007/11/29 23:07:43 UTC

[jira] Created: (AXIS2-3376) XmlStreamParser in RMI module can encounter problems with nesting

XmlStreamParser in RMI module can encounter problems with nesting
-----------------------------------------------------------------

                 Key: AXIS2-3376
                 URL: https://issues.apache.org/jira/browse/AXIS2-3376
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: modules
            Reporter: Brian Murray


The XmlStreamParser in the RMI module does not support nesting when the subelement has the same namespace URI and name as the parent element.  The parser currently makes assumptions based on the name of the current tag and errs when the folllowing is encountered:  </param1></param1>.  I will provide a failing test case in a patch.  I will also provide another patch with the failing test case and a correction to XmlStreamParser.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Assigned: (AXIS2-3376) XmlStreamParser in RMI module can encounter problems with nesting

Posted by "Rich Scheuerle (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3376?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rich Scheuerle reassigned AXIS2-3376:
-------------------------------------

    Assignee: Rich Scheuerle

> XmlStreamParser in RMI module can encounter problems with nesting
> -----------------------------------------------------------------
>
>                 Key: AXIS2-3376
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3376
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: modules
>            Reporter: Brian Murray
>            Assignee: Rich Scheuerle
>         Attachments: 3376.patch, test.patch
>
>
> The XmlStreamParser in the RMI module does not support nesting when the subelement has the same namespace URI and name as the parent element.  The parser currently makes assumptions based on the name of the current tag and errs when the folllowing is encountered:  </param1></param1>.  I will provide a failing test case in a patch.  I will also provide another patch with the failing test case and a correction to XmlStreamParser.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Resolved: (AXIS2-3376) XmlStreamParser in RMI module can encounter problems with nesting

Posted by "Rich Scheuerle (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3376?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rich Scheuerle resolved AXIS2-3376.
-----------------------------------

    Resolution: Fixed

Committed revision 600634.

> XmlStreamParser in RMI module can encounter problems with nesting
> -----------------------------------------------------------------
>
>                 Key: AXIS2-3376
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3376
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: modules
>            Reporter: Brian Murray
>            Assignee: Rich Scheuerle
>         Attachments: 3376.patch, test.patch
>
>
> The XmlStreamParser in the RMI module does not support nesting when the subelement has the same namespace URI and name as the parent element.  The parser currently makes assumptions based on the name of the current tag and errs when the folllowing is encountered:  </param1></param1>.  I will provide a failing test case in a patch.  I will also provide another patch with the failing test case and a correction to XmlStreamParser.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-3376) XmlStreamParser in RMI module can encounter problems with nesting

Posted by "Brian Murray (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3376?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brian Murray updated AXIS2-3376:
--------------------------------

    Attachment: 3376.patch

The following alterations were made in this patch:
*  Introduce a StatefulXmlStreamReader.  Currently the only state being maintained is the depth within the XML file.  However, also added is a safeguard that prevents mismatching end and start tags.  When troubleshooting the problem I noted that when the error occurred, the parser would continue but would mismatch elements without sensing that it was doing so.
*  Use the StatefulXmlStreamReader and note that we are not consuming end tags that belong at a higher level.

Also - I was unsure of the preconditions I could expect (there were four public methods that passed in XmlStreamReaders) so I left the patch unchanged in the event that parsing was partially underway (and the Reader had been advanced) prior to these methods being called.

> XmlStreamParser in RMI module can encounter problems with nesting
> -----------------------------------------------------------------
>
>                 Key: AXIS2-3376
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3376
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: modules
>            Reporter: Brian Murray
>         Attachments: 3376.patch, test.patch
>
>
> The XmlStreamParser in the RMI module does not support nesting when the subelement has the same namespace URI and name as the parent element.  The parser currently makes assumptions based on the name of the current tag and errs when the folllowing is encountered:  </param1></param1>.  I will provide a failing test case in a patch.  I will also provide another patch with the failing test case and a correction to XmlStreamParser.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-3376) XmlStreamParser in RMI module can encounter problems with nesting

Posted by "Rich Scheuerle (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-3376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12547899 ] 

Rich Scheuerle commented on AXIS2-3376:
---------------------------------------

Summary of the problem:

If the xml being parsed has nested elements of the same name, the XmlStreamParser gets confused.

Here is an example message:

<Param1>
    <ns1:param2 xmlns:ns1="urn:org.apache.axis2.rmi.databind.dto">
        <ns1:param4>test String</ns1:param4>
        <ns1:param3>3.0</ns1:param3>
        <ns1:param2>45.6</ns1:param2>
        <ns1:param1>2</ns1:param1>
    </ns1:param2>
    <ns2:param1 xmlns:ns2="urn:org.apache.axis2.rmi.databind.dto">
        <ns2:param4>5.56</ns2:param4>
        <ns2:param3>test String</ns2:param3>
        <ns2:param2>2</ns2:param2>
        <ns2:param2>3</ns2:param2>
        <ns2:param1>5</ns2:param1>
        <ns2:param1>6</ns2:param1>      <------------------ Note Nested element param1
    </ns2:param1>                                       <------------------ Followed by outer element param1
    <ns3:param1 xmlns:ns3="urn:org.apache.axis2.rmi.databind.dto" xmlns:ns4="http://www.w3.org/2001/XMLSchema-instance" ns4:nil="1" />
    <ns5:param1 xmlns:ns5="urn:org.apache.axis2.rmi.databind.dto">
        <ns5:param4>5.56</ns5:param4>
        <ns5:param3>test String</ns5:param3>
        <ns5:param2>2</ns5:param2>
        <ns5:param2>3</ns5:param2>
        <ns5:param1>5</ns5:param1>
        <ns5:param1>6</ns5:param1>
    </ns5:param1>
</Param1>


In XmlStreamParser, line223 where this error is one place that this is occurring.  Note that this will premature advance the parser because it has the same name.

                    // if the reader is at the end of this elementField
                    // then we move it to next element.
                    if (reader.isEndElement() && reader.getName().equals(elementFieldQName)){
                        reader.next();
                    }

Brian's solution is to wrap the parser in a lightweidht XMLStreamReader that simply provides the depth stack.  Then XmlStreamParser has sufficient information to properly know when to call next:

if (reader.isEndElement() && reader.getName().equals(parameterQName)){
                  if (reader.isEndElement() && reader.getName().equals(parameterQName)
                         && (readerPriorAccess || reader.getDepth() == startDepth - 1)){
                     reader.next();
                 }

I don't necessarily like the name "Stateful" XmlReader is simply the name he chose to name this XMLStreamReader that exposes the depth stack.

Brian has supplied a testcase that demonstrates the error...plus the fix.  I will integrate this code after I complete some more testing

> XmlStreamParser in RMI module can encounter problems with nesting
> -----------------------------------------------------------------
>
>                 Key: AXIS2-3376
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3376
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: modules
>            Reporter: Brian Murray
>            Assignee: Rich Scheuerle
>         Attachments: 3376.patch, test.patch
>
>
> The XmlStreamParser in the RMI module does not support nesting when the subelement has the same namespace URI and name as the parent element.  The parser currently makes assumptions based on the name of the current tag and errs when the folllowing is encountered:  </param1></param1>.  I will provide a failing test case in a patch.  I will also provide another patch with the failing test case and a correction to XmlStreamParser.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-3376) XmlStreamParser in RMI module can encounter problems with nesting

Posted by "Brian Murray (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3376?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brian Murray updated AXIS2-3376:
--------------------------------

    Attachment: test.patch

Attached is the test case that fails.

> XmlStreamParser in RMI module can encounter problems with nesting
> -----------------------------------------------------------------
>
>                 Key: AXIS2-3376
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3376
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: modules
>            Reporter: Brian Murray
>         Attachments: test.patch
>
>
> The XmlStreamParser in the RMI module does not support nesting when the subelement has the same namespace URI and name as the parent element.  The parser currently makes assumptions based on the name of the current tag and errs when the folllowing is encountered:  </param1></param1>.  I will provide a failing test case in a patch.  I will also provide another patch with the failing test case and a correction to XmlStreamParser.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-3376) XmlStreamParser in RMI module can encounter problems with nesting

Posted by "Brian Murray (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-3376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12547888 ] 

Brian Murray commented on AXIS2-3376:
-------------------------------------

Hi Amila,

I'm not working with RMI specifically.  I was building Axis2 with an alternative JVM and ran across this issue in an existing test case.  (The order in which the child elements were serialized by that JVM caused the </param1></param1> sequence to occur for the test case.)  However, the error itself is not JVM specific as the provided test case shows.

Do you mean that you had provided the RMI XmlStreamParser some time ago, or that you had provided a fix similar to this one some time ago?



> XmlStreamParser in RMI module can encounter problems with nesting
> -----------------------------------------------------------------
>
>                 Key: AXIS2-3376
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3376
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: modules
>            Reporter: Brian Murray
>            Assignee: Rich Scheuerle
>         Attachments: 3376.patch, test.patch
>
>
> The XmlStreamParser in the RMI module does not support nesting when the subelement has the same namespace URI and name as the parent element.  The parser currently makes assumptions based on the name of the current tag and errs when the folllowing is encountered:  </param1></param1>.  I will provide a failing test case in a patch.  I will also provide another patch with the failing test case and a correction to XmlStreamParser.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-3376) XmlStreamParser in RMI module can encounter problems with nesting

Posted by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-3376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12547749 ] 

Amila Chinthaka Suriarachchi commented on AXIS2-3376:
-----------------------------------------------------

hi Brain are you working with RMI? This is something I did sometimes back and seems someone does not using it.

> XmlStreamParser in RMI module can encounter problems with nesting
> -----------------------------------------------------------------
>
>                 Key: AXIS2-3376
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3376
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: modules
>            Reporter: Brian Murray
>            Assignee: Rich Scheuerle
>         Attachments: 3376.patch, test.patch
>
>
> The XmlStreamParser in the RMI module does not support nesting when the subelement has the same namespace URI and name as the parent element.  The parser currently makes assumptions based on the name of the current tag and errs when the folllowing is encountered:  </param1></param1>.  I will provide a failing test case in a patch.  I will also provide another patch with the failing test case and a correction to XmlStreamParser.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org