-
Bug
-
Resolution: Fixed
-
P3
-
7
-
b74
-
generic
-
generic
Method JLayer.remove((Component) null) throws NPE (see CR#6875173)
but if glassPane is set to null and view is not null then NPE isn't thrown:
import javax.swing.*;
import java.awt.*;
public class NPE {
public static void main(String[] args) {
JLayer<Component> layer = new JLayer<Component>(new Component(){});
// comment the following line to get NPE
layer.setGlassPane(null);
// NPE might or might not be thrown
layer.remove((Component)null);
}
}
Behavior should be unified.
The following JCK test verifies NPE throwing:
api/javax_swing/JLayer/index.html#General[remove_nullComponent_01]
api/javax_swing/JLayer/index.html#General[remove_nullComponent_02]
api/javax_swing/JLayer/index.html#General[remove_nullComponent_03]
but if glassPane is set to null and view is not null then NPE isn't thrown:
import javax.swing.*;
import java.awt.*;
public class NPE {
public static void main(String[] args) {
JLayer<Component> layer = new JLayer<Component>(new Component(){});
// comment the following line to get NPE
layer.setGlassPane(null);
// NPE might or might not be thrown
layer.remove((Component)null);
}
}
Behavior should be unified.
The following JCK test verifies NPE throwing:
api/javax_swing/JLayer/index.html#General[remove_nullComponent_01]
api/javax_swing/JLayer/index.html#General[remove_nullComponent_02]
api/javax_swing/JLayer/index.html#General[remove_nullComponent_03]
- relates to
-
JDK-6875173 JLayer.remove(Component) throws NPE for null argument
-
- Closed
-