JDK-4274061 : Clipboard does not allow non-String data to be transferred between VM's.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_7
  • CPU: generic
  • Submitted: 1999-09-21
  • Updated: 2000-08-02
  • Resolved: 2000-08-02
Related Reports
Duplicate :  
Description
Clipboard does not allow non-String data to be transferred between VM's, 
even though the API allows arbirtrary objects to be put on the clipboard. 

In Windows:
------------

  The clipboard allows only StringSelection object to 
be transfered between VM's. 

When the clipboard is set with transferable object which is implemented by extending the StringSelection class, 
the getcontent() method of the clipboard returns only a StringSelection object and not 
the transferable object which extends it, and hence it allows only the 
text flavors supported by the StringSelection class to be transfered between VMs. 

When the clipboard is set with a transferable object which doesn't extend StringSelection class, 
the getcontent() method of the clipboard returns null. 

In Solaris(both 2.6 and 2.7) :
------------------------------

 The clipboard doesn't allow any object to be transfered between VM's. 

When the clipboard is set with transferable object which is implemented  by extending the StringSelection class, 
the getcontent() method of the clipboard returns some object (sun.awt.motif.x11Selection@31c260), which is neither 
a  StringSelection object  nor the transferable object which extends StringSelection, hence it 
doesn't allow  transfer of any object (not even string)  between VMs. 

When the clipboard is set with a transferable class which doesn't extend StringSelection class, 
the getcontent() method of the clipboard returns sun.awt.motif.x11Selection@31c260. And hence it 
doesn't allow  transfer of any object (not even string)  between VMs. 

Testcase that reproduces this bug: 

1)TransferableObject.java : Transferable Class which extends StringSelection. 
2)CustomTransferableObject.java : Transferable Class which doesn't extend StringSelection but implements Transferable and ClipboardOwner.
3)TestFrame.java  :  This class provides the GUI to perform copy and paste within JVM 
4)TargetFrame.java : This class provides the target frame to paste the data retrieved from the clipboard for between JVMs. 
  

To Run the sample program for within JVM: 

1) Run ' TestFrame.class' 
2) Enter some data in the text area, and click on the 
   'Copy' from the Menu bar. 
3) Then click on the 'Paste' menuitem from the MenuBar. 

Note: Run the test case using TransferableObject as well as 
CustomTransferableObject ( by commenting and uncommenting the necessary 
line in  TestFrame.java). TransferableObject extends 
StringSelection and CustomTransferable doesn't extend StringSelection. 
Check the behaviour using both the transferable objects. 
  

To Run the sample program for between JVM: 

1) Run ' TestFrame.class' 
2) open another terminal and run 'TargetFrame.class' 
2) Enter some data in the text area on the 'Test Frame', and click on the 
   'Copy' from the Menu bar. 
3) Then click on the 'Paste' menuitem from the MenuBar in the 'Target Frame'. 
  

Note: Run the test case using TransferableObject as well as 
CustomTransferableObject ( by commenting and uncommenting the necessary 
line in  TestFrame.java). TransferableObject extends 
StringSelection and CustomTransferable doesn't extend StringSelection. 
Check the behaviour using both the transferable objects. 

Comments
EVALUATION Not a regression for Kestrel. Committing to Merlin. eric.hawkes@eng 1999-11-08
08-11-1999