Name: dsC58869 Date: 09/21/98
This bug was filed in JDK1.2fcs.
Spec for java.awt.Frame.remove(MenuComponent m) method defines
NullPointerException as result if null is input parameter.
But this method doesn't throw it.
SRC fragment:
...
* @(#)Frame.java 1.94 98/09/09
...
/**
* Removes the specified menu bar from this frame.
* @param m the menu component to remove.
* If this parameter is <code>null</code> then a
* NullPointerException is thrown and no action
* is taken.
*/
...
--Example--
import java.awt.*;
public class TestFrame09 {
public static void main(String[] args) {
Frame fr = new Frame("title");
MenuBar mb = new MenuBar();
fr.setMenuBar(mb);
mb = null;
try {
fr.remove(mb);
System.out.println("Failed: NullPointerException expected");
} catch (NullPointerException npe) {
System.out.println("OKAY");
}
}
}
-- Output --
%java TestFrame09
Failed: NullPointerException expected
%
======================================================================
Justification:
Wrong specification.
======================================================================