提交 6cda0437 编写于 作者: P pchelko

8051588: DataTransferer.getInstance throws ClassCastException in headless mode

Reviewed-by: serb, alexsch
上级 5fc3c6db
......@@ -25,6 +25,8 @@
package sun.awt;
import sun.awt.datatransfer.DataTransferer;
import java.awt.*;
import java.awt.dnd.*;
import java.awt.dnd.peer.DragSourceContextPeer;
......@@ -93,4 +95,6 @@ public interface ComponentFactory {
RobotPeer createRobot(Robot target, GraphicsDevice screen)
throws AWTException, HeadlessException;
DataTransferer getDataTransferer();
}
......@@ -25,6 +25,8 @@
package sun.awt;
import sun.awt.datatransfer.DataTransferer;
import java.awt.*;
import java.awt.dnd.*;
import java.awt.dnd.peer.DragSourceContextPeer;
......@@ -401,6 +403,11 @@ public class HeadlessToolkit extends Toolkit
return null;
}
@Override
public DataTransferer getDataTransferer() {
return null;
}
@SuppressWarnings("deprecation")
public FontMetrics getFontMetrics(Font font) {
return tk.getFontMetrics(font);
......
......@@ -205,8 +205,6 @@ public abstract class SunToolkit extends Toolkit
public abstract boolean isTraySupported();
public abstract DataTransferer getDataTransferer();
@SuppressWarnings("deprecation")
public abstract FontPeer getFontPeer(String name, int style);
......
......@@ -86,6 +86,7 @@ import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;
import sun.awt.ComponentFactory;
import sun.util.logging.PlatformLogger;
import sun.awt.AppContext;
......@@ -272,7 +273,7 @@ public abstract class DataTransferer {
* instead, null will be returned.
*/
public static synchronized DataTransferer getInstance() {
return ((SunToolkit) Toolkit.getDefaultToolkit()).getDataTransferer();
return ((ComponentFactory) Toolkit.getDefaultToolkit()).getDataTransferer();
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册