8027151: AWT_DnD/Basic_DnD/Automated/DnDMerlinQL/MultipleJVM failing on windows machine
Reviewed-by: anthony, pchelko
--- a/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java Tue Oct 29 19:01:46 2013 +0400
+++ b/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java Tue Oct 29 21:46:03 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1740,6 +1740,14 @@
}
theObject = files;
+ // Target data is a String. Strip terminating NUL bytes. Decode bytes
+ // into characters. Search-and-replace EOLN.
+ } else if (String.class.equals(flavor.getRepresentationClass()) &&
+ isFlavorCharsetTextType(flavor) && isTextFormat(format)) {
+
+ return translateBytesToString(inputStreamToByteArray(str),
+ format, localeTransferable);
+
// Special hack to maintain backwards-compatibility with the brokenness
// of StringSelection. Return a StringReader instead of an InputStream.
// Recur to obtain String and encapsulate.
--- a/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java Tue Oct 29 19:01:46 2013 +0400
+++ b/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java Tue Oct 29 21:46:03 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -271,14 +271,11 @@
throw new InvalidDnDOperationException(e.getMessage());
}
} else if (ret instanceof InputStream) {
- InputStream inputStream = (InputStream)ret;
try {
return DataTransferer.getInstance().
- translateStream(inputStream, df, format, this);
+ translateStream((InputStream)ret, df, format, this);
} catch (IOException e) {
throw new InvalidDnDOperationException(e.getMessage());
- } finally {
- inputStream.close();
}
} else {
throw new IOException("no native data was transfered");