# HG changeset patch # User mbaesken # Date 1562680702 -7200 # Tue Jul 09 15:58:22 2019 +0200 # Node ID a255e029e8f899313eea99873cf769510c1bb7c5 # Parent c589ba4b823cff7d5502b036e00f2ff4cb2d3a18 8227441: Enhance logging when reading the fontconfig info file diff --git a/src/java.desktop/unix/classes/sun/font/FcFontConfiguration.java b/src/java.desktop/unix/classes/sun/font/FcFontConfiguration.java --- a/src/java.desktop/unix/classes/sun/font/FcFontConfiguration.java +++ b/src/java.desktop/unix/classes/sun/font/FcFontConfiguration.java @@ -429,6 +429,9 @@ private void readFcInfo() { File fcFile = getFcInfoFile(); if (!fcFile.exists()) { + if (FontUtilities.debugFonts()) { + warning("fontconfig info file " + fcFile.toString() + " does not exist"); + } return; } Properties props = new Properties(); @@ -446,6 +449,9 @@ } String version = (String)props.get("version"); if (version == null || !version.equals(fileVersion)) { + if (FontUtilities.debugFonts()) { + warning("fontconfig info file caused a version mismatch"); + } return; } @@ -458,6 +464,9 @@ fcVersion = Integer.parseInt(fcVersionStr); if (fcVersion != 0 && fcVersion != FontConfigManager.getFontConfigVersion()) { + if (FontUtilities.debugFonts()) { + warning("new, different fontconfig detected"); + } return; } } catch (Exception e) { @@ -480,6 +489,9 @@ } File dirFile = new File(dir); if (dirFile.exists() && dirFile.lastModified() > lastModified) { + if (FontUtilities.debugFonts()) { + warning("Out of date cache directories detected"); + } return; } cacheDirIndex++; @@ -503,6 +515,9 @@ String lenStr = (String)props.get(key+".length"); int nfonts = Integer.parseInt(lenStr); if (nfonts <= 0) { + if (FontUtilities.debugFonts()) { + warning("Bad non-positive .length entry in fontconfig file " + fcFile.toString()); + } return; // bad file } fci[index].allFonts = new FontConfigFont[nfonts]; @@ -514,6 +529,9 @@ fkey = key+"."+f+".file"; String file = (String)props.get(fkey); if (file == null) { + if (FontUtilities.debugFonts()) { + warning("Missing file value for key " + fkey + " in fontconfig file " + fcFile.toString()); + } return; // bad file } fci[index].allFonts[f].fontFile = file; @@ -528,6 +546,11 @@ warning(t.toString()); } } + + if (FontUtilities.debugFonts()) { + PlatformLogger logger = FontUtilities.getLogger(); + logger.info("successfully parsed the fontconfig file at " + fcFile.toString()); + } } private static void warning(String msg) {