JDK-8160941 : "text/uri-list" dataflavor concats the first two strings
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 8u91
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: other
  • CPU: x86
  • Submitted: 2016-07-07
  • Updated: 2017-11-29
  • Resolved: 2016-07-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8u152 b01Fixed
Related Reports
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Darwin MacPro-Robin.local 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64

A DESCRIPTION OF THE PROBLEM :
The backport of issue JDK-8136763 introduced a new bug.

When you copy-paste, or drag-and-drop 2 files, the data in the transferable for data flavor "text/uri-list" concats the strings.

For example, if you drag-and-drop files:
/Users/robin/Desktop/file1.txt
/Users/robin/Desktop/file2.txt

the transferable wil contain
/Users/robin/Desktop/file1.txt/Users/robin/Desktop/file2.txt

The problem is located in the CDataTransferer#translateBytes method, which is missing an sb.append(separator); call

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Follow the steps of the manual testcase available in the OpenJDK (test/java/awt/datatransfer/DataFlavor/MacOsXFileAndMultipleFileCopingTest/MacOsXFileAndMultipleFileCopingTest.java).

This test case fails on jdk8, but succeeds on jdk9

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The test case succeeds
ACTUAL -
The paths of the first two files are grouped into one string, making it impossible to retrieve the 2 separate paths

REPRODUCIBILITY :
This bug can be reproduced always.


Comments
See the discussion: [8] Review request JI-9041413: [macosx]"text/uri-list" dataflavor concats the first two strings http://mail.openjdk.java.net/pipermail/awt-dev/2016-July/011620.html The proposed webrev: http://cr.openjdk.java.net/~alexsch/robin.stevens/8160941/webrev.00/ Push the fix with the user id: rstevens hg commit -u rstevens ------------ 8160941: "text/uri-list" dataflavor concats the first two strings ------------
08-07-2016