JDK-6737722 : api/java_awt/TrayIcon/index.html#TrayIconHeadlessMode
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6u10
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_10
  • CPU: sparc
  • Submitted: 2008-08-15
  • Updated: 2012-03-22
  • Resolved: 2009-11-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7
6u10Fixed 7 b36Fixed
Related Reports
Relates :  
Description
JCK            : JCK-runtime-6a b14
J2SE           : FAIL - jdk6u10 since build 08
Platform[s]    : FAIL - solaris10(sparcv9)
switch/Mode    : FAIL - any

api/java_awt/TrayIcon/index.html#TrayIconHeadlessModefails with folowing  output:
(taken from jtr file)
#section:testExecute
----------messages:(1/617)----------
command: com.sun.jck.lib.ExecJCKTestOtherJVMCmd LD_LIBRARY_PATH=/export/JCK/JCK-runtime-6a/lib/SunOS.v9:/export/JCK/JCK-runtime-6a/lib/SunOS.v9/jmx:/export/JCK/JCK-runtime-6a/lib/SunOS.v9 /export/JDK/jdk1.6.0_10/bin/java -d64 -server -Xcomp -Djava.awt.headless=true -Djava.ext.dirs=/export/JCK/JCK-runtime-6a/lib/extensions:/export/JDK/jdk1.6.0_10/lib/ext:/export/JDK/jdk1.6.0_10/jre/lib/ext -Xfuture -classpath /export/JCK/JCK-runtime-6a/classes:/export/JDK/jdk1.6.0_10/lib/tools.jar -Djava.security.policy=/export/JCK/JCK-runtime-6a/lib/jck.policy javasoft.sqe.tests.api.java.awt.TrayIcon.TrayIconHeadlessModeTests
----------out1:(73/5753)----------
java.lang.ClassCastException: sun.awt.HeadlessToolkit cannot be cast to sun.awt.SunToolkit
	at java.awt.SystemTray.addNotify(SystemTray.java:445)
	at java.awt.SystemTray.<init>(SystemTray.java:113)
	at java.awt.SystemTray.initializeSystemTrayIfNeeded(SystemTray.java:459)
	at java.awt.SystemTray.isSupported(SystemTray.java:184)
	at javasoft.sqe.tests.api.java.awt.TrayIcon.TrayIconHeadlessModeTests$MyTestInvoker.exceptionThrown(TrayIconHeadlessModeTests.java:36)
	at javasoft.sqe.jck.lib.TestInvoker.executeTest(TestInvoker.java:292)
	at javasoft.sqe.tests.api.java.awt.TrayIcon.TrayIconHeadlessModeTests.testConstructors2001(TrayIconHeadlessModeTests.java:77)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at javasoft.sqe.javatest.lib.MultiTest.invokeTestCase(MultiTest.java:406)
	at javasoft.sqe.jck.lib.EDTest.access$001(EDTest.java:31)
	at javasoft.sqe.jck.lib.EDTest$1.run(EDTest.java:45)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
testConstructors2001: Failed. Test case throws exception: java.lang.ClassCastException: sun.awt.HeadlessToolkit cannot be cast to sun.awt.SunToolkit
java.lang.ClassCastException: sun.awt.HeadlessToolkit cannot be cast to sun.awt.SunToolkit
	at java.awt.SystemTray.addNotify(SystemTray.java:445)
	at java.awt.SystemTray.<init>(SystemTray.java:113)
	at java.awt.SystemTray.initializeSystemTrayIfNeeded(SystemTray.java:459)
	at java.awt.SystemTray.isSupported(SystemTray.java:184)
	at javasoft.sqe.tests.api.java.awt.TrayIcon.TrayIconHeadlessModeTests$MyTestInvoker.exceptionThrown(TrayIconHeadlessModeTests.java:36)
	at javasoft.sqe.jck.lib.TestInvoker.executeTest(TestInvoker.java:292)
	at javasoft.sqe.tests.api.java.awt.TrayIcon.TrayIconHeadlessModeTests.testConstructors2002(TrayIconHeadlessModeTests.java:102)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at javasoft.sqe.javatest.lib.MultiTest.invokeTestCase(MultiTest.java:406)
	at javasoft.sqe.jck.lib.EDTest.access$001(EDTest.java:31)
	at javasoft.sqe.jck.lib.EDTest$1.run(EDTest.java:45)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
testConstructors2002: Failed. Test case throws exception: java.lang.ClassCastException: sun.awt.HeadlessToolkit cannot be cast to sun.awt.SunToolkit
java.lang.ClassCastException: sun.awt.HeadlessToolkit cannot be cast to sun.awt.SunToolkit
	at java.awt.SystemTray.addNotify(SystemTray.java:445)
	at java.awt.SystemTray.<init>(SystemTray.java:113)
	at java.awt.SystemTray.initializeSystemTrayIfNeeded(SystemTray.java:459)
	at java.awt.SystemTray.isSupported(SystemTray.java:184)
	at javasoft.sqe.tests.api.java.awt.TrayIcon.TrayIconHeadlessModeTests$MyTestInvoker.exceptionThrown(TrayIconHeadlessModeTests.java:36)
	at javasoft.sqe.jck.lib.TestInvoker.executeTest(TestInvoker.java:292)
	at javasoft.sqe.tests.api.java.awt.TrayIcon.TrayIconHeadlessModeTests.testConstructors2003(TrayIconHeadlessModeTests.java:129)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at javasoft.sqe.javatest.lib.MultiTest.invokeTestCase(MultiTest.java:406)
	at javasoft.sqe.jck.lib.EDTest.access$001(EDTest.java:31)
	at javasoft.sqe.jck.lib.EDTest$1.run(EDTest.java:45)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
testConstructors2003: Failed. Test case throws exception: java.lang.ClassCastException: sun.awt.HeadlessToolkit cannot be cast to sun.awt.SunToolkit
STATUS:Failed.test cases: 3; all failed; first test case failure: testConstructors2001
----------out2:(0/0)----------
result: Failed. test cases: 3; all failed; first test case failure: testConstructors2001
test result: Failed. test cases: 3; all failed; first test case failure: testConstructors2001

Steps for reproduce:
1. login to stt-60-zone3.russia
2. install jdk1.6.0_10 b29 j4b to /export/JDK (full path must be /export/JDK/jdk1.6.0_10/bin/java)
3. cd /set/stt/newroot/results/1.6.0_10/b29_j4b/JCK6a/runtime-s4v-Sol10-server-Xcomp/workDir
4. run script ./index_TrayIconHeadlessMode.sh

Script (this script assumes that JCK is installed to /set/stt/jck_promotions/6a/fcs/alt2/binaries/JCK-runtime-6a):
#!/bin/bash
export CLASSPATH="/set/stt/jck_promotions/6a/fcs/alt2/binaries/JCK-runtime-6a/classes"
export JAVA=/export/jdk1.6.0_10/bin/java

/export/JDK/jdk1.6.0_10/bin/java -Djava.awt.headless=true  -Djava.ext.dirs=/export/JCK/JCK-runtime-6a/lib/extensions:/export/JDK/jdk1.6.0_1
0/lib/ext:/export/JDK/jdk1.6.0_10/jre/lib/ext -Xfuture -classpath /export/JCK/JCK-runtime-6a/classes:/export/JDK/jdk1.6.0_10/lib/tools.jar
-Djava.security.policy=/export/JCK/JCK-runtime-6a/lib/jck.policy javasoft.sqe.tests.api.java.awt.TrayIcon.TrayIconHeadlessModeTests

Comments
SUGGESTED FIX http://sa.sfbay.sun.com/projects/awt_data/7/6737722.1/
25-08-2008

EVALUATION 6438179 changed isSupported() to call initializeSystemTrayIfNeeded() before checking for the HeadlessToolkit. Instead, initializeSystemTrayIfNeeded() should not be called at all if we're running Headless.
22-08-2008