JDK-6322433 : REGRESSION: JDialog and JWindow throw IAE in headless mode
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2005-09-12
  • Updated: 2017-05-19
  • Resolved: 2005-12-22
Related Reports
Duplicate :  
Relates :  
Description
JDialog and JWindow constructors (no-argument constructors or when passing null as argument) throw IllegalArgumentException instead of HeadlessException in headless mode. This is reproducible from b50 onwards on all platforms.

Stack trace:
Exception in thread "main" java.lang.IllegalArgumentException: headless environment
        at java.awt.Window.init(Window.java:304)
        at java.awt.Window.<init>(Window.java:299)
        at java.awt.Window.<init>(Window.java:425)
        at java.awt.Dialog.<init>(Dialog.java:642)
        at java.awt.Dialog.<init>(Dialog.java:392)
        at javax.swing.JDialog.<init>(JDialog.java:220)
        at javax.swing.JDialog.<init>(JDialog.java:167)
        at javax.swing.JDialog.<init>(JDialog.java:140)

Comments
EVALUATION The problem is not in Swing code, but in AWT one: we throw wrong exception from java.awt.Window constructor, and all the subclasses do the same. I have filed a separate CR 6366441 for this issue and closing this as duplicate of it.
22-12-2005

EVALUATION This casued by the fix for 6300062
15-09-2005