JDK-6366440 : Application deadlocks when printing some text through JTextPane
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2005-12-22
  • Updated: 2010-06-08
  • Resolved: 2006-02-02
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.
JDK 6
6 b70Fixed
Related Reports
Relates :  
Relates :  
Description
I have loaded a text file on to a JTextPane (through setPage() call) and trying to print it by calling JTextPane.print(). As soon as I call this method, the application hangs and does not resond to user inputs after that. 

This is reproducible on SolSparc10 as well as WinXP since the first Mustang build (b39) where this feature was introduced. I checked it in the current b66 PIT build also (where there is a similar bug fix for JEditorPane) and it is reproducible. 

This is an important bug that must be fixed for RC. Otherwise customers will not be able to use the new feature. Moreover, it fails for all content types such as HTML, TXT and RTF with JTextPane.

I have attached a sample test. Execute the sample test as follows:
'java JTextPaneTest sample.txt".
Click the print button. A print dialog would popup. Click on the print button in the dialog. An interactive dialog would appear and the application hangs after that.

Comments
EVALUATION fix for this bug introduced regression 6394028.
15-03-2006

EVALUATION BasicEditorPaneUI modifies document styles on some events. Changing styles requires write lock for the document. Printing thread holds read lock thus we have a deadlock. Changing style takes the write lock even if the new value is the same as the old one. For the printing case document style has all the correct values already. We do not need to change them. Thus we will avoid the deadlock.
22-12-2005