From e506f19d5a3aa9f5af62fcfdf0bed582f64faf27 Mon Sep 17 00:00:00 2001 From: bagiras Date: Tue, 29 Oct 2013 21:46:03 +0400 Subject: [PATCH] 8027151: AWT_DnD/Basic_DnD/Automated/DnDMerlinQL/MultipleJVM failing on windows machine Reviewed-by: anthony, pchelko --- .../classes/sun/awt/datatransfer/DataTransferer.java | 10 +++++++++- .../classes/sun/awt/dnd/SunDropTargetContextPeer.java | 7 ++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/share/classes/sun/awt/datatransfer/DataTransferer.java b/src/share/classes/sun/awt/datatransfer/DataTransferer.java index fab61893a..3d79770b0 100644 --- a/src/share/classes/sun/awt/datatransfer/DataTransferer.java +++ b/src/share/classes/sun/awt/datatransfer/DataTransferer.java @@ -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 @@ search: } 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. diff --git a/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java b/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java index ed5b2b8b9..d44a0064c 100644 --- a/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java +++ b/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java @@ -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 @@ public abstract class SunDropTargetContextPeer implements DropTargetContextPeer, 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"); -- GitLab