From 3b1cf952f8e5243da26e6e8fe40546680a2f0a03 Mon Sep 17 00:00:00 2001 From: luchsh Date: Thu, 25 Sep 2014 14:33:03 +0800 Subject: [PATCH] 8058930: GraphicsEnvironment.getHeadlessProperty() does not work for AIX platform Reviewed-by: serb --- .../classes/java/awt/GraphicsEnvironment.java | 3 +- .../TestDetectHeadless.java | 32 +++++++++++++ .../TestDetectHeadless/TestDetectHeadless.sh | 47 +++++++++++++++++++ 3 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 test/java/awt/GraphicsEnvironment/TestDetectHeadless/TestDetectHeadless.java create mode 100644 test/java/awt/GraphicsEnvironment/TestDetectHeadless/TestDetectHeadless.sh diff --git a/src/share/classes/java/awt/GraphicsEnvironment.java b/src/share/classes/java/awt/GraphicsEnvironment.java index 66ab39a45..0f7ad266f 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 000000000..798977655 --- /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 000000000..6642efa5b --- /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 $? -- GitLab