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 "Rich Scheuerle (JIRA)" <ji...@apache.org> on 2008/02/04 22:53:10 UTC

[jira] Resolved: (WSCOMMONS-301) OMSourcedElement.buildWithAttachments results in inproper expansion

     [ https://issues.apache.org/jira/browse/WSCOMMONS-301?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rich Scheuerle resolved WSCOMMONS-301.
--------------------------------------

    Resolution: Fixed

Committed Revision: 618452

> OMSourcedElement.buildWithAttachments results in inproper expansion
> -------------------------------------------------------------------
>
>                 Key: WSCOMMONS-301
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-301
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>            Reporter: Rich Scheuerle
>            Assignee: Rich Scheuerle
>
> Background:
> -----------------
> OMSourcedElement has either a backing object (OMDataSource) or is a normal OM tree.
> When build() or buildWithAttachments() is called, the OMElement should respond by building its contents from the Builder.
> Problem:
> -------------
> The current implementation of OMSE.buildWithAttachments() causes the OM tree to be unnecessarily expanded.
> The current code is:
> public void buildWithAttachments() {
>         
>         // If not done, force the parser to build the elements
>         if (!done) {
>             this.build();
>         }
>         
>             Iterator iterator = getChildren();
>             while (iterator.hasNext()) {
>                 OMNode node = (OMNode) iterator.next();
>                 node.buildWithAttachments();
>             }
>     
>     }
> Solution:
> ------------
> Iterating over the children is causing the expansion.  This should only be performed if the OMSourcedElement is in an expanded state.
> A validating unit test will be provided with the code change.
> public void buildWithAttachments() {
>         
>         // If not done, force the parser to build the elements
>         if (!done) {
>             this.build();
>         }
>         
>         // If the OMSourcedElement is in in expanded form, then
>         // walk the descendents to make sure they are built. 
>         // If the OMSourcedElement is backed by a OMDataSource,
>         // we don't want to walk the children (because this will result
>         // in an unnecessary translation from OMDataSource to a full OM tree).
>         if (isExpanded()) {
>             Iterator iterator = getChildren();
>             while (iterator.hasNext()) {
>                 OMNode node = (OMNode) iterator.next();
>                 node.buildWithAttachments();
>             }
>         }
>     }
> Kudos:
> ----------
> Thanks to Dan Zhong of the IBM performance team who found this problem during Sandesha testing.

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