浏览代码

Improve logging.

Ben Alex 20 年之前
父节点
当前提交
14e384051b
共有 1 个文件被更改,包括 11 次插入7 次删除
  1. 11 7
      domain/src/main/java/org/acegisecurity/domain/validation/ValidationManagerImpl.java

+ 11 - 7
domain/src/main/java/org/acegisecurity/domain/validation/ValidationManagerImpl.java

@@ -220,20 +220,24 @@ public class ValidationManagerImpl implements InitializingBean,
         introspectionManager.obtainImmediateChildren(parentObject,
             currentChildren);
 
-        // Add the children
-        allObjects.addAll(currentChildren);
-
         // Now iterate the children, adding their children to the object list
         Iterator<Object> childrenIter = currentChildren.iterator();
 
         while (childrenIter.hasNext()) {
             Object childObject = childrenIter.next();
 
-            if (childObject != null && !allObjects.contains(childObject)) {
-				if (logger.isDebugEnabled()) {
-					logger.debug("New child class found; searching for children of: " + childObject);
+            if (childObject != null) {
+				if (allObjects.contains(childObject)) {
+					if (logger.isDebugEnabled()) {
+						logger.debug("Already processed this object (will not re-add): " + childObject);
+					}
+				} else {
+					if (logger.isDebugEnabled()) {
+						logger.debug("New child object found; adding child object to list of objects, and searching for its children: " + childObject);
+					}
+					allObjects.add(childObject);
+	                obtainAllChildren(childObject, allObjects);
 				}
-                obtainAllChildren(childObject, allObjects);
             }
         }
     }