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

JLayer.remove(Component) throws NPE for null argument

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Not an Issue
    • Affects Version/s: 7
    • Fix Version/s: None
    • Component/s: client-libs

      Description

      Method javax.swing.JLayer.remove(Component) doesn't follow general Swing practice and throw NPE for passed null arg in certain conditions. Please see the following sample:

      import javax.swing.*;
      import javax.swing.plaf.LayerUI;
      import java.awt.*;

      public class NPE {
          public static void main(String[] args) {
              JLayer<Button> layer = new JLayer<Button>(new Button());
              layer.setGlassPane(new JPanel());
              layer.setUI(new LayerUI<Button>() { });
              layer.remove((Component)null);
          }
      }

      Exception in thread "main" java.lang.NullPointerException
      at java.awt.Container.remove(Container.java:1228)
      at javax.swing.JLayer.remove(JLayer.java:279)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                dbessono Dmitry Bessonov
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: