Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
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 ----------
|