JDK-8077016 : [macosx] Image transfer through System Clipboard is broken in 1.8.0_40 on Mac OS X
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 8u40
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: os_x
  • CPU: x86
  • Submitted: 2015-03-22
  • Updated: 2016-06-02
  • Resolved: 2016-06-02
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 9
9Resolved
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
Java(TM) SE Runtime Environment (build 1.8.0_40-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)


ADDITIONAL OS VERSION INFORMATION :
Mac OS X 10.10.1

A DESCRIPTION OF THE PROBLEM :
Image can not be retrieved from a system clipboard. Runtime exception is thrown.

1. Copy any image into a system clipboard in any external application (Paintbrush, Chrome, Safari)
2. Get data using DataFlavor.imageFlavor from a clipboard. 

REGRESSION.  Last worked in version 8u31

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No runtime exception. Clipboard.getData(DataFlavor.imageFlavor) should return instance of Image.
ACTUAL -
Exception in thread "main" java.lang.NoSuchMethodError: createImageUsingNativeSize
	at sun.lwawt.macosx.CDataTransferer.getImageForByteStream(Native Method)
	at sun.lwawt.macosx.CDataTransferer.platformImageBytesToImage(CDataTransferer.java:238)
	at sun.awt.datatransfer.DataTransferer.translateBytes(DataTransferer.java:1659)
	at sun.lwawt.macosx.CDataTransferer.translateBytes(CDataTransferer.java:142)
	at sun.awt.datatransfer.SunClipboard.getData(SunClipboard.java:236)
	at Main.main(Main.java:16)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;

public class Main {

    public static void main(String a[])
    {
        final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
        if (clipboard.isDataFlavorAvailable(DataFlavor.imageFlavor))
        {
            try
            {
                System.out.println(clipboard.getData(DataFlavor.imageFlavor));
            }
            catch (UnsupportedFlavorException | IOException e)
            {
                e.printStackTrace();
            }
        }

    }
}
---------- END SOURCE ----------


Comments
This is the regression from the fix JDK-8040279
23-07-2015

The issue is not reproduced in JDK 9 because of the fix JDK-8037371 But it still is reproduced in JDK 8u.
23-07-2015

Still an open question - is it 8u40 regression? Does it affect 8u20? 8 GA?
08-04-2015