This is the mail archive of the mailing list for the Java project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix for 'paste'

Currently, you cut 'asdfg' and paste '' if your DataFlavor is stringFlavor. To reproduce, use the Acunia test Datatransfer.TrivialApplication 'Clipboard vb'.

This patch fixes it by returning the object accordingly to the DataFlavor specified by the caller.

2003-12-02 Fernando Nasser <>

        * java/awt/datatransfer/ (getTransferData): Return
        object of type expected by specified DataFlavor.
Index: java/awt/datatransfer/
RCS file: /cvs/gcc/gcc/libjava/java/awt/datatransfer/,v
retrieving revision 1.2
diff -c -p -u -r1.2
--- java/awt/datatransfer/	24 Jun 2003 10:50:21 -0000	1.2
+++ java/awt/datatransfer/	8 Dec 2003 21:53:16 -0000
@@ -140,7 +140,10 @@ getTransferData(DataFlavor flavor) throw
   if (!isDataFlavorSupported(flavor))
     throw new UnsupportedFlavorException(flavor);
-  return(new StringBufferInputStream(data));
+  if (DataFlavor.plainTextFlavor == flavor)
+      return(new StringBufferInputStream(data));
+  else // DataFlavor.stringFlavor
+      return data;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]