JDK-4908704 : Regression-test java/beans/PropertyDescriptor/bug4634390.java fails
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.beans
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_9,solaris_10,windows_xp
  • CPU: x86
  • Submitted: 2003-08-19
  • Updated: 2003-10-17
  • Resolved: 2003-09-05
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
5.0 tigerFixed
Related Reports
Relates :  
Description

Name: vsR10238			Date: 08/19/2003


Filed By       : J2SE-SQA [###@###.###
JDK            : JDK1.5.0-b15
Testbase       : Regression-test
Platform[s]    : Windows XP Home, Solaris 10 (sparc) (GNOME), Solaris 9 (x86) (CDE)
Falling test[s]:
         java/beans/PropertyDescriptor/bug4634390.java

Regression-test java/beans/PropertyDescriptor/bug4634390.java test fails with JDK1.5.0-b15.
The test passes with JDK1.5.0-b14, b13, b12.

The test also fails with JDK1.4.2-b28 (see 4634390).

The hashCode comparison fails for instances of the PropertyDescriptor class.

The failure is probably caused by changes in PropertyDescriptor.hashCode made for JDK1.5.0-b15
(see java/beans/PropertyDescriptor.java).

Test source location:
=====================
/java/re/jdk/1.5.0/promoted/latest/ws/j2se/test/java/beans/PropertyDescriptor/bug4634390.java

jtr file location:
==================
/net/jtgb4u4c.sfbay/export/sail15/results.2/tiger/b15/regtest/x86/sol9_x86_cde_smp_linux-6/workDir/test/java/beans/PropertyDescriptor/bug4634390.jtr

How to reproduce:
=================
Run the following script (you may need to change its variables)

--- script start ---
#!/bin/sh

RESULT_DIR=`pwd`
WORK_DIR=$RESULT_DIR/workDir/test
REPORT_DIR=$RESULT_DIR/reportDir
JT_HOME="/net/linux-15/export/home/java/jct"
JAVA_HOME="/net/linux-15/export/home/java/jdk1.5.0/x86"
TEST_BASE_PATH="/net/linux-15/export/home/java/regtest.tiger/test"

TESTWITH=$JAVA_HOME
TESTJAVA=$JAVA_HOME

JTOPTS="-server"
TESTVMOPTS="-server"

CLASSPATH="$JT_HOME/classes:$JT_HOME/lib/javatest.jar:$JT_HOME/lib/jtreg.jar:$JT_HOME/jemmy/jemmy.jar"

export JAVA_HOME
export JT_HOME
export TESTWITH
export CLASSPATH

mkdir -p $WORK_DIR/scratch 2>&1
mkdir -p $WORK_DIR/jtData 2>&1
mkdir -p $REPORT_DIR 2>&1

#rm $WORK_DIR/jtData/ResultCache.jtw 2>&1

cd $WORK_DIR/scratch

$JAVA_HOME/bin/java -cp $CLASSPATH $JTOPTS -DenvVars=TESTJAVAHOME=$JAVA_HOME,TESTVMOPTS=$TESTVMOPTS,DISPLAY=:0,HOME=$HOME/.regtest,PATH=/bin:/usr/bin,CPAPPEND=$JT_HOME/jemmy/jemmy.jar,TZ=,LC_ALL=en_US,LC_CTYPE=en_US,LANG=en_US,LPDEST= -DDISPLAY=:0 -DlocalHost="linux-6" -Dprogram=jtreg com.sun.javatest.regtest.Main -a -v default -batch -params -w "$WORK_DIR" -r "$REPORT_DIR" -t "$TEST_BASE_PATH" "$TEST_BASE_PATH/java/beans/PropertyDescriptor/bug4634390.java"

--- script end ---

Test output (jtr part):
=======================
----------System.out:(1/79)----------
ERROR: hashCode not equal displayedMnemonicIndex for class javax.swing.JButton
----------System.err:(14/931)----------
java.lang.RuntimeException: ERROR: hashCode not equal displayedMnemonicIndex for class javax.swing.JButton
	at bug4634390.testClass(bug4634390.java:86)
	at bug4634390.main(bug4634390.java:30)
	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:324)
	at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:82)
	at java.lang.Thread.run(Thread.java:549)

JavaTest Message: Test threw exception: java.lang.RuntimeException: ERROR: hashCode not equal displayedMnemonicIndex for class javax.swing.JButton
JavaTest Message: shutting down test

STATUS:Failed.`main' threw exception: java.lang.RuntimeException: ERROR: hashCode not equal displayedMnemonicIndex for class javax.swing.JButton
result: Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: ERROR: hashCode not equal displayedMnemonicIndex for class javax.swing.JButton


test result: Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: ERROR: hashCode not equal displayedMnemonicIndex for class javax.swing.JButton


Specific machine info:
======================
Hostname: linux-21
OS: Windows XP Home
Hostname: linux-6
OS: Solaris 9 (x86) (CDE)
Hostname: linux-8
OS: Solaris 10 (sparc) (GNOME)



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

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger FIXED IN: tiger INTEGRATED IN: tiger tiger-b19 VERIFIED IN: tiger
14-06-2004

SUGGESTED FIX For the hashCode fix, should not use super hashCode and the getClass0 and references should not be used. WeakReferences to the declaring classes should be held for the read and write methods so that the Method can be reconstituted when gc'd.
11-06-2004

EVALUATION This problem was introduced from the fix in 4809008. There are a few things wrong with the hashCode calculation in PropertyDescriptor and IndexedPropertyDescriptor: 1. PropertyDescriptor.hashCode should not call super since FeatureDescriptor doesn't overload hashCode. The FeatureDescriptor hash code is based on the object hashCode. 2. Should not use getClass0() since a PropertyDesciptor can have a different method class for it's read and write method. This leads to antother subtle bug which will be explained below. 3. Should not use the References in the hashCode calculations since these will all be unique objects and whethere get() has a value is non-deterministic since SoftReferences can be lost at the discresion of the Garbage collector. After a little more investigation, I noticed a subtle bug with method refetching algorithm in the PropertyDescriptor: the shared FeatureDescriptor class Reference may not be the same for both the read and write methods. Take for example, the PropertyDescriptor "fubar" derived from the class hierarchy: public class Foo { public void setFubar(Fubar f) { } public class Bar { public Fubar getFubar() { } The declaring class for the setter/write method setFubar() is Foo and the declaring class for the getter/read method getFubar() is Bar. Currently, precedence is given to the declaring class of the read method (Bar) so if the write method reference is lost, the Bar class is searched for "setFubar" and a method not found exception will be thrown. The solution is to provide WeakReferences to the declaring classes of both the read and write methods. The same logic applies to IndexedPropertyDescriptor and to a lesser extent EventSetDescriptor. This bug does not effect MethodDescriptor. ###@###.### 2003-08-19
19-08-2003