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

Doc for JToolBar.add(Action) should specify behavior on null-parameter

XMLWordPrintable

    • x86, sparc
    • linux, solaris_2.6, windows_2000



      Name: ooR10001 Date: 03/11/2001


      Current javadoc for javax.swing.JToolBar.add(Action a) does not specify method
      behavior when parameter 'a' is null. Under jdk 1.4 this method works differ
      then under jkd1.3 - it causes compatibility problem.

      Following test is demonstrate a bug:
      -----------------------
      import javax.swing.JToolBar;

      public class test {

          public static void main(String[] args) {
              JToolBar tbar = new JToolBar();
              try {
                  tbar.add((javax.swing.Action)null);
                  System.out.println("NPE or IAE expected but is not thrown");
      } catch (IllegalArgumentException iae) {
                  System.out.println("IAE is thrown");
      } catch (NullPointerException npe) {
                  System.out.println("NPE is thrown");
      }
          }

      }
      -----------------------

      Output under jdk1.4:
      ---------------------
      NPE or IAE expected but is not thrown
      ---------------------

      Output under jdk1.3:
      ---------------------
      NPE is thrown
      ---------------------

      It needs to be fixed.

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

            sharonz Sharon Zakhour (Inactive)
            oovsunw Oov Oov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: