JDK-8081787 : [macosx] MalformedURLException is thrown during reading data for application/x-java-url;class=java.net.URL flavor
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 8u45
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • Submitted: 2015-06-03
  • Updated: 2016-01-14
  • Resolved: 2015-08-13
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 JDK 9
8u72Fixed 9 b80Fixed
Description
On Mac OS, the system clipboard containing item copied from Finder throws exception MalformedURLException exception for application/x-java-url;class=java.net.URL flavor.
Test case:

import java.awt.*;
import java.awt.datatransfer.*;

public class PlainText {
    public static void main(String [] args) {
        try {
            Clipboard board = Toolkit.getDefaultToolkit().getSystemClipboard();
            System.out.println(board.getData(new DataFlavor("application/x-java-url;class=java.net.URL")));
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Mac Os X pasteboard returns a property list that consists of one URL, 
but our code supposes to get pure URL.