view patches/fonts-rhel-version.patch @ 2341:e2551d3f64fd

Patch which ensures, that only one fontconfig file will be needed on particular RHEL version.
author ptisnovs
date Fri, 10 Jun 2011 12:39:55 +0200
parents
children
line wrap: on
line source

--- openjdk-orig/jdk/src/solaris/classes/sun/awt/motif/MFontConfiguration.java	2011-06-09 16:04:24.000000000 +0200
+++ openjdk/jdk/src/solaris/classes/sun/awt/motif/MFontConfiguration.java	2011-06-09 16:04:24.000000000 +0200
@@ -169,7 +169,9 @@
                     osVersion = getVersionString(f);
                 } else if ((f = new File("/etc/redhat-release")).canRead()) {
                     osName = "RedHat";
-                    osVersion = getVersionString(f);
+                    // At this time we don't need to distinguish
+                    // between RHEL 6.0 and RHEL 6.1 for example.
+                    osVersion = getMajorVersionString(f);
                 } else if ((f = new File("/etc/turbolinux-release")).canRead()) {
                     osName = "Turbo";
                     osVersion = getVersionString(f);
@@ -208,6 +210,19 @@
         return null;
     }
 
+    /**
+     * Gets the OS major version string from a Linux release-specific file.
+     */
+    private String getMajorVersionString(File f){
+        try {
+            Scanner sc  = new Scanner(f);
+            return sc.findInLine("(\\d)+");
+        }
+        catch (Exception e){
+        }
+        return null;
+    }
+
     private static final String fontsDirPrefix = "$JRE_LIB_FONTS";
 
     protected String mapFileName(String fileName) {