JDK-6291601 : Uncler description for JDialog(Dialog) constructor if Dialog is null
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2005-06-28
  • Updated: 2012-03-23
  • Resolved: 2005-08-02
Related Reports
Duplicate :  
Description
JDialog has a number of constructors whith Dialog argument:
- public JDialog(Dialog owner)
- public JDialog(Dialog owner, boolean modal)
- public JDialog(Dialog owner, String title)
- public JDialog(Dialog owner, String title, boolean modal)

Also there is a description "owner - the non-null Dialog from which the dialog is displayed" in the spec according to owner. But there are no clear specification what should be if owner is null.

So in fact the test below may show some strange logic in JDialog constructor. If the test below is running on JDK 5 it throws an exception:
Exception in thread "main" java.lang.IllegalArgumentException: null owner window...
But on JDK 6 b42 it exits silently.

The test:
==
import javax.swing.JDialog;
import java.awt.Dialog;

public class Test {
    public static void main(String[] args) {
        JDialog dialog = new JDialog((Dialog)null);
    }
}
==
###@###.### 2005-06-28 12:08:44 GMT

Comments
EVALUATION In the fix for bug 6300062 the javadoc for those constructors was updated it'll look like @param owner <code>Dialog</code> from which the dialog is displayed or * <code>null</code> if this dialog has no owner since no NullPointerException is mentioned in @exception tag, no NPE should be thrown, fix for 6300062 make null owner valid
02-08-2005