United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6385277 : testcase 4774166 is failing on Linux but passing on Solaris and Windows with Tiger JDKS.

Details
Type:
Bug
Submit Date:
2006-02-14
Status:
Closed
Updated Date:
2011-01-19
Project Name:
JDK
Resolved Date:
2006-04-28
Component:
client-libs
OS:
linux_suse_sles_9,linux_redhat_3.0
Sub-Component:
java.awt
CPU:
x86
Priority:
P2
Resolution:
Fixed
Affected Versions:
5.0u7,6
Fixed Versions:

Related Reports
Backport:
Duplicate:

Sub Tasks

Description
Testcase from regression workspace, bug4774166.java is failing on Linux but passing on Solaris and Windows platforms with Tiger JDKS.

Testcase Location:
==================
/net/urts071.india/export6/testSuites/Regression/workspace_150/test/javax/swing/InputVerifier/4774166/bug4774166.java

JDK:
====
java -version
java version "1.5.0_07-ea"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-ea-b01)
Java HotSpot(TM) Client VM (build 1.5.0_07-ea-b01, mixed mode, sharing)

Operating System: 
================
cat /etc/SuSE-release
SUSE LINUX Enterprise Server 9 (i586)
VERSION = 9

Steps to reproduce:
===================
1. Install JDK in test machine.
2. copy attached .java files ( bug4774166.java, JRobot.java and Util.java) into test machine.
3. Compile *.java files with tested JDK with following command:
   <jdk location>/bin/javac *.java
4. Start the test with the following command:
   <jdk location>/bin/java bug4774166

ERROR:
=====
Exception in thread "main" java.lang.RuntimeException: Focus error. Test failed!
        at bug4774166.main(bug4774166.java:153)

                                    

Comments
EVALUATION

Here's the scenario the test is failing under:

. The window (JWindow) testwindow does not have focus. The last component in the Window that had focus is windowtf1.
. A mouse click is generated via Robot on the JTextField windowtf2 which is contained in testwindow.
. The click results in JTextField doing a requestFocus. An InputVerifier is installed on windowtf1 that always returns false from verify, implying focus should not be moved. The requestFocus on windowtf2 results in the InputVerifier returning false which means requestFocus will not be propagated to super in JComponent.

On Windows (didn't test solaris) this scenario results in focus going back to windowtf1 (the last component that had focus in testwindow), which is the expected behavior. On linux focus gets lost.

The curious thing is if we're denying the requestFocus request, how does the window get focus, and how come it works on some platforms. Contacting AWT for more information.
                                     
2006-02-16
EVALUATION

I exchanged email with Anton, who indicated XAWT has a different focus model than windows such that it's up to AWT to handle focusing the windows. From Anton:

> On Windows when user clicks in a window it immediately gets activation message
> from the native system. On XAWT simple window doesn't get natively activated.
> This is due to the focus model used by XAWT. WM doesn't manage focus for
> simple windows at all. It's AWT that completely takes this responsibility.
> Currently native focus is requested on a simple window via requestFocus()
> call on some of window's components. 

Anton believes the fix should be done in XAWT and has suggested I reassign to AWT. I'm more than happy to comply:)
                                     
2006-02-22
SUGGESTED FIX

See the webrev here: http://javaweb.sfbay/jcg/1.6.0-mustang/awt/6385277
                                     
2006-03-21
EVALUATION

The fix integrated into b79 failed. The reason was that some client code gets executed
on AppContext it doesn't belong to. This causes some problem with focuses in this
particular case.
                                     
2006-04-04
SUGGESTED FIX

The first fix failed and was changed. So the whole fix to this problem includes
the following changes: 
1) http://sa.sfbay.sun.com/projects/awt_data/mustang/6385277.5/
2) http://sa.sfbay.sun.com/projects/awt_data/mustang/6385277
   (also available here: http://javaweb.sfbay/jcg/1.6.0-mustang/awt/6385277)

There have been created two regression tests (see the webrevs).
                                     
2006-04-20



Hardware and Software, Engineered to Work Together