Name: gm110360 Date: 11/08/2002
FULL PRODUCT VERSION :
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
FULL OPERATING SYSTEM VERSION : Microsoft Windows 2000
[Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
Given a synchronized code block within a method that is
compiled using JDK 1.4.x an attempt to execute the code
using JDK 1.2.x results in the following run-time error
message "Exception in thread "main"
java.lang.IllegalMonitorStateException: current thre
d not owner"
REGRESSION. Last worked in version 1.3.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile java source code with synchronized code block in
a method using JDK 1.4.x
2. Run code using JDK 1.4.x Code runs fine.
3. Run code using JDK 1.2.x Run-time error is generated
EXPECTED VERSUS ACTUAL BEHAVIOR :
---BEGIN JDK 1.4.1 ----
As compiled and run with JDK 1.4.1
C:\testsynch>java -version
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build
1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
C:\testsynch>javac -classpath .; Test.java
C:\testsynch>java -cp .; Test
This is a test
C:\testsynch>
--- END JDK 1.4.1 ---
--- BEGIN JDK 1.2.2 ----
Class compiled using JDK 1.4.1 and run with JDK 1.2.2
C:\testsynch>java -version
java version "1.2.2"
Classic VM (build JDK-1.2.2_007, native threads, symcjit)
C:\testsynch>java -cp .; Test
This is a test
Exception in thread "main"
java.lang.IllegalMonitorStateException: current thre
d not owner
at Test.main(Test.java:5)
C:\testsynch>
--- END JDK 1.2.2 ---
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.IllegalMonitorStateException: current thre
d not owner
at Test.main(Test.java:5)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Test {
public static void main(String[] args) {
Test t = new Test();
t.execute();
}
public void execute() {
synchronized(this) {
System.out.println("This is a test");
}
}
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
No known workaround. As a developer of thread-safe
components I use synchronized code blocks frequently.
Unfortunately this prevents me from supporting JDK 1.2.x
end users when compiling with JDK 1.4.x
Release Regression From : 1.4.1
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
(Review ID: 166702)
======================================================================