United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7124994 [macosx] GUI app is stuck in i18n testing (caused by reference cast)
JDK-7124994 : [macosx] GUI app is stuck in i18n testing (caused by reference cast)

Details
Type:
Bug
Submit Date:
2011-12-26
Status:
Closed
Updated Date:
2012-10-09
Project Name:
JDK
Resolved Date:
2012-03-22
Component:
client-libs
OS:
os_x
Sub-Component:
java.awt
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:
7u4 (b11)

Related Reports

Sub Tasks

Description
This is to port http://java.net/jira/browse/MACOSX_PORT-780 from Jira to bugtraq. 

Environment:
Mac OS X 10.7.2
JDK 7 b222 (problem does not happen in previous build like b221)

Description:

Unzip the attached zip file in one directory. 

[jdkhome]/bin/javac *.java
[jdkhome]/bin/java captureOnScreen

The expected behaivor is that a windows will display. When jdk is b222, the program is stuck there and never ends. The Java frame can not be displayed.

If using previous build like b221, the Java frame can be displayed correctly and everything works fine.

The attached source files are extracted from Java i18n testing framework (Global Suite Media Server) and they are simplified by me as much as possible.

captureOnScreen.java is an AWT Frame with flowlayout. It initializes an instance of class LWRenderTest which implements interface MediaServerTestCase and GUITestCase. The LWRenderTest object initializes an instance of class FontEffectTest which is a subclass of JPanel with some swing components on it.

At captureOnScreen.java, there is the cast between interfaces:
MediaServerTestCase tc = ((MediaServerTestCase)cl.newInstance()); 
LightWeightGUITestCase test = (LightWeightGUITestCase)tc;

If we do not use the refernce cast (conversion), the problem will disapear. The Java Frame can be displayed and the program runs fine in b222. The program without the cast between two interfaces:

//MediaServerTestCase tc = ((MediaServerTestCase)cl.newInstance());
LightWeightGUITestCase test = (LightWeightGUITestCase)cl.newInstance();

Since cast between interfaces is supported in Java and the program with interface cast works fine in previous build like b221, I'd like to file it as a JDK bug.

The interface cast seems to be meaningless in the attached source file, but it's necessary in the real testing framework of media server.

                                    

Comments
EVALUATION

replaceSurfaceData and addDropTarget should use separate locks
                                     
2012-01-25
SUGGESTED FIX

http://hg.openjdk.java.net/jdk7u/jdk7u-osx/jdk/rev/4a8cbf11c3b4
                                     
2012-01-25



Hardware and Software, Engineered to Work Together