Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8204688

Confusing NPE on linux-x64 when no fonts are installed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 11
    • client-libs
    • None
    • 2d
    • b17
    • 11
    • x86_64
    • linux

      We had an NPE happen on some linux x64 performance team systems after JDK-8203236, where it turned out we had no fonts installed. I hope the font startup code could detect what's going on and make more useful exception or message than a NullPointerException and related exceptions, shown below.


      WARNING: Failed to get info from libfontconfig
      Error while creating report: java.lang.reflect.InvocationTargetException
      java.lang.InternalError: java.lang.reflect.InvocationTargetException
      at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:86)
      at java.base/java.security.AccessController.doPrivileged(Native Method)
      at java.desktop/sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)
      at java.desktop/sun.font.SunFontManager.getInstance(SunFontManager.java:248)
      at java.desktop/sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:265)
      at java.desktop/sun.java2d.SunGraphics2D.getFontMetrics(SunGraphics2D.java:856)
      at org.jfree.text.G2TextMeasurer.getStringWidth(G2TextMeasurer.java:79)
      at org.jfree.text.TextUtilities.nextLineBreak(TextUtilities.java:285)
      at org.jfree.text.TextUtilities.createTextBlock(TextUtilities.java:226)
      at org.jfree.text.TextUtilities.createTextBlock(TextUtilities.java:197)
      at org.jfree.chart.title.TextTitle.arrangeRR(TextTitle.java:489)
      at org.jfree.chart.title.TextTitle.arrange(TextTitle.java:450)
      at org.jfree.chart.JFreeChart.drawTitle(JFreeChart.java:1261)
      at org.jfree.chart.JFreeChart.draw(JFreeChart.java:1151)
      at org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1349)
      at org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1329)
      at org.jfree.chart.ChartUtilities.writeChartAsJPEG(ChartUtilities.java:414)
      at org.jfree.chart.ChartUtilities.saveChartAsJPEG(ChartUtilities.java:508)
      at org.jfree.chart.ChartUtilities.saveChartAsJPEG(ChartUtilities.java:460)
      at spec.reporter.Utils.createBmResultGraph(Utils.java:132)
      at spec.reporter.ReportGenerator.handleBenchmarkResult(ReportGenerator.java:160)
      at spec.reporter.ReportGenerator.handleBenchmarksResults(ReportGenerator.java:105)
      at spec.reporter.ReportGenerator.<init>(ReportGenerator.java:87)
      at spec.reporter.ReportGenerator.main2(ReportGenerator.java:750)
      at spec.reporter.Reporter.main2(Reporter.java:51)
      at spec.harness.Launch.createReport(Launch.java:307)
      at spec.harness.Launch.runBenchmarkSuite(Launch.java:250)
      at spec.harness.Launch.main(Launch.java:452)
      Caused by: java.lang.reflect.InvocationTargetException
      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
      at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:84)
      ... 27 more
      Caused by: java.lang.NullPointerException
      at java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1262)
      at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:225)
      at java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:107)
      at java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:719)
      at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:368)
      at java.base/java.security.AccessController.doPrivileged(Native Method)
      at java.desktop/sun.font.SunFontManager.<init>(SunFontManager.java:313)
      at java.desktop/sun.awt.FcFontManager.<init>(FcFontManager.java:35)
      at java.desktop/sun.awt.X11FontManager.<init>(X11FontManager.java:56)
      ... 32 more

            Unassigned Unassigned
            ecaspole Eric Caspole
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: