java.lang.ArrayIndexOutOfBoundsException: 0 at sun.font.CompositeStrike.getStrikeForSlot(CompositeStrike.java:75)

1

Hello!

I have the next dependency and infrastructure:

jasperreports-3.1.2.jar

weblogic 12.1.3 with java 1.8.0_77 for server

OS: Linux version 3.8.13-98.7.1.el7uek.x86_64 (mockbuild@x86-ol7-builder-01) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #2 SMP Wed Nov 25 13:51:41 PST 2015

Also I have ARIAL.TTF file on path /fonts/ARIAL.TTF

My compiled template is:

<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="reportMilitaryMrtgObjBaseTable" pageWidth="802" pageHeight="900" columnWidth="802" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
    <background>
        <band/>
    </background>
    <title>
        <band/>
    </title>
    <pageHeader>
        <band/>
    </pageHeader>
    <detail>
        <band height="20">
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="160" height="20" isPrintWhenDetailOverflows="true" forecolor="#000000"/>
                <box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
                    <topPen lineWidth="1.0"/>
                    <leftPen lineWidth="1.0"/>
                    <bottomPen lineWidth="1.0"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Arial" pdfFontName="/fonts/ARIAL.TTF" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
                </textElement>
                <textFieldExpression class="java.lang.String"><![CDATA["-"]]></textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="482" y="0" width="160" height="20" isPrintWhenDetailOverflows="true" forecolor="#000000"/>
                <box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
                    <topPen lineWidth="1.0"/>
                    <leftPen lineWidth="1.0"/>
                    <bottomPen lineWidth="1.0"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Arial" pdfFontName="/fonts/ARIAL.TTF" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
                </textElement>
                <textFieldExpression class="java.lang.String"><![CDATA["-"]]></textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="642" y="0" width="160" height="20" isPrintWhenDetailOverflows="true"/>
                <box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
                    <topPen lineWidth="1.0"/>
                    <leftPen lineWidth="1.0"/>
                    <bottomPen lineWidth="1.0"/>
                    <rightPen lineWidth="1.0"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle" rotation="None">
                    <font fontName="Arial" pdfFontName="/fonts/ARIAL.TTF" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
                </textElement>
                <textFieldExpression class="java.lang.String"><![CDATA["-"]]></textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="322" y="0" width="160" height="20" isPrintWhenDetailOverflows="true" forecolor="#000000"/>
                <box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
                    <topPen lineWidth="1.0"/>
                    <leftPen lineWidth="1.0"/>
                    <bottomPen lineWidth="1.0"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Arial" pdfFontName="/fonts/ARIAL.TTF" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
                </textElement>
                <textFieldExpression class="java.lang.String"><![CDATA["-"]]></textFieldExpression>
            </textField>
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="160" y="0" width="162" height="20" isPrintWhenDetailOverflows="true" forecolor="#000000"/>
                <box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
                    <topPen lineWidth="1.0"/>
                    <leftPen lineWidth="1.0"/>
                    <bottomPen lineWidth="1.0"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Arial" pdfFontName="/fonts/ARIAL.TTF" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
                </textElement>
                <textFieldExpression class="java.lang.String"><![CDATA["-"]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <columnFooter>
        <band/>
    </columnFooter>
    <pageFooter>
        <band/>
    </pageFooter>
    <summary>
        <band/>
    </summary>
</jasperReport>

 

And when i build my report i get this error:

java.lang.ArrayIndexOutOfBoundsException: 0
    at sun.font.CompositeStrike.getStrikeForSlot(CompositeStrike.java:75)
    at sun.font.CompositeStrike.getFontMetrics(CompositeStrike.java:93)
    at sun.font.Font2D.getFontMetrics(Font2D.java:415)
    at java.awt.Font.defaultLineMetrics(Font.java:2176)
    at java.awt.Font.getLineMetrics(Font.java:2283)
    at java.awt.font.TextMeasurer.initAll(TextMeasurer.java:239)
    at java.awt.font.TextMeasurer.<init>(TextMeasurer.java:168)
    at java.awt.font.LineBreakMeasurer.<init>(LineBreakMeasurer.java:310)
    at java.awt.font.LineBreakMeasurer.<init>(LineBreakMeasurer.java:277)
    at net.sf.jasperreports.engine.fill.TextMeasurer.renderParagraph(TextMeasurer.java:330)
    at net.sf.jasperreports.engine.fill.TextMeasurer.measure(TextMeasurer.java:291)
    at net.sf.jasperreports.engine.fill.JRFillTextElement.chopTextElement(JRFillTextElement.java:991)
    at net.sf.jasperreports.engine.fill.JRFillTextField.prepare(JRFillTextField.java:528)
    at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:344)
    at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:346)
    at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:305)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1382)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:692)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:255)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:113)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:888)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:810)
    at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:544)
    at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:63)
    at net.sf.jasperreports.engine.fill.JRThreadSubreportRunner.run(JRThreadSubreportRunner.java:209)
    at java.lang.Thread.run(Thread.java:745)

Tell me please what's the problem?

How can i fix it?

try_walking_in_my_shoes's picture
Joined: Sep 7 2017 - 4:38am
Last seen: 1 year 10 months ago

Hi try_walking_in,

 

as I have exactly the same stack trace with any report containing text fields, I kindly ask you to post your fix of this problem if you have any.

Likewise, I will keep you posted if I have any progress.

I am on Linux, with Jaspersoft 6.2.1

 

Thank you some much and regards

Georg

georg.schmid - 3 years 3 months ago

I had the same problem and was able to fix by installing dejavu-serif-fonts with yum.

Kevin

kgebeau - 3 years 3 months ago

hello Georg!

we have fixed it with this link:

http://codecloud.net/upgrade-rhel-from-7-3-to-7-4-arrayindexoutofboundse...

" We ended creating a file name /etc/fonts/local.confwith this in order to force back Utopia as the default font, used by java "

 

try_walking_in_my_shoes - 3 years 3 months ago
show 2 more...

​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>

 

And then restart the app.

Refer to this Link: https://kb.informatica.com/solution/23/Pages/63/519357.aspx

aibot - 3 years 3 months ago

​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>

 

And then restart the app.

Refer to this link:

https://kb.informatica.com/solution/23/Pages/63/519357.aspx

aibot - 3 years 3 months ago

1 Answer:

2

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>

 

And then restart the app.

Link:

https://kb.informatica.com/solution/23/Pages/63/519357.aspx

aibot's picture
22
Joined: Oct 12 2017 - 6:45am
Last seen: 3 years 3 months ago
Feedback