8058930: GraphicsEnvironment.getHeadlessProperty() does not work for AIX platform
authorluchsh
Thu, 25 Sep 2014 14:33:03 +0800
changeset 27056 edb2e3793346
parent 27055 57d7b3b1463b
child 27057 2202074399cf
8058930: GraphicsEnvironment.getHeadlessProperty() does not work for AIX platform Reviewed-by: serb
jdk/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java
jdk/test/java/awt/GraphicsEnvironment/TestDetectHeadless/TestDetectHeadless.java
jdk/test/java/awt/GraphicsEnvironment/TestDetectHeadless/TestDetectHeadless.sh
--- a/jdk/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java	Wed Sep 24 15:36:11 2014 +0400
+++ b/jdk/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java	Thu Sep 25 14:33:03 2014 +0800
@@ -182,7 +182,8 @@
                                                      "SunOS".equals(osName) ||
                                                      "FreeBSD".equals(osName) ||
                                                      "NetBSD".equals(osName) ||
-                                                     "OpenBSD".equals(osName)) &&
+                                                     "OpenBSD".equals(osName) ||
+                                                     "AIX".equals(osName)) &&
                                                      (System.getenv("DISPLAY") == null));
                             }
                         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/GraphicsEnvironment/TestDetectHeadless/TestDetectHeadless.java	Thu Sep 25 14:33:03 2014 +0800
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Portions Copyright (c) 2014 IBM Corporation
+ */
+
+public class TestDetectHeadless {
+    public static void main(String[] args) throws Exception {
+        Class.forName("javax.swing.plaf.basic.BasicInternalFrameTitlePane");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/GraphicsEnvironment/TestDetectHeadless/TestDetectHeadless.sh	Thu Sep 25 14:33:03 2014 +0800
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#
+# Portions Copyright (c) 2014 IBM Corporation
+#
+
+# @test
+# @bug 8058930
+# @summary java.awt.GraphicsEnvironment.getHeadlessProperty() does not work for AIX
+#
+# @build TestDetectHeadless
+# @run shell TestDetectHeadless.sh
+
+OS=`uname -s`
+case "$OS" in
+    Windows* | CYGWIN* )
+        echo "Passed"; exit 0 ;;
+    * ) unset DISPLAY ;;
+esac
+
+${TESTJAVA}/bin/java ${TESTVMOPTS} \
+    -cp ${TESTCLASSES} TestDetectHeadless
+
+exit $?