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

JInternalFrame constructor behavior is unspecified for null param

XMLWordPrintable

    • beta
    • sparc
    • solaris_2.6



      Name: aaR10142 Date: 06/26/2000


      A JInternalFrame(String title, ...) constructors' behavior
      is unspecified for null title parameter

      The constructor accepts null title in jdk1.3,
      and throws NPE for it in jdk1.4

      Please specify the correct behavior and if it is needed to keep new one,
      specify that the behavior was changed.

      See example:

      ------------------example--------------------
      import javax.swing.JInternalFrame;

      public class Test {

          public static void main(String argv[]) {
              JInternalFrame f = new JInternalFrame(null);
              System.out.println("The title is \""+f.getTitle()+"\"");
           }

      }
      -------------------jdk1.3 output ---------------------------
      The title is "null"
      -------------------jdk1.4 output ---------------------------
      Exception in thread "main" java.lang.NullPointerException
              at sun.awt.font.FontDesignMetrics.stringWidth(FontDesignMetrics.java:253)
              at javax.swing.plaf.metal.MetalInternalFrameTitlePane.getMinimumWidth(MetalInternalFrameTitlePane.java:367)
              at javax.swing.plaf.basic.BasicInternalFrameUI.installUI(BasicInternalFrameUI.java:102)
              at javax.swing.plaf.metal.MetalInternalFrameUI.installUI(MetalInternalFrameUI.java:72)
              at javax.swing.JComponent.setUI(JComponent.java:331)
              at javax.swing.JInternalFrame.setUI(JInternalFrame.java:308)
              at javax.swing.JInternalFrame.updateUI(JInternalFrame.java:323)
              at javax.swing.JInternalFrame.<init>(JInternalFrame.java:275)
              at javax.swing.JInternalFrame.<init>(JInternalFrame.java:206)
              at Test.main(Test.java:6)
      -------------------------------------------------------------

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

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: