Upgrade RHEL from 7.3 to 7.4: ArrayIndexOutOfBoundsException in sun.font.CompositeStrike.getStrikeForSlot
We finally found it !
RHEL v7.4 (upgraded from v7.3 or fresh install) comes with package stix-fonts
.
When this package is installed, the default font changed from Utopia
to STIX
So, java now default fonts are mapped to STIX
, including thesans-serif
font family
For whatever reason, the STIX
fonts does not seem to play well with java (openjdk
+ IBM JDK
) and cause exceptions and bad calculated artefacts positionning when using java.awt
, which is the case with JasperReports
We ended creating a file name /etc/fonts/local.conf
with this in order to force back Utopia
as the default font, used by java..
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<alias>
<family>serif</family>
<prefer><family>Utopia</family></prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer><family>Utopia</family></prefer>
</alias>
<alias>
<family>monospace</family>
<prefer><family>Utopia</family></prefer>
</alias>
<alias>
<family>dialog</family>
<prefer><family>Utopia</family></prefer>
</alias>
<alias>
<family>dialoginput</family>
<prefer><family>Utopia</family></prefer>
</alias>
</fontconfig>
[EDITED 2018-10-22]
It seems the bug is fixed in JDK 1.8.192: https://bugs.java.com/view_bug.do?bug_id=JDK-8188030
[EDITED 2019-06-28]
There is now a fix to work around the problem included in IBM JDK v8.05.37
http://www-01.ibm.com/support/docview.wss?uid=swg1IJ16655
Environment RHEL 7.4
We are not able to use font sans serif after the upgrade with OpenJDK or IBM JDK.
New Exception using fonts libraries in openjdk 1.8.0.141-2 . Resolution The issue is fixed in java-1.8.0-openjdk-1.8.0.151-1.b12.el7_4.x86_64 . RHSA-2017:2998 - Security Advisory Workaround
It is observed that in some scenarios installing dejavu-serif-fonts fixes the problem.
yum install dejavu-serif-fonts
if you only install any other font like "dejavu-serif-fonts" the problem will be solved. Or you do the workaroundwith the "local.conf" file. RedHat has listet the problem as a bug in 7.4 and is searching for a real solution and dependencies: have a look here: https://bugzilla.redhat.com/show_bug.cgi?id=1479563