Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8160941

"text/uri-list" dataflavor concats the first two strings

XMLWordPrintable

    • b01
    • x86
    • other

        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.

              mcherkas Mikhail Cherkasov (Inactive)
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: