diff options
author | Fernando Nasser <fnasser@redhat.com> | 2003-12-08 23:56:43 +0000 |
---|---|---|
committer | Fernando Nasser <fnasser@gcc.gnu.org> | 2003-12-08 23:56:43 +0000 |
commit | 82650cb7bab27aa656a26899b820927fd64fc306 (patch) | |
tree | d05ce38fd58e197f2cd05aac6a5a0ffc919fb200 | |
parent | 453d6cba7e4efa3c0f83cde4194847e21465712a (diff) | |
download | gcc-82650cb7bab27aa656a26899b820927fd64fc306.zip gcc-82650cb7bab27aa656a26899b820927fd64fc306.tar.gz gcc-82650cb7bab27aa656a26899b820927fd64fc306.tar.bz2 |
StringSelection.java (getTransferData): Return object of type expected by specified DataFlavor.
2003-12-08 Fernando Nasser <fnasser@redhat.com>
* java/awt/datatransfer/StringSelection.java (getTransferData): Return
object of type expected by specified DataFlavor.
From-SVN: r74449
-rw-r--r-- | libjava/ChangeLog | 5 | ||||
-rw-r--r-- | libjava/java/awt/datatransfer/StringSelection.java | 12 |
2 files changed, 15 insertions, 2 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 4a0ed4d..e51933c 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,5 +1,10 @@ 2003-12-08 Fernando Nasser <fnasser@redhat.com> + * java/awt/datatransfer/StringSelection.java (getTransferData): Return + object of type expected by specified DataFlavor. + +2003-12-08 Fernando Nasser <fnasser@redhat.com> + * java/awt/datatransfer/DataFlavor.java (getParameter): Fix off-by-one error which was clipping off the first character of a parameter value. diff --git a/libjava/java/awt/datatransfer/StringSelection.java b/libjava/java/awt/datatransfer/StringSelection.java index 6db7450..51addb7 100644 --- a/libjava/java/awt/datatransfer/StringSelection.java +++ b/libjava/java/awt/datatransfer/StringSelection.java @@ -38,7 +38,7 @@ exception statement from your version. */ package java.awt.datatransfer; -import java.io.StringBufferInputStream; +import java.io.StringReader; import java.io.IOException; /** @@ -140,7 +140,15 @@ getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, if (!isDataFlavorSupported(flavor)) throw new UnsupportedFlavorException(flavor); - return(new StringBufferInputStream(data)); + if (DataFlavor.plainTextFlavor == flavor) + /* The behavior of this method for DataFlavor.plainTextFlavor and + equivalent DataFlavors is inconsistent with the definition of + DataFlavor.plainTextFlavor. We choose to do like Sun's implementation + and return a Reader instead of an InputString. */ + /* return(new StringBufferInputStream(data)); */ + return(new StringReader(data)); + else // DataFlavor.stringFlavor + return data; } /*************************************************************************/ |