6684401: JTree isExpanded should not call itself recursively
Reviewed-by: rupashka
--- a/jdk/src/share/classes/javax/swing/JTree.java Tue Jun 22 19:38:27 2010 +0400
+++ b/jdk/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;
}