[ https://issues.apache.org/jira/browse/WSCOMMONS-449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andreas Veithen updated WSCOMMONS-449: -------------------------------------- Description: OMDocument#serializeAndConsume doesn't consume the document but instead fully builds it. This is caused by the following piece of code: while (children.hasNext()) { OMNodeEx omNode = (OMNodeEx) children.next(); omNode.internalSerializeAndConsume(writer); } As described in WSCOMMONS-346, the call to Iterator#next() actually builds the returned node, so that the call to internalSerializeAndConsume has the same effect as serialization with caching enabled. This means that the code fully builds the document. Note that the code actually doesn't make sense because once a child (in particular the document element) has been consumed, it is not possible to retrieve the next sibling. This means that even if WSCOMMONS-346 is solved, the code still wouldn't behave as expected. Worse, it would trigger an exception. was: OMDocument#serializeAndConsume doesn't consume the document but instead fully builds it. This is caused by the following piece of code: while (children.hasNext()) { OMNodeEx omNode = (OMNodeEx) children.next(); omNode.internalSerializeAndConsume(writer); } As described in WSCOMMONS-346, the call to Iterator#next() actually builds the returned node, so that the call to internalSerializeAndConsume has the same effect as serialization with caching enabled. This means that the code fully builds the document. Note that the code actually doesn't make sense because once a child (in particular the document element) has been consumed, it is not possible to retrieve the next sibling. This means that even if WSCOMMONS-346 is solved, to code still wouldn't behave as expected. Worse, it would trigger an exception. > OMDocument#serializeAndConsume doesn't consume the document > ----------------------------------------------------------- > > Key: WSCOMMONS-449 > URL: https://issues.apache.org/jira/browse/WSCOMMONS-449 > Project: WS-Commons > Issue Type: Bug > Components: AXIOM > Affects Versions: Axiom 1.2.8 > Reporter: Andreas Veithen > Priority: Minor > > OMDocument#serializeAndConsume doesn't consume the document but instead fully > builds it. > This is caused by the following piece of code: > while (children.hasNext()) { > OMNodeEx omNode = (OMNodeEx) children.next(); > omNode.internalSerializeAndConsume(writer); > } > As described in WSCOMMONS-346, the call to Iterator#next() actually builds > the returned node, so that the call to internalSerializeAndConsume has the > same effect as serialization with caching enabled. This means that the code > fully builds the document. > Note that the code actually doesn't make sense because once a child (in > particular the document element) has been consumed, it is not possible to > retrieve the next sibling. This means that even if WSCOMMONS-346 is solved, > the code still wouldn't behave as expected. Worse, it would trigger an > exception. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.