changeset 7837:8268d82995af jdk7u75-b08

8051359: JPopupMenu creation in headless mode with JDK9b23 causes NPE Reviewed-by: serb, pchelko
author dmarkov
date Wed, 17 Sep 2014 12:59:08 +0400
parents 59e7d20cef24
children 92c585d80cd4
files src/share/classes/sun/awt/SunToolkit.java
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/awt/SunToolkit.java	Wed Nov 05 16:00:40 2014 +0400
+++ b/src/share/classes/sun/awt/SunToolkit.java	Wed Sep 17 12:59:08 2014 +0400
@@ -378,7 +378,7 @@
      * 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);
@@ -452,12 +452,10 @@
      * 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);
         }
     }