Java – Missing font – Crashing App!

Eclipse MATHeaphero are all popular java tools to analyze large size heap dumps. Recently we ran in to an interesting problem when trying to analyze a heap dump file in Eclipse MAT. Tool was crashing because of missing font 😊. We thought we will share with you what we found out.

ArrayIndexOutOfBoundsException  in CompositeStrike.getStrikeForSlot()

Here is our environment:

  • Eclipse MAT 1.9
  • Java 8
  • Linux 3.10.0-862.34.2.el7.x86_64

When we uploaded our heap dump file to Eclipse MAT, it failed with following error:

java.lang.ArrayIndexOutOfBoundsException: 0
               at sun.font.CompositeStrike.getStrikeForSlot(
               at sun.font.CompositeStrike.getFontMetrics(
               at sun.font.FontDesignMetrics.initMatrixAndMetrics(
               at sun.font.FontDesignMetrics.<init>(
               at sun.font.FontDesignMetrics.getMetrics(
               at sun.java2d.SunGraphics2D.getFontMetrics(
               at org.eclipse.birt.chart.device.swing.SwingTextMetrics.reuse(
               at org.eclipse.birt.chart.device.TextAdapter.reuse(
               at org.eclipse.birt.chart.device.swing.SwingTextMetrics.<init>(
               at org.eclipse.birt.chart.device.swing.SwingDisplayServer.getTextMetrics(
               at org.eclipse.birt.chart.device.DisplayAdapter.getTextMetrics(
               at org.eclipse.birt.chart.computation.BIRTChartComputation.getTextMetrics(
               at org.eclipse.birt.chart.computation.LegendBuilder$LegendData.<init>(
               at org.eclipse.birt.chart.computation.LegendBuilder.compute(
               at org.eclipse.birt.chart.model.layout.impl.LegendImpl.getPreferredSize(
               at org.eclipse.birt.chart.internal.layout.LayoutManager$ChartLayout.<init>(
               at org.eclipse.birt.chart.internal.layout.LayoutManager.doLayout_tmp(

 Quick search in Google god revealed this interesting StackOverflow thread. Here is synopsis of this thread. Java searches monospaced, SansSerif and serif fonts using linux’s fontconfig feature. Linux fontconfig is designed to locate fonts within the system and select them according to requirements specified by applications. If any of the above font are missing, then it would result in above exception.

 If you also encounter this type of problem, there are 3 potential solutions to address this problem:

 1. Install missing font

 2. Upgrade JDK

 3. Edit OS Font config

Let’s discuss the solutions in detail.

1.     Install missing font

 You can try installing the missing font by issuing below command:

yum install dejavu-serif-fonts

2.     Upgrade JDK

 This is a known JDK bug, tracked in OpenJDK, Oracle and IBM JDK bug databases:

 This bug has been fixed since following releases:

 Open JDK 8u192

 Oracle JDK 8u192

 IBM JDK 8 SR5 FP37 (

 You can upgrade to latest JDK version to resolve the problem.

3.     Edit OS Font config

Create a file name /etc/fonts/local.conf. In this file force back Utopia as the default font, used by java.

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>

Leave a Reply

Powered by

Up ↑

%d bloggers like this: