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

AWT spec for Frame.remove(MenuComponent m) is wrong

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.2.0
    • docs
    • beta
    • sparc
    • solaris_2.5



      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.

      ======================================================================

            sharonz Sharon Zakhour (Inactive)
            dsilaev Dmitri Silaev
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: