-
Bug
-
Resolution: Fixed
-
P2
-
6
-
b12
-
x86
-
windows_xp
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2194766 | 7 | Alexander Potochkin | P2 | Closed | Fixed | b102 |
JDK-2168839 | 6u11 | Abhijit Saha | P2 | Resolved | Fixed | b01 |
FULL PRODUCT VERSION :
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b05)
Java HotSpot(TM) Client VM (build 1.6.0_02-b05, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
JTree isExpanded(TreePath) is unnecessarily recursive. With the default stack size (or any reasonable size) a TreePath to a few thousand entries will lead to StackOverflowException. Trees are used to represent graphs, e.g., reference chains that can easily exceed this depth. isExpanded(TreePath) can be trivially rewritten as a loop.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
In a loop, lengthen a path by adding children to a branch of a tree, one per level, and keep calling isVisible() on the TreePath that represents the deepest child until you get StackOverflowException.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Some degradation in speed, but no exceptions.
ACTUAL -
StackOverflowException when isVisible(TreePath) calls isExpanded(TreePath).
REPRODUCIBILITY :
This bug can be reproduced always.
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b05)
Java HotSpot(TM) Client VM (build 1.6.0_02-b05, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
JTree isExpanded(TreePath) is unnecessarily recursive. With the default stack size (or any reasonable size) a TreePath to a few thousand entries will lead to StackOverflowException. Trees are used to represent graphs, e.g., reference chains that can easily exceed this depth. isExpanded(TreePath) can be trivially rewritten as a loop.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
In a loop, lengthen a path by adding children to a branch of a tree, one per level, and keep calling isVisible() on the TreePath that represents the deepest child until you get StackOverflowException.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Some degradation in speed, but no exceptions.
ACTUAL -
StackOverflowException when isVisible(TreePath) calls isExpanded(TreePath).
REPRODUCIBILITY :
This bug can be reproduced always.
- backported by
-
JDK-2168839 JTree isExpanded should not call itself recursively
- Resolved
-
JDK-2194766 JTree isExpanded should not call itself recursively
- Closed