diff --git a/src/share/classes/java/awt/GraphicsEnvironment.java b/src/share/classes/java/awt/GraphicsEnvironment.java index 66ab39a45b1480e38c49c2a0e0565a1a634ea7ea..0f7ad266fbef898548d7c92a50341cff6fb6b085 100644 --- a/src/share/classes/java/awt/GraphicsEnvironment.java +++ b/src/share/classes/java/awt/GraphicsEnvironment.java @@ -181,7 +181,8 @@ public abstract class GraphicsEnvironment { "SunOS".equals(osName) || "FreeBSD".equals(osName) || "NetBSD".equals(osName) || - "OpenBSD".equals(osName)) && + "OpenBSD".equals(osName) || + "AIX".equals(osName)) && (System.getenv("DISPLAY") == null)); } } diff --git a/test/java/awt/GraphicsEnvironment/TestDetectHeadless/TestDetectHeadless.java b/test/java/awt/GraphicsEnvironment/TestDetectHeadless/TestDetectHeadless.java new file mode 100644 index 0000000000000000000000000000000000000000..798977655681c61636aaff1618264040c5f790b1 --- /dev/null +++ b/test/java/awt/GraphicsEnvironment/TestDetectHeadless/TestDetectHeadless.java @@ -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"); + } +} diff --git a/test/java/awt/GraphicsEnvironment/TestDetectHeadless/TestDetectHeadless.sh b/test/java/awt/GraphicsEnvironment/TestDetectHeadless/TestDetectHeadless.sh new file mode 100644 index 0000000000000000000000000000000000000000..6642efa5bd2492ce0ce080641e9e2aeef0d0bf14 --- /dev/null +++ b/test/java/awt/GraphicsEnvironment/TestDetectHeadless/TestDetectHeadless.sh @@ -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 $?