-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta
-
sparc
-
solaris_2.6
Name: auR10023 Date: 11/17/2000
The next methods of javax.swing.LayoutFocusTraversalPolicy:
getComponentAfter(Container, Component)
getComponentBefore(Container, Component)
getFirstComponent(Container)
getLastComponent(Container)
incorrectly raise NullPointerException when Container is null.
But javadoc for these methods states:
getComponentAfter(), getComponentBefore()
...
Throws:
IllegalArgumentException - if focusCycleRoot is not a focus cycle root of
aComponent, or if either focusCycleRoot or aComponent is null
...
getFirstComponent() and getLastComponent()
...
Throws:
IllegalArgumentException - if focusCycleRoot is null
...
----Test.java------
import javax.swing.*;
import java.awt.*;
public class Test {
public static void main (String[] args) {
LayoutFocusTraversalPolicy policy = new LayoutFocusTraversalPolicy();
Component comp = new JTextField();
try {
policy.getComponentAfter(null, comp);
} catch(IllegalArgumentException e) {
System.out.println("IllegalArgumentException was obtained");
} catch(NullPointerException e) {
System.out.println("NullPointerException was obtained");
}
}
}
-----Output--------
NullPointerException was obtained
======================================================================