You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by dp...@apache.org on 2006/12/13 08:40:24 UTC
svn commit: r486533 -
/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/PathMap.java
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);
}
}