jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dpfis...@apache.org
Subject svn commit: r486533 - /jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/PathMap.java
Date Wed, 13 Dec 2006 07:40:24 GMT
Author: dpfister
Date: Tue Dec 12 23:40:23 2006
New Revision: 486533

URL: http://svn.apache.org/viewvc?view=rev&rev=486533
Log:
Make element traversal visit parent first in order to produce better debug outputs.

Modified:
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/PathMap.java

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/PathMap.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/PathMap.java?view=diff&rev=486533&r1=486532&r2=486533
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/PathMap.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/PathMap.java
Tue Dec 12 23:40:23 2006
@@ -112,7 +112,8 @@
     }
 
     /**
-     * Traverse the path map and call back requester.
+     * Traverse the path map and call back requester. This method visits the root
+     * first, then its children.
      * @param includeEmpty if <code>true</code> invoke call back on every child
      *                     regardless, whether the associated object is empty
      *                     or not; otherwise call back on non-empty children
@@ -471,13 +472,17 @@
         }
 
         /**
-         * Recursively invoked traversal method.
+         * Recursively invoked traversal method. This method visits the element
+         * first, then its children.
          * @param visitor visitor to invoke
          * @param includeEmpty if <code>true</code> invoke call back on every
          *        element regardless, whether the associated object is empty
          *        or not; otherwise call back on non-empty children only
          */
         public void traverse(ElementVisitor visitor, boolean includeEmpty) {
+            if (includeEmpty || obj != null) {
+                visitor.elementVisited(this);
+            }
             if (children != null) {
                 Iterator iter = children.values().iterator();
                 while (iter.hasNext()) {
@@ -489,9 +494,6 @@
                         }
                     }
                 }
-            }
-            if (includeEmpty || obj != null) {
-                visitor.elementVisited(this);
             }
         }
 



Mime
View raw message