8015453: java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java failed on windows with jdk8 since b86
authorpchelko
Fri, 13 Sep 2013 17:25:31 +0400
changeset 20128 25a1c15eea88
parent 20127 a3a34675d847
child 20129 6dc2b2aa47ac
8015453: java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java failed on windows with jdk8 since b86 Reviewed-by: art, serb
jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java
--- a/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java	Fri Sep 13 11:58:39 2013 +0400
+++ b/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java	Fri Sep 13 17:25:31 2013 +0400
@@ -1765,7 +1765,14 @@
             Reader reader = new InputStreamReader(is, unicode);
 
             theObject = constructFlavoredObject(reader, flavor, Reader.class);
-
+            // Target data is a byte array
+        } else if (byteArrayClass.equals(flavor.getRepresentationClass())) {
+            if(isFlavorCharsetTextType(flavor) && isTextFormat(format)) {
+                theObject = translateBytesToString(inputStreamToByteArray(str), format, localeTransferable)
+                        .getBytes(DataTransferer.getTextCharset(flavor));
+            } else {
+                theObject = inputStreamToByteArray(str);
+            }
             // Target data is an RMI object
         } else if (flavor.isRepresentationClassRemote()) {