You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2013/01/14 20:35:30 UTC

svn commit: r1433073 - /webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java

Author: veithen
Date: Mon Jan 14 19:35:29 2013
New Revision: 1433073

URL: http://svn.apache.org/viewvc?rev=1433073&view=rev
Log:
Instead of directly calling next() on the builder, just let the OM handle that.

Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java?rev=1433073&r1=1433072&r2=1433073&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java Mon Jan 14 19:35:29 2013
@@ -959,8 +959,10 @@ class SwitchingWrapper extends AbstractX
      * @return first child or null
      */
     private OMNode _getFirstChild(OMContainer node) {
-        // TODO: We have a problem if the tree has parts constructed by different builders; this is related to AXIOM-201 and AXIOM-431
-        if (node.getBuilder() != _root.getBuilder()) {
+        if (cache) {
+            return node.getFirstOMChild();
+        } else if (node.getBuilder() != _root.getBuilder()) {
+            // TODO: We have a problem if the tree has parts constructed by different builders; this is related to AXIOM-201 and AXIOM-431
             OMNode first = node.getFirstOMChild();
             OMNode sibling = first;
             while (sibling != null) {
@@ -977,7 +979,7 @@ class SwitchingWrapper extends AbstractX
      * @return next sibling or null
      */
     private OMNode getNextSibling(OMNode node) {
-        if (isOMSourcedElement(node)) {
+        if (cache || isOMSourcedElement(node)) {
             return node.getNextOMSibling();
         } else {
             return ((OMNodeEx) node).getNextOMSiblingIfAvailable();
@@ -994,16 +996,6 @@ class SwitchingWrapper extends AbstractX
     }
 
     /**
-     * This is a very special method. This allows the navigator to step once it has reached the
-     * existing OM. At this point the isNavigable method will return false but the isComplete method
-     * may return false which means that the navigating the given element is not complete and the
-     * navigator cannot proceed.
-     */
-    private void step() {
-        updateNextNode();
-    }
-
-    /**
      * Returns the navigable status.
      *
      * @return Returns boolean.
@@ -1029,10 +1021,6 @@ class SwitchingWrapper extends AbstractX
             case NAVIGABLE:
                 if (isNavigable()) {
                     lastNode = getNext();
-                } else if (cache) {
-                    builder.next();
-                    step();
-                    lastNode = getNext();
                 } else {
                     // reset caching (the default is ON so it was not needed in the
                     // earlier case!