JDK-6794763 : Unexpected behavior of a "copy/paste" operation with some external editors
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: e6u10,6u10
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: linux
  • CPU: generic,arm
  • Submitted: 2009-01-16
  • Updated: 2012-10-01
Related Reports
Relates :  
Description
Test suite name        : JCK-runtime-6b
Tests/test cases       : api/javax_swing/interactive/JTextAreaTests.html#JTextArea (JTextAreaTest0032)

Problem description:
"copy/past" operation doesn't works properly with some external editors. When I tried to copy some text from such external editor as "abiword" into the test's text area I encountered with some strangeness:
    - I waited about 4 minutes for the results. It's very long, I think.
    - Inserted text (copied form external editor) followed by additional symbol: a little square. I tried to copy only the middle of the original string (for eliminating some special symbols which can be in the end of a line) but  the symbol was in any case.

    From other side this behavior was with "Abiword" only. When I used "gedit" I didn't encounter with any problems. 

 abiword - test failed
 gedit - test passed

The problem can be reproducible  on any machine with Linux where "abiword" is installed. For example:
Steps to reproduce:
# ssh ###@###.###ia
# export DISPLAY=:0.0
# /export/jdk/jdk1.6.0_11/bin/java -cp /set/stt/jck_promotions/6b/latest/binaries/JCK-runtime-6b/classes/  javasoft.sqe.tests.api.javax.swing.interactive.JTextArea.JTextAreaTests -TestCaseID JTextAreaTest0032

It's manual test case. You should use VNC for accessing to the machine's display. 
Use "abiword" as external editor for performing the test case.

See also: CR 6788560, 4818143

Below you can find comment of Yochai Cohen:
" Following are our findings & suggestion regarding CR 6788560  linux-arm: unexpected behavior "copy/paste" operation with some external editors:

Searching Sun's bug database, we found this problem surfaced 5 years ago CR 4818143 - that some Java applications hang (for several minutes) when trying to paste data into them, if the data to be pasted was copied from what appears to be buggy applications (such as AbiWord).

This problem occurs on all Java platforms that we have tested, including the standard JDK (1.6.0u11) running on Linux/x86 with AbiWord on Linux/x86.

The hang occurs as part of the following scenario: a paste operation into a Java application results in a call to XClipboard.getContents(). This in turns creates a ClipboardTransferable object whose constructor runs in a loop trying to fetch the clipboard contents in every available data "flavor", eventually calling XSelection.getData(). XSelection.getData() calls upon the source application (i.e. AbiWord) to help with the data conversion, via XlibWrapper.XConvertSelection, and then waits for a reply which should come in the form of an event from the source application. The problem is that the source application does not respond and leaves the Java application hanging for minutes.

The resolution of CR 4818143 was to add a timeout of 10 seconds to paste operations. The current manifestation of problem is that this timeout is measured within a loop (ClipboardTransferable's constructor) which times-out repeatedly per every possible data format. Since there are usually dozens of clipboard formats available, this can result in application hang times measured in minutes.

A potential workaround is to move the timeout sampling point to higher in the call stack - so that 10 seconds would be a maximum timeout, no matter how many data flavors are there. "

Comments
EVALUATION Reproduced with JDK6u22, JDK7b104 and Abiword but it didn't take seconds to paste the string.
07-09-2010