Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6707023
Votes 0
Synopsis Chinese Characters in JTextPane Cause Pane to Hang
Category java:classes_awt
Reported Against
Release Fixed 7(b48), 5.0u18-rev(b04) (Bug ID:2167181) , 6u7-rev(b14) (Bug ID:2167390) , 6u12(b02) (Bug ID:2168468) , 6u11-rev(b04) (Bug ID:2170489)
State 10-Fix Delivered, bug
Priority: 3-Medium
Related Bugs 2167182
Submit Date 26-MAY-2008
Description
FULL PRODUCT VERSION :
 customer  Dual-Core CPU

ADDITIONAL OS VERSION INFORMATION :
Windows XP Professional, 2002, Service Pack 2

EXTRA RELEVANT SYSTEM CONFIGURATION :
 customer  Dual-Core CPU

A DESCRIPTION OF THE PROBLEM :
Enter a detailed description of the problem. Please describe only one problem per report. For multiple problems, file a separate report for each one.

Typing Chinese characters into a JTextPane causes a string of exceptions to occur and the JTextPane itself freezes.

This issue can be replicated by compiling the sample application provided by Sun at the following URL and embedding the application into an applet:

http://java.sun.com/docs/books/tutorial/uiswing/examples/components/index.html#TextSamplerDemo

This issue can also be replicated using JRE 1.5 and JRE 1.6 update 10 beta.

Note that this issue only occurs on dual core machines.

We had originally seen this problem in our own application and raised this a bug with you (review ID: 1234725).

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :

1. Download the code provided by Sun at the following URL:

http://java.sun.com/docs/books/tutorial/uiswing/examples/components/index.html#TextSamplerDemo

2. Create a simple class to package this application as an applet and a simple HTML page to load the applet (see the source code packaged with this report).

3. Open the webpage to launch the application.

4. Remove the text in the bottom-right editing pane.

5. Change the input language to the following:

Language: Chinese (Taiwan)
Keyboard: Chinese (Traditional) - Quick

6. Use a combintation of the A, S, D, F and enter keys to generate Chinese characters. Randomly click before/after previous characters and continue typing. Generally within 2 minutes a mass of exceptions will occur and the JTextPane will hang.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Typing Chinese characters will not cause exceptions and will not hang the text pane.
ACTUAL -
Typing Chinese characters causes exceptions and hangs the text pane.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Attached Seperatly

REPRODUCIBILITY :
This bug can be reproduced always.
Posted Date : 2008-05-26 09:52:24.0
Work Around
N/A
Evaluation
The reason for this behavior is that in some cases input events are posted to several AWT threads at once, and eventually all these threads call to Swing attempting to do re-layout at the same time. Swing is not thread-safe, so it messes up its internal structures which leads to spurious NPEs, deadlocks etc. preventing an applet from responding.

Re-assigning to the AWT team.
Posted Date : 2008-08-21 11:19:27.0

I couldn't reproduce the problem on my WinXP desktop so far... After a quick look to the code I have found a single suspicious place in WInputMethod.java:

    public void inquireCandidatePosition()
    {
        ...
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                ...
            }
        });
    }

This code is obviously must be rewritten because EventQueue methods know nothing about AppContexts, and the Runnable may be executed on wrong EDT.
Posted Date : 2008-08-26 16:55:44.0
Comments
  
  Include a link with my name & email   

Submitted On 02-JUL-2008
Ephox
Our affected client reports that this affects them on Java 1.5.0.7



PLEASE NOTE: JDK6 is formerly known as Project Mustang