JDK-4771122 : TEST_BUG: RegTest-test javax/swing/JApplet/4707289/bug4707289.java failed, Linux
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.2
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux,windows_xp
  • CPU: x86
  • Submitted: 2002-10-30
  • Updated: 2011-01-19
  • Resolved: 2003-03-12
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.
Other
1.4.2 b08Fixed
Related Reports
Relates :  
Description

Name: aaR10208			Date: 10/30/2002


Filed By       : J2SE-SQA [###@###.###
JDK            : JDK1.4.2-b04
Testbase       : RegTest-test
Platform[s]    : RedHat Linux 8.0 (GNOME)
switch/Mode    : -client -Xmixed -Xfuture
Falling test[s]: 
        javax/swing/JApplet/4707289/bug4707289.java 

Here is a part of the test's source (file: javax/swing/JApplet/4707289/bug4707289.java)
-----
    31      public void start() {
    32          try {
    33              robot = new Robot();
    34              SwingUtilities.invokeLater(new Runnable() {
    35                      public void run() {
    36                          try {
    37                              robot.keyPress(KeyEvent.VK_TAB);
    38                              robot.keyRelease(KeyEvent.VK_TAB);
-----
The test tries to press/release the TAB key programmatically.
The problem is that JApplet.start() method could be called when applet is not yet shown in the 
browser/appletviewer, so the applet does not receive appropriate events and the test fails.


Test source location:
=====================
/net/jdk/export/disk8/local.java/jdk1.4.2/ws/j2se/test/javax/swing/JApplet/4707289/bug4707289.java

jtr file location:
==================
/net/jtgb4u4c.eng/export/sail15/results/mantis/b04/regtest/linux/redhat8.0_gnome_linux-11/javax/swing/JApplet/4707289/bug4707289.jtr

How to reproduce:
=================
1. Run the following script on RH Linux 8.0 (you may need to change its variables)
2. Wait for a while after the applet with a "Test" buttor appears on the screen,
then close the appletviewer's window.
 
--- script start ---
#!/bin/sh
TESTJAVA="/net/jdk/export/disk8/local.java/jdk1.4.2/linux-i386"
export TESTJAVA
TEST_BASE="/net/jdk/export/disk8/local.java/jdk1.4.2/ws/j2se/"
JCT_PATH="/net/linux-15/export/home/java/jct"
JT="$JCT_PATH/lib/javatest.jar"
JTREG="$JCT_PATH/lib/jtreg.jar"
TEST_BASE_ROOT="$TEST_BASE/test"
TEST_PACKAGE=javax/swing/JApplet/4707289
TEST_SHORT_NAME=bug4707289
TEST_NAME=$TEST_PACKAGE/$TEST_SHORT_NAME
export TESTSRC="$TEST_BASE_ROOT/$TEST_PACKAGE"
export CLASSPATH=".:$TESTJAVA:$TESTJAVA/lib/tools.jar:$TEST_BASE:$TESTSRC:$JT:$JTREG"
$TESTJAVA/bin/javac -g -classpath "$CLASSPATH" -d . $TEST_BASE_ROOT/$TEST_NAME.java
cp  $TEST_BASE_ROOT/$TEST_NAME.html ./
$TESTJAVA/bin/appletviewer -J-showversion -Xnosecurity $TEST_SHORT_NAME.html
--- script end ---

Test output:
============
java version "1.4.2-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-beta-b04)
Java HotSpot(TM) Client VM (build 1.4.2-beta-b04, mixed mode)


Warning: disabling security.

java.lang.Error: Button "Test" didn't gain the focus
        at bug4707289.destroy(bug4707289.java:52)
        at sun.applet.AppletPanel.run(AppletPanel.java:401)
        at java.lang.Thread.run(Thread.java:536)

Specific machine info:
======================
Hostname: linux-11
OS: RedHat Linux 8.0 (GNOME)


======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger FIXED IN: tiger INTEGRATED IN: mantis-b08 tiger tiger-b03 VERIFIED IN: tiger-beta
24-08-2004

SUGGESTED FIX Name: apR10133 Date: 10/31/2002 ------- bug4707289.java ------- *** /tmp/sccs.9.aGYo Thu Oct 31 18:27:35 2002 --- bug4707289.java Thu Oct 31 18:23:49 2002 *************** *** 15,20 **** --- 15,21 ---- JButton bt; Robot robot; boolean passed = false; + boolean appletStarted = false; public void init() { getContentPane().setLayout(new FlowLayout()); *************** *** 34,39 **** --- 35,46 ---- SwingUtilities.invokeLater(new Runnable() { public void run() { try { + synchronized (bug4707289.this) { + while (!appletStarted) { + bug4707289.this.wait(); + } + } + Thread.sleep(2000); robot.keyPress(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_TAB); } catch(Exception ex) { *************** *** 41,50 **** } } }); - Thread.sleep(2000); } catch(Throwable t) { t.printStackTrace(); } } public void destroy() { --- 48,60 ---- } } }); } catch(Throwable t) { t.printStackTrace(); } + synchronized (bug4707289.this) { + appletStarted = true; + bug4707289.this.notifyAll(); + } } public void destroy() { ###@###.### ======================================================================
24-08-2004

EVALUATION Name: apR10133 Date: 10/31/2002 Although this test passes over jtreg it fails if it run in appletviewer or browsers. The problem is that TAB is pressed/released at improper time. ###@###.### ====================================================================== The bug has been mistakenly marked as fixed in Mantis though actual fix is in Tiger workspace. Committing and marking as fixed in Tiger. ###@###.### 2002-12-04
04-12-2002