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

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

    XMLWordPrintable

    Details

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

      Description

      According to the spec for javax.swing.plaf.metal.MetalToolBarUI 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.MetalToolBarUI;

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

      It prints OK instead of throwing NPE.




      ###@###.### 2005-05-03 12:08:08 GMT

        Attachments

          Activity

            People

            Assignee:
            svioletsunw Scott Violet (Inactive)
            Reporter:
            dmiltsov Dmitry Miltsov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: