Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8068518

IllegalArgumentException in JTree.AccessibleJTree

XMLWordPrintable

        When running a swing app with the Java Access Bridge, it is possible to get an
        IllegalArgumentException in JTree.AccessibleJTree.

        There is no reliable test case, but the bug is easy to see in the code:

        JTree.AccessibleJTree.getAccessibleChild(int i) has the following code (line 4370 JDK 1.8.0.40)

                            Object[] objPath = { model.getRoot() };
                            TreePath path = new TreePath(objPath);

        The javadoc for the first line clearly states the model can return null for getRoot().
        The javadoc for new TreePath(Object) clearly states null is not a valid argument.

        This code needs a null check to return null in this case. (Note there are a few other uses of this code in AccessibleJTree that should be similarly changed)

              van Vivi An (Inactive)
              shadowbug Shadow Bug
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: