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 19:31:40 UTC

svn commit: r1433027 - /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 18:31:40 2013
New Revision: 1433027

URL: http://svn.apache.org/viewvc?rev=1433027&view=rev
Log:
Simple refactoring that makes the code easier to understand because it shows how updateNextNode calculates the next node based on the current node.

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=1433027&r1=1433026&r2=1433027&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 18:31:40 2013
@@ -900,20 +900,21 @@ class SwitchingWrapper extends AbstractX
     
     /** Private method to encapsulate the searching logic. */
     private void updateNextNode() {
-        if (!isLeaf(_next) && !_visited) {
-            OMNode firstChild = _getFirstChild((OMContainer) _next);
+        if (!isLeaf(_node) && !_visited) {
+            OMNode firstChild = _getFirstChild((OMContainer) _node);
             if (firstChild != null) {
                 _next = firstChild;
-            } else if (_next.isComplete()) {
+            } else if (_node.isComplete()) {
+                _next = _node;
                 _backtracked = true;
             } else {
                 _next = null;
             }
         } else {
-            if (_next instanceof OMDocument) {
+            if (_node instanceof OMDocument) {
                 _next = null;
             } else {
-                OMNode nextNode = (OMNode)_next;
+                OMNode nextNode = (OMNode)_node;
                 OMContainer parent = nextNode.getParent();
                 OMNode nextSibling = getNextSibling(nextNode);
                 if (nextSibling != null) {
@@ -999,7 +1000,6 @@ class SwitchingWrapper extends AbstractX
      * navigator cannot proceed.
      */
     private void step() {
-        _next = _node;
         updateNextNode();
     }