提交 2a3b197b 编写于 作者: A alexsch

8051359: JPopupMenu creation in headless mode with JDK9b23 causes NPE

Reviewed-by: serb, pchelko
上级 ae8936cb
......@@ -386,7 +386,7 @@ public abstract class SunToolkit extends Toolkit
* null or the target can't be found, a null with be returned.
*/
public static AppContext targetToAppContext(Object target) {
if (target == null || GraphicsEnvironment.isHeadless()) {
if (target == null) {
return null;
}
AppContext context = getAppContext(target);
......@@ -460,12 +460,10 @@ public abstract class SunToolkit extends Toolkit
* via targetToAppContext() above.
*/
public static void insertTargetMapping(Object target, AppContext appContext) {
if (!GraphicsEnvironment.isHeadless()) {
if (!setAppContext(target, appContext)) {
// Target is not a Component/MenuComponent, use the private Map
// instead.
appContextMap.put(target, appContext);
}
if (!setAppContext(target, appContext)) {
// Target is not a Component/MenuComponent, use the private Map
// instead.
appContextMap.put(target, appContext);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册