8212703: Remove sun.java2d.fontpath property from java launcher code
Reviewed-by: alanb, rriggs
This commit is contained in:
parent
a5ed4e3e73
commit
8895605e66
src/java.base
share
unix/native/libjava
windows/native/libjava
test/jdk/java/awt/font/FontPathEnvTest
@ -92,7 +92,6 @@ public final class SystemProps {
|
||||
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.java2d.fontpath", raw.propDefault(Raw._sun_java2d_fontpath_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));
|
||||
@ -219,8 +218,7 @@ public final class SystemProps {
|
||||
@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_java2d_fontpath_NDX = 1 + _sun_io_unicode_encoding_NDX;
|
||||
@Native private static final int _sun_jnu_encoding_NDX = 1 + _sun_java2d_fontpath_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;
|
||||
@Native private static final int _sun_stdout_encoding_NDX = 1 + _sun_stderr_encoding_NDX;
|
||||
|
@ -220,7 +220,6 @@ Java_jdk_internal_util_SystemProps_00024Raw_platformProperties(JNIEnv *env, jcla
|
||||
* This property may be removed if that mechanism is redesigned
|
||||
*/
|
||||
PUTPROP(propArray, _java_awt_graphicsenv_NDX, sprops->graphics_env);
|
||||
PUTPROP_PlatformString(propArray, _sun_java2d_fontpath_NDX, sprops->font_dir);
|
||||
|
||||
/*
|
||||
* The sun.desktop property is currently only set for Gnome and Windows desktops.
|
||||
|
@ -46,7 +46,6 @@ typedef struct {
|
||||
#endif
|
||||
|
||||
nchar *tmp_dir;
|
||||
nchar *font_dir;
|
||||
nchar *user_dir;
|
||||
|
||||
char *file_separator;
|
||||
|
@ -407,10 +407,6 @@ GetJavaProperties(JNIEnv *env)
|
||||
sprops.awt_toolkit = "sun.awt.X11.XToolkit";
|
||||
#endif
|
||||
|
||||
/* This is used only for debugging of font problems. */
|
||||
v = getenv("JAVA2D_FONTPATH");
|
||||
sprops.font_dir = v ? v : NULL;
|
||||
|
||||
#ifdef SI_ISALIST
|
||||
/* supported instruction sets */
|
||||
{
|
||||
|
@ -379,11 +379,6 @@ GetJavaProperties(JNIEnv* env)
|
||||
/* Java2D properties */
|
||||
sprops.graphics_env = "sun.awt.Win32GraphicsEnvironment";
|
||||
|
||||
{ /* This is used only for debugging of font problems. */
|
||||
WCHAR *path = _wgetenv(L"JAVA2D_FONTPATH");
|
||||
sprops.font_dir = (path != NULL) ? _wcsdup(path) : NULL;
|
||||
}
|
||||
|
||||
/* OS properties */
|
||||
{
|
||||
char buf[100];
|
||||
|
91
test/jdk/java/awt/font/FontPathEnvTest/FontPathEnvTest.java
Normal file
91
test/jdk/java/awt/font/FontPathEnvTest/FontPathEnvTest.java
Normal file
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 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 8212703
|
||||
* @summary Test JAVA2D_FONTPATH env. var does not set a system property
|
||||
*/
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class FontPathEnvTest {
|
||||
|
||||
public static void main(String args[]) {
|
||||
String env = System.getenv("JAVA2D_FONTPATH");
|
||||
if (env == null) {
|
||||
createChild();
|
||||
} else {
|
||||
String prop = System.getProperty("sun.java2d.fontpath");
|
||||
if (prop != null && env.equals(prop)) {
|
||||
throw new RuntimeException("sun.java2d.fontpath property set");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void createChild() {
|
||||
String cpDir = System.getProperty("java.class.path");
|
||||
Map<String, String> env = new HashMap<String, String>();
|
||||
env.put("JAVA2D_FONTPATH", "anyValue");
|
||||
String jHome = System.getProperty("java.home");
|
||||
String jCmd = jHome + File.separator + "bin" + File.separator + "java";
|
||||
int exitValue = doExec(env, jCmd, "-cp", cpDir, "FontPathEnvTest");
|
||||
if (exitValue != 0) {
|
||||
throw new RuntimeException("Test Failed");
|
||||
}
|
||||
}
|
||||
|
||||
static int doExec(Map<String, String> envToSet, String... cmds) {
|
||||
Process p = null;
|
||||
ProcessBuilder pb = new ProcessBuilder(cmds);
|
||||
Map<String, String> env = pb.environment();
|
||||
for (String cmd : cmds) {
|
||||
System.out.print(cmd + " ");
|
||||
}
|
||||
System.out.println();
|
||||
if (envToSet != null) {
|
||||
env.putAll(envToSet);
|
||||
}
|
||||
BufferedReader rdr = null;
|
||||
try {
|
||||
pb.redirectErrorStream(true);
|
||||
p = pb.start();
|
||||
rdr = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
||||
String in = rdr.readLine();
|
||||
while (in != null) {
|
||||
in = rdr.readLine();
|
||||
System.out.println(in);
|
||||
}
|
||||
p.waitFor();
|
||||
p.destroy();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return p.exitValue();
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user