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

8051588: DataTransferer.getInstance throws ClassCastException in headless mode

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