You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by "Boris Milanov (JIRA)" <ji...@apache.org> on 2008/04/16 16:49:21 UTC

[jira] Created: (WSCOMMONS-323) XML Element lost when there is an OMException inside OMChildrenIterator.next()

XML Element lost when there is an OMException inside OMChildrenIterator.next()
------------------------------------------------------------------------------

                 Key: WSCOMMONS-323
                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-323
             Project: WS-Commons
          Issue Type: Bug
          Components: AXIOM
         Environment: Windows
            Reporter: Boris Milanov


I have this sample xml part (which is intentionally incorrect, containing duplicate attribute at third level):

<Body>
    <Function>
        <Parameter attr='a' attr='a'>
            <abc/>
        </Parameter>
    </Function>
</Body>

So I generate an OMElement and try to serialize it using:

		String xml="<Body><Function><Parameter attr='a' attr='a'><abc/></Parameter></Function></Body>";
		ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes());
		XMLStreamReader parser;
		try {
			parser = XMLInputFactory.newInstance().createXMLStreamReader(bais);
		} catch (XMLStreamException e) {
			// TODO Auto-generated catch block
		} catch (FactoryConfigurationError e) {
			// TODO Auto-generated catch block
		}
		StAXOMBuilder builder = new StAXOMBuilder(parser);
		OMElement bodyElement = builder.getDocumentElement();		
		bodyElement.serialize(System.out);

... but instead of receiving a duplicate attribute exception (which should probably happen in this case), I get the following output:

<Body>
    <Function>
        <abc />
    </Function>
</Body>

The child element of <Parameter> has become a child element of its parent.
Is this behaviour correct?

Note: This bug may be related to this JIRA: http://issues.apache.org/jira/browse/WSCOMMONS-91. I looked at the AXIOM 1.2.5 source and it seems that the exception is actually thrown inside OMChildrenIterator.next(), but it is caught and a flag is set: isExceptionThrownInAdvancingToNextElement = true.


-- 
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: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org


[jira] Updated: (WSCOMMONS-323) XML Element lost when there is an OMException inside OMChildrenIterator.next()

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

Andreas Veithen updated WSCOMMONS-323:
--------------------------------------

    Fix Version/s: Axiom 1.2.8
         Assignee: Andreas Veithen

> XML Element lost when there is an OMException inside OMChildrenIterator.next()
> ------------------------------------------------------------------------------
>
>                 Key: WSCOMMONS-323
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-323
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>         Environment: Windows
>            Reporter: Boris Milanov
>            Assignee: Andreas Veithen
>             Fix For: Axiom 1.2.8
>
>
> I have this sample xml part (which is intentionally incorrect, containing duplicate attribute at third level):
> <Body>
>     <Function>
>         <Parameter attr='a' attr='a'>
>             <abc/>
>         </Parameter>
>     </Function>
> </Body>
> So I generate an OMElement and try to serialize it using:
> 		String xml="<Body><Function><Parameter attr='a' attr='a'><abc/></Parameter></Function></Body>";
> 		ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes());
> 		XMLStreamReader parser;
> 		try {
> 			parser = XMLInputFactory.newInstance().createXMLStreamReader(bais);
> 		} catch (XMLStreamException e) {
> 			// TODO Auto-generated catch block
> 		} catch (FactoryConfigurationError e) {
> 			// TODO Auto-generated catch block
> 		}
> 		StAXOMBuilder builder = new StAXOMBuilder(parser);
> 		OMElement bodyElement = builder.getDocumentElement();		
> 		bodyElement.serialize(System.out);
> ... but instead of receiving a duplicate attribute exception (which should probably happen in this case), I get the following output:
> <Body>
>     <Function>
>         <abc />
>     </Function>
> </Body>
> The child element of <Parameter> has become a child element of its parent.
> Is this behaviour correct?
> Note: This bug may be related to this JIRA: http://issues.apache.org/jira/browse/WSCOMMONS-91. I looked at the AXIOM 1.2.5 source and it seems that the exception is actually thrown inside OMChildrenIterator.next(), but it is caught and a flag is set: isExceptionThrownInAdvancingToNextElement = true.

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


[jira] Resolved: (WSCOMMONS-323) XML Element lost when there is an OMException inside OMChildrenIterator.next()

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

Andreas Veithen resolved WSCOMMONS-323.
---------------------------------------

    Resolution: Fixed

With the latest code from trunk, your example will now throw an exception reporting the duplicate attribute as expected. Your comment about WSCOMMONS-91 confirms my analysis in WSCOMMONS-372 and this situation has now been fixed.


> XML Element lost when there is an OMException inside OMChildrenIterator.next()
> ------------------------------------------------------------------------------
>
>                 Key: WSCOMMONS-323
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-323
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>         Environment: Windows
>            Reporter: Boris Milanov
>            Assignee: Andreas Veithen
>             Fix For: Axiom 1.2.8
>
>
> I have this sample xml part (which is intentionally incorrect, containing duplicate attribute at third level):
> <Body>
>     <Function>
>         <Parameter attr='a' attr='a'>
>             <abc/>
>         </Parameter>
>     </Function>
> </Body>
> So I generate an OMElement and try to serialize it using:
> 		String xml="<Body><Function><Parameter attr='a' attr='a'><abc/></Parameter></Function></Body>";
> 		ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes());
> 		XMLStreamReader parser;
> 		try {
> 			parser = XMLInputFactory.newInstance().createXMLStreamReader(bais);
> 		} catch (XMLStreamException e) {
> 			// TODO Auto-generated catch block
> 		} catch (FactoryConfigurationError e) {
> 			// TODO Auto-generated catch block
> 		}
> 		StAXOMBuilder builder = new StAXOMBuilder(parser);
> 		OMElement bodyElement = builder.getDocumentElement();		
> 		bodyElement.serialize(System.out);
> ... but instead of receiving a duplicate attribute exception (which should probably happen in this case), I get the following output:
> <Body>
>     <Function>
>         <abc />
>     </Function>
> </Body>
> The child element of <Parameter> has become a child element of its parent.
> Is this behaviour correct?
> Note: This bug may be related to this JIRA: http://issues.apache.org/jira/browse/WSCOMMONS-91. I looked at the AXIOM 1.2.5 source and it seems that the exception is actually thrown inside OMChildrenIterator.next(), but it is caught and a flag is set: isExceptionThrownInAdvancingToNextElement = true.

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