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

MetalMenuBarUI.update(Graphics,JComponent) doesn't throw NPE if Graphics argument is null

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b46
    • CPU:
      generic
    • OS:
      generic

      Description

      According to the spec for javax.swing.plaf.metal.MetalMenuBarUI the method update(Graphics, JComponent) should throw NPE if any of the arguments are null.
      However if we invoke update() with null Graphics argument then NPE is not thrown. You can reproduce it by following code:

      import javax.swing.JComponent;
      import javax.swing.plaf.metal.MetalMenuBarUI;

      public class Test {
          public static void main(String[] args) {
             JComponent jComp = new JComponent(){};
             MetalMenuBarUI menuBarUI = new MetalMenuBarUI();
             menuBarUI.update(null, jComp);
             System.out.println("OK");
         }
      }

      It prints OK instead of throwing NPE.

      ###@###.### 2005-05-03 12:53:28 GMT

        Attachments

          Activity

            People

            Assignee:
            svioletsunw Scott Violet (Inactive)
            Reporter:
            vsmelovsunw Vladimir Smelov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: