changeset 2528:a05e047c5b98

6684401: JTree isExpanded should not call itself recursively Reviewed-by: rupashka
author alexp
date Tue, 22 Jun 2010 20:36:55 +0400
parents dea63f6dda7a
children f1bafc4f249d
files src/share/classes/javax/swing/JTree.java
diffstat 1 files changed, 9 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/javax/swing/JTree.java	Tue Jun 22 19:38:27 2010 +0400
+++ b/src/share/classes/javax/swing/JTree.java	Tue Jun 22 20:36:55 2010 +0400
@@ -1986,20 +1986,17 @@
      *               true if all nodes in the path are expanded
      */
     public boolean isExpanded(TreePath path) {
+
         if(path == null)
             return false;
-
-        // Is this node expanded?
-        Boolean value = expandedState.get(path);
-
-        if(value == null || !value.booleanValue())
-            return false;
-
-        // It is, make sure its parent is also expanded.
-        TreePath        parentPath = path.getParentPath();
-
-        if(parentPath != null)
-            return isExpanded(parentPath);
+        Object  value;
+
+        do{
+            value = expandedState.get(path);
+            if(value == null || !((Boolean)value).booleanValue())
+                return false;
+        } while( (path=path.getParentPath())!=null );
+
         return true;
     }