5.1.0: java.lang.ArrayIndexOutOfBoundsException: 0

We're trying to figure out why the following error happens when we try and run our report on a 5.1.0 JasperServer running on a FreeBSD box ... its not related to the SQL query, as we've tested it both on iReports on a Mac OS X desktop, and from the database server itself ...

The fact that it is reporting in sun.font.*, the only thought I have is that the Mac OS X side, where we are building the report, is using a font that isn't on the FreeBSD side ... but is there something else I should be looking at?

Thanks ...

=== Error Track ===

java.lang.ArrayIndexOutOfBoundsException: 0
 at sun.font.ExtendedTextSourceLabel.createCharinfo(ExtendedTextSourceLabel.java:608)
 at sun.font.ExtendedTextSourceLabel.getCharinfo(ExtendedTextSourceLabel.java:508)
 at sun.font.ExtendedTextSourceLabel.getLineBreakIndex(ExtendedTextSourceLabel.java:454)
 at java.awt.font.TextMeasurer.calcLineBreak(TextMeasurer.java:325)
 at java.awt.font.TextMeasurer.getLineBreakIndex(TextMeasurer.java:561)
 at java.awt.font.LineBreakMeasurer.nextOffset(LineBreakMeasurer.java:358)
 at net.sf.jasperreports.engine.fill.SimpleTextLineWrapper.measureExactLineBreakIndex(SimpleTextLineWrapper.java:561)
 at net.sf.jasperreports.engine.fill.SimpleTextLineWrapper.measureExactLine(SimpleTextLineWrapper.java:535)
 at net.sf.jasperreports.engine.fill.SimpleTextLineWrapper.nextLine(SimpleTextLineWrapper.java:517)
 at net.sf.jasperreports.engine.fill.TextMeasurer.renderNextLine(TextMeasurer.java:654)
 at net.sf.jasperreports.engine.fill.TextMeasurer.renderParagraph(TextMeasurer.java:459)
 at net.sf.jasperreports.engine.fill.TextMeasurer.measure(TextMeasurer.java:400)
 at net.sf.jasperreports.engine.util.JdkGlyphFixTextMeasurer.measure(JdkGlyphFixTextMeasurer.java:142)
 at net.sf.jasperreports.engine.fill.JRFillTextElement.chopTextElement(JRFillTextElement.java:541)
 at net.sf.jasperreports.engine.fill.JRFillStaticText.prepare(JRFillStaticText.java:184)
 at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:331)
 at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:384)
 at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:358)
 at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillTitle(JRVerticalFiller.java:346)
 at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:280)
 at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:151)
 at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:909)
 at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFiller.run(BaseFillHandle.java:120)
 at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$SynchronousExecutor.execute(EngineServiceImpl.java:875)
 at net.sf.jasperreports.engine.fill.BaseFillHandle.startFill(BaseFillHandle.java:165)
 at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$AsynchronousReportFiller.fillReport(EngineServiceImpl.java:831)
 at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.fillReport(EngineServiceImpl.java:1658)
 at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$ReportFill.runReport(EngineServiceImpl.java:1022)
 at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$ReportRunnable.run(EngineServiceImpl.java:897)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
 at java.lang.Thread.run(Thread.java:679)

The offending code in the jrxml file appears to be:

====

..insert your code here..

<band height="28" splitType="Stretch">
<staticText>
<reportElement uuid="849400f9-420e-4e51-854b-616f3361af26" x="0" y="0" width="350" height="20"/>
<textElement>
<font fontName="DejaVu Sans" size="14" isBold="true"/>
</textElement>
<text><![CDATA[School District 63: Enrollment Report]]></text>
</staticText>
</band>

If I change it to Arial, then I get a 'Missing font' error instead, so it doesn't look like its that the font isn't available, which was my first thought ...

Anyone?

mfournier_1's picture
Joined: Jun 11 2013 - 12:59pm
Last seen: 9 years 4 months ago

2 Answers:

Could you enable debug logging for net.sf.jasperreports.engine.fill.SimpleTextLineWrapper (that is add log4j.logger.net.sf.jasperreports.engine.fill.SimpleTextLineWrapper=trace in WEB-INF/log4j.properties), restart JRS, run the report and post the log file?

That might give some hints on what is going on..

PS:  Please also mention the Java version that you are using.

Regards,

Lucian

lucianc's picture
86907
Joined: Jul 17 2006 - 1:10am
Last seen: 11 hours 37 min ago

First, assume this is the part the log file that is of interest? The rest is just the trace previously posted:

===
2013-06-19 17:12:23,274 DEBUG SimpleTextLineWrapper,pool-4-thread-1:300 - creating element font infos cache of size 2000
2013-06-19 17:12:23,294 DEBUG SimpleTextLineWrapper,pool-4-thread-1:343 - font java.awt.Font[family=DejaVu Sans,name=DejaVu Sans,style=plain,size=14] has complex layout false, leading 0.0
2013-06-19 17:12:23,296 DEBUG SimpleTextLineWrapper,pool-4-thread-1:280 - creating element font info for {family: DejaVu Sans, size: 14, style: 0} and element 849400f9-420e-4e51-854b-616f3361af26
2013-06-19 17:12:23,299 DEBUG SimpleTextLineWrapper,pool-4-thread-1:418 - paragraph start at 0, truncate at char false, LTR true, exact measure false
2013-06-19 17:12:23,305 DEBUG SimpleTextLineWrapper,pool-4-thread-1:507 - simple line measurement at 0 to 37 in width 350.0 with font java.awt.Font[family=DejaVu Sans,name=DejaVu Sans,style=plain,size=14]
===

If you actually want the *whole* log file, let me know, just didn't want to spam the forum ...

As for the 'missing details' ...

I'm running this on:

FreeBSD 9-STABLE

Installed using the port, which installs:

OpenJDK6
Tomcat7

And have it setup with a PostgreSQL 9.2 backend.

As this is running on a headless server, it is started with the following in /etc/rc.conf:

tomcat7_enable="YES"
tomcat7_java_opts="-Xms1024m -Xmx2048m -XX:MaxPermSize=512m -Djava.awt.headless=true"

Thanks ...

mfournier_1 - 10 years 3 months ago

The log entries look OK, I don't see anything wrong there.

Might be a JDK bug on FreeBSD, there are other reports of the same error such as https://netbeans.org/bugzilla/show_bug.cgi?id=229256

You could try switching to JDK7, maybe that would fix it.

lucianc - 10 years 3 months ago

That seems to do it ... will do more testing today, but now the reports are being generated and displayed as expected ...

Thanks ...<strong><<<<<< This comment was blocked and unpublished because <a href="http://www.projecthoneypot.org/">Project Honeypot</a> indicates it came from a suspicious IP address.</strong>

mfournier_1 - 10 years 3 months ago
show 1 more...

hadn't realized that I didn't answer this ... switching from OpenJDK6 -> OpenJDK7 completely fixed the issue ... thank you ...

mfournier_1 - 10 years 3 months ago
I have a similar problem An RTF with Calibri font that has the same problem. Works as expected if you change the font to Arial or get a version of JDK7 higher or lower than the JDK7u21. Even the Calibri font is present on the machine and the problem happens
alan_s_carneiro's picture
Joined: Aug 22 2012 - 7:22am
Last seen: 6 years 3 weeks ago
Feedback