JDK-6436329 : SWAT: Some awt swat Focus and Event tests are failed in b87
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2006-06-08
  • Updated: 2010-04-03
  • Resolved: 2006-06-30
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
6 b91Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
Java Version: build 1.6.0-rc-b87 (06/08)
Platforms: linux, solaris, windowsXPpro

Problems: 
AWT SWAT Focus and some Events tests are FAIL in b87, but PASS in b86:
AWT/TraversalOperationsTest/TraversalOperationsTest.html
Swing/TraversalOperationTest/TraversalOperationsTest.html
Swing/FocusEventTest/FocusEventTest.html
AWT/FocusEventTest/FocusEventTest.html
AWT/MouseButtonExTest
AWT/KeyMaskTest

The exceptions are following:
Note: /net/cady/export4/awt/awt/src/AWT_Focus/Automated/AWT/FocusEventTest/FocusEventGUI.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
	at javasoft.awtsqe.RobotAppletTest.init(Unknown Source)
	at com.sun.javatest.regtest.AppletWrapper$AppletThread.run(AppletWrapper.java:57)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.reflect.InvocationTargetException
	at java.awt.EventQueue.invokeAndWait(EventQueue.java:998)
	... 3 more
Caused by: java.lang.ExceptionInInitializerError
	at javasoft.awtsqe.RobotAppletTest.mkMessagePanel(Unknown Source)
	at javasoft.awtsqe.RobotAppletTest.initOverallGUI(Unknown Source)
	at javasoft.awtsqe.RobotAppletTest.access$000(Unknown Source)
	at javasoft.awtsqe.RobotAppletTest$1.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:598)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Caused by: java.lang.ClassCastException: java.awt.AWTKeyStroke cannot be cast to java.lang.Comparable
	at java.util.TreeMap.compare(TreeMap.java:1167)
	at java.util.TreeMap.put(TreeMap.java:513)
	at java.util.TreeSet.add(TreeSet.java:238)
	at java.awt.KeyboardFocusManager.initFocusTraversalKeysSet(KeyboardFocusManager.java:375)
	at java.awt.TextArea.<clinit>(TextArea.java:127)
	... 12 more
STATUS:Failed.Applet thread threw exception: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException

How to reproduce:
on solaris or linux
1. cd /net/cady.sfbay/export4/awt/awt/src/AWT_Events/Automated/AWT/KeyMaskTest
2. set JAVA_HOME to b87
3. sh script.ksh . $JAVA_HOME/bin/javac $JAVA_HOME/bin/java
you will see the exceptions.
Or use the attached files.

Comments
SUGGESTED FIX *** /tmp/geta26186.K26189 2006-06-13 14:42:06.000000000 +0400 --- TextArea.java 2006-06-13 14:42:01.000000000 +0400 *************** *** 12,19 **** import java.io.ObjectOutputStream; import java.io.ObjectInputStream; import java.io.IOException; import java.util.Set; - import java.util.TreeSet; import javax.accessibility.*; /** --- 12,19 ---- import java.io.ObjectOutputStream; import java.io.ObjectInputStream; import java.io.IOException; + import java.util.HashSet; import java.util.Set; import javax.accessibility.*; /** *************** *** 126,135 **** } forwardTraversalKeys = KeyboardFocusManager.initFocusTraversalKeysSet( "ctrl TAB", ! new TreeSet()); backwardTraversalKeys = KeyboardFocusManager.initFocusTraversalKeysSet( "ctrl shift TAB", ! new TreeSet()); } /** --- 126,135 ---- } forwardTraversalKeys = KeyboardFocusManager.initFocusTraversalKeysSet( "ctrl TAB", ! new HashSet()); backwardTraversalKeys = KeyboardFocusManager.initFocusTraversalKeysSet( "ctrl shift TAB", ! new HashSet()); } /**
13-06-2006

EVALUATION The same problem happened to Swing after the recent T&L putback of 5045147. Although their putback revealed this, it wasn't bad code. It simply reveals an incorrect usage of TreeSet. The TreeSet() constructor clearly says that objects used with it must implement Comparable. AWT (and Swing) were using objects that aren't Comparable. Swing fixed this problem, under 6434148, by replacing the affected TreeSets with HashSet.
09-06-2006