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

SystemColor.<clinit> throws HeadlessException

XMLWordPrintable

    • beta
    • sparc
    • solaris_7



      Name: sdR10048 Date: 01/22/2001


      static initialization of java.awt.SystemColor throws unexpected
      HeadlessException in headless mode.
      Javadoc (jdk1.4 beta 46) says nothing about HeadlessException.
      See example:
      --------------------------------------------------
      dsv@falcon ~/tmp
      % cat Test.java
      import java.awt.*;
      public class Test {
          public static void main(String[] args) {
              try {
                  System.out.println( SystemColor.desktop );
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      }

      dsv@falcon ~/tmp
      % javac Test.java

      dsv@falcon ~/tmp
      % j -Djava.awt.headless=true Test
      Exception in thread "main" java.lang.ExceptionInInitializerError
              at Test.main(Test.java:5)
      Caused by: java.awt.HeadlessException
              at sun.awt.HeadlessToolkit.loadSystemColors(HeadlessToolkit.java:177)
              at java.awt.SystemColor.updateSystemColors(SystemColor.java:342)
              at java.awt.SystemColor.<clinit>(SystemColor.java:335)
              ... 1 more
      ^C
      dsv@falcon ~/tmp
      % java -version
      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b46)
      Java HotSpot(TM) Client VM (build 1.4beta-B45, mixed mode)
      --------------------------------------------------
      This causes to fail folowing jck merlin test:
      api/java_awt/SystemColor/index.html#SystemColor
      ======================================================================

            mmartaksunw Michael Martak (Inactive)
            dsvsunw Dsv Dsv (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: