diff --git a/src/java.desktop/unix/classes/sun/font/FcFontConfiguration.java b/src/java.desktop/unix/classes/sun/font/FcFontConfiguration.java index 328e2454842..27d6773105e 100644 --- a/src/java.desktop/unix/classes/sun/font/FcFontConfiguration.java +++ b/src/java.desktop/unix/classes/sun/font/FcFontConfiguration.java @@ -317,42 +317,14 @@ public final class FcFontConfiguration extends FontConfiguration { return; } try { - File f; - if ((f = new File("/etc/lsb-release")).canRead()) { - /* Ubuntu and (perhaps others) use only lsb-release. - * Syntax and encoding is compatible with java properties. - * For Ubuntu the ID is "Ubuntu". - */ - Properties props = new Properties(); - try (FileInputStream fis = new FileInputStream(f)) { - props.load(fis); - } - osName = extractInfo(props.getProperty("DISTRIB_ID")); - osVersion = extractInfo(props.getProperty("DISTRIB_RELEASE")); - } else if ((f = new File("/etc/redhat-release")).canRead()) { - osName = "RedHat"; - osVersion = getVersionString(f); - } else if ((f = new File("/etc/SuSE-release")).canRead()) { - osName = "SuSE"; - osVersion = getVersionString(f); - } else if ((f = new File("/etc/turbolinux-release")).canRead()) { - osName = "Turbo"; - osVersion = getVersionString(f); - } else if ((f = new File("/etc/fedora-release")).canRead()) { - osName = "Fedora"; - osVersion = getVersionString(f); - } else if ((f = new File("/etc/os-release")).canRead()) { + File f = new File("/etc/os-release"); + if (f.canRead()) { Properties props = new Properties(); try (FileInputStream fis = new FileInputStream(f)) { props.load(fis); } - osName = extractInfo(props.getProperty("NAME")); + osName = extractInfo(props.getProperty("ID")); osVersion = extractInfo(props.getProperty("VERSION_ID")); - if (osName.equals("SLES")) { - osName = "SuSE"; - } else { - osName = extractInfo(props.getProperty("ID")); - } } } catch (Exception e) { if (FontUtilities.debugFonts()) { diff --git a/src/java.desktop/unix/classes/sun/font/MFontConfiguration.java b/src/java.desktop/unix/classes/sun/font/MFontConfiguration.java index 3d7e68d8dea..f5a8fe8b3c0 100644 --- a/src/java.desktop/unix/classes/sun/font/MFontConfiguration.java +++ b/src/java.desktop/unix/classes/sun/font/MFontConfiguration.java @@ -91,42 +91,14 @@ public final class MFontConfiguration extends FontConfiguration { if (osName.equals("Linux")) { try { - File f; - if ((f = new File("/etc/fedora-release")).canRead()) { - osName = "Fedora"; - osVersion = getVersionString(f); - } else if ((f = new File("/etc/redhat-release")).canRead()) { - osName = "RedHat"; - osVersion = getVersionString(f); - } else if ((f = new File("/etc/turbolinux-release")).canRead()) { - osName = "Turbo"; - osVersion = getVersionString(f); - } else if ((f = new File("/etc/SuSE-release")).canRead()) { - osName = "SuSE"; - osVersion = getVersionString(f); - } else if ((f = new File("/etc/lsb-release")).canRead()) { - /* Ubuntu and (perhaps others) use only lsb-release. - * Syntax and encoding is compatible with java properties. - * For Ubuntu the ID is "Ubuntu". - */ + File f = new File("/etc/os-release"); + if (f.canRead()) { Properties props = new Properties(); try (FileInputStream fis = new FileInputStream(f)) { props.load(fis); } - osName = extractInfo(props.getProperty("DISTRIB_ID")); - osVersion = extractInfo(props.getProperty("DISTRIB_RELEASE")); - } else if ((f = new File("/etc/os-release")).canRead()) { - Properties props = new Properties(); - try (FileInputStream fis = new FileInputStream(f)) { - props.load(fis); - } - osName = extractInfo(props.getProperty("NAME")); + osName = extractInfo(props.getProperty("ID")); osVersion = extractInfo(props.getProperty("VERSION_ID")); - if (osName.equals("SLES")) { - osName = "SuSE"; - } else { - osName = extractInfo(props.getProperty("ID")); - } } } catch (Exception e) { }