8212701: remove sun.desktop property from launcher code
Reviewed-by: serb, alanb, rriggs
This commit is contained in:
parent
f7d8bb2c70
commit
e3e016b54c
src
demo/share/java2d/J2DBench/src/j2dbench/report
java.base
share
unix/native/libjava
windows/native/libjava
java.desktop
share/classes
unix/classes/sun/awt
test/jdk/java/awt/Toolkit/SunDesktopProperty
@ -1223,8 +1223,6 @@ public class XMLHTMLReporter {
|
||||
sysProps.get("os.version") + "</td></tr>");
|
||||
buffer.append("<tr><td bgcolor=\"#f0f0f0\">os.arch</td><td>" +
|
||||
sysProps.get("os.arch") + "</td></tr>");
|
||||
buffer.append("<tr><td bgcolor=\"#f0f0f0\">sun.desktop</td><td>" +
|
||||
sysProps.get("sun.desktop") + "</td></tr>");
|
||||
|
||||
buffer.append("</table>");
|
||||
|
||||
|
@ -93,7 +93,6 @@ public final class SystemProps {
|
||||
putIfAbsent(props, "awt.toolkit", raw.propDefault(Raw._awt_toolkit_NDX));
|
||||
putIfAbsent(props, "java.awt.headless", raw.propDefault(Raw._java_awt_headless_NDX));
|
||||
putIfAbsent(props, "java.awt.graphicsenv", raw.propDefault(Raw._java_awt_graphicsenv_NDX));
|
||||
putIfAbsent(props, "sun.desktop", raw.propDefault(Raw._sun_desktop_NDX));
|
||||
putIfAbsent(props, "sun.arch.abi", raw.propDefault(Raw._sun_arch_abi_NDX));
|
||||
putIfAbsent(props, "sun.arch.data.model", raw.propDefault(Raw._sun_arch_data_model_NDX));
|
||||
putIfAbsent(props, "sun.os.patch.level", raw.propDefault(Raw._sun_os_patch_level_NDX));
|
||||
@ -222,8 +221,7 @@ public final class SystemProps {
|
||||
@Native private static final int _sun_arch_data_model_NDX = 1 + _sun_arch_abi_NDX;
|
||||
@Native private static final int _sun_cpu_endian_NDX = 1 + _sun_arch_data_model_NDX;
|
||||
@Native private static final int _sun_cpu_isalist_NDX = 1 + _sun_cpu_endian_NDX;
|
||||
@Native private static final int _sun_desktop_NDX = 1 + _sun_cpu_isalist_NDX;
|
||||
@Native private static final int _sun_io_unicode_encoding_NDX = 1 + _sun_desktop_NDX;
|
||||
@Native private static final int _sun_io_unicode_encoding_NDX = 1 + _sun_cpu_isalist_NDX;
|
||||
@Native private static final int _sun_jnu_encoding_NDX = 1 + _sun_io_unicode_encoding_NDX;
|
||||
@Native private static final int _sun_os_patch_level_NDX = 1 + _sun_jnu_encoding_NDX;
|
||||
@Native private static final int _sun_stderr_encoding_NDX = 1 + _sun_os_patch_level_NDX;
|
||||
|
@ -221,11 +221,6 @@ Java_jdk_internal_util_SystemProps_00024Raw_platformProperties(JNIEnv *env, jcla
|
||||
*/
|
||||
PUTPROP(propArray, _java_awt_graphicsenv_NDX, sprops->graphics_env);
|
||||
|
||||
/*
|
||||
* The sun.desktop property is currently only set for Gnome and Windows desktops.
|
||||
*/
|
||||
PUTPROP(propArray, _sun_desktop_NDX, sprops->desktop);
|
||||
|
||||
PUTPROP_PlatformString(propArray, _java_io_tmpdir_NDX, sprops->tmp_dir);
|
||||
|
||||
PUTPROP_PlatformString(propArray, _user_name_NDX, sprops->user_name);
|
||||
|
@ -82,8 +82,6 @@ typedef struct {
|
||||
|
||||
char *patch_level; /* patches/service packs installed */
|
||||
|
||||
char *desktop; /* Desktop name. */
|
||||
|
||||
#ifdef MACOSX
|
||||
// These are for proxy-related information.
|
||||
// Note that if these platform-specific extensions get out of hand we should make a new
|
||||
|
@ -452,13 +452,6 @@ GetJavaProperties(JNIEnv *env)
|
||||
#endif /* MACOSX */
|
||||
|
||||
sprops.os_arch = ARCHPROPNAME;
|
||||
|
||||
if (getenv("GNOME_DESKTOP_SESSION_ID") != NULL) {
|
||||
sprops.desktop = "gnome";
|
||||
}
|
||||
else {
|
||||
sprops.desktop = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* ABI property (optional) */
|
||||
|
@ -577,7 +577,6 @@ GetJavaProperties(JNIEnv* env)
|
||||
#else
|
||||
sprops.os_arch = "unknown";
|
||||
#endif
|
||||
sprops.desktop = "windows";
|
||||
}
|
||||
|
||||
/* Endianness of platform */
|
||||
|
@ -657,13 +657,14 @@ public class UIManager implements Serializable
|
||||
if (osType == OSInfo.OSType.WINDOWS) {
|
||||
return "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
|
||||
} else {
|
||||
String desktop = AccessController.doPrivileged(new GetPropertyAction("sun.desktop"));
|
||||
Toolkit toolkit = Toolkit.getDefaultToolkit();
|
||||
if ("gnome".equals(desktop) &&
|
||||
toolkit instanceof SunToolkit &&
|
||||
((SunToolkit) toolkit).isNativeGTKAvailable()) {
|
||||
// May be set on Linux and Solaris boxs.
|
||||
return "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
|
||||
if (toolkit instanceof SunToolkit) {
|
||||
SunToolkit suntk = (SunToolkit)toolkit;
|
||||
String desktop = suntk.getDesktop();
|
||||
boolean gtkAvailable = suntk.isNativeGTKAvailable();
|
||||
if ("gnome".equals(desktop) && gtkAvailable) {
|
||||
return "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
|
||||
}
|
||||
}
|
||||
if (osType == OSInfo.OSType.MACOSX) {
|
||||
if (toolkit.getClass() .getName()
|
||||
|
@ -803,8 +803,9 @@ public class SynthLookAndFeel extends BasicLookAndFeel {
|
||||
*/
|
||||
private static boolean useLAFConditions() {
|
||||
String language = Locale.getDefault().getLanguage();
|
||||
Toolkit tk = Toolkit.getDefaultToolkit();
|
||||
String desktop =
|
||||
AccessController.doPrivileged(new GetPropertyAction("sun.desktop"));
|
||||
(tk instanceof SunToolkit) ? ((SunToolkit)tk).getDesktop() : null;
|
||||
|
||||
boolean isCjkLocale = (Locale.CHINESE.getLanguage().equals(language) ||
|
||||
Locale.JAPANESE.getLanguage().equals(language) ||
|
||||
|
@ -1823,6 +1823,10 @@ public abstract class SunToolkit extends Toolkit
|
||||
return sunAwtDisableMixing.booleanValue();
|
||||
}
|
||||
|
||||
public String getDesktop() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the native GTK libraries are available. The
|
||||
* default implementation returns false, but UNIXToolkit overrides this
|
||||
|
@ -93,6 +93,14 @@ public abstract class UNIXToolkit extends SunToolkit
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDesktop() {
|
||||
String gsi = AccessController.doPrivileged(
|
||||
(PrivilegedAction<String>) ()
|
||||
-> System.getenv("GNOME_SESSION_ID"));
|
||||
return (gsi != null) ? "gnome" : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the native GTK libraries are capable of being
|
||||
* loaded and are expected to work properly, false otherwise. Note
|
||||
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
@test
|
||||
@bug 8212701
|
||||
@summary verify sun.desktop system property is not set by default.
|
||||
*/
|
||||
|
||||
public class CheckSunDesktopProperty {
|
||||
|
||||
public static void main(String[] args) {
|
||||
String pjProp = System.getProperty("sun.desktop");
|
||||
if (pjProp != null) {
|
||||
throw new RuntimeException("pjProp = " + pjProp);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user