changeset 16298:75f71359ad72

8039273: Font related files should not be modified in ${java.home}/lib Reviewed-by: serb, naoto
author prr
date Thu, 15 Dec 2016 14:30:12 -0800
parents 9cbc15255a49
children 8f4760d6248a
files src/java.desktop/share/classes/sun/awt/FontConfiguration.java
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/share/classes/sun/awt/FontConfiguration.java	Thu Dec 15 20:09:13 2016 +0300
+++ b/src/java.desktop/share/classes/sun/awt/FontConfiguration.java	Thu Dec 15 14:30:12 2016 -0800
@@ -182,11 +182,17 @@
             throw new Error("java.home property not set");
         }
         javaLib = javaHome + File.separator + "lib";
+        String javaConfFonts = javaHome +
+                               File.separator + "conf" +
+                               File.separator + "fonts";
         String userConfigFile = System.getProperty("sun.awt.fontconfig");
         if (userConfigFile != null) {
             fontConfigFile = new File(userConfigFile);
         } else {
-            fontConfigFile = findFontConfigFile(javaLib);
+            fontConfigFile = findFontConfigFile(javaConfFonts);
+            if (fontConfigFile == null) {
+                fontConfigFile = findFontConfigFile(javaLib);
+            }
         }
     }
 
@@ -275,8 +281,11 @@
         return null;
     }
 
-    private File findFontConfigFile(String javaLib) {
-        String baseName = javaLib + File.separator + "fontconfig";
+    private File findFontConfigFile(String dir) {
+        if (!(new File(dir)).exists()) {
+            return null;
+        }
+        String baseName = dir + File.separator + "fontconfig";
         File configFile;
         String osMajorVersion = null;
         if (osVersion != null && osName != null) {