Problem happens while i try to create SXSSFWorkbook
.
Exception stacktrace :
java.lang.ArrayIndexOutOfBoundsException: 0
at sun.font.CompositeFont.getSlotFont(CompositeFont.java:351)
at sun.font.CompositeGlyphMapper.initMapper(CompositeGlyphMapper.java:81)
at sun.font.CompositeGlyphMapper.<init>(CompositeGlyphMapper.java:62)
at sun.font.CompositeFont.getMapper(CompositeFont.java:409)
at sun.font.CompositeFont.canDisplay(CompositeFont.java:435)
at java.awt.Font.canDisplayUpTo(Font.java:2063)
at java.awt.font.TextLayout.singleFont(TextLayout.java:470)
at java.awt.font.TextLayout.<init>(TextLayout.java:531)
at FontTest.main(FontTest.java:15)
gradle file :
compile 'org.apache.poi:poi:3.14'
compile 'org.apache.poi:poi-ooxml:3.14'
Environment :
The issue happened only on Red hat version 7.4
.
it is reported there.
and the Red hat guys are working to fix it here.
the solution I found is just to provide the fonts in order to force back Utopia as the default font, used by java.
Create the following file /etc/fonts/local.conf
with the following content:
<?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>
Make sure the file is readable by the correct user.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With