Getting ArrayIndexOutOfBoundsException exception while running in the Linux machine

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
mani9
Posts: 1
Joined: Fri Jul 13, 2018 4:29 pm
antibot: No, of course not.

Getting ArrayIndexOutOfBoundsException exception while running in the Linux machine

Post by mani9 » Fri Jul 13, 2018 4:36 pm

Hi All,

The following exception i'm getting in Linux environment. In Windows it is running as excepted and giving excepted results.

Exception in ExcelDownload:: Array index out of range: 0
java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0
at sun.font.CompositeStrike.getStrikeForSlot(CompositeStrike.java:87) ~[?:1.8.0]
at sun.font.CompositeStrike.getFontMetrics(CompositeStrike.java:105) ~[?:1.8.0]
at sun.font.FontDesignMetrics.initMatrixAndMetrics(FontDesignMetrics.java:371) ~[?:1.8.0]
at sun.font.FontDesignMetrics.<init>(FontDesignMetrics.java:362) ~[?:1.8.0]
at sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:314) ~[?:1.8.0]
at sun.java2d.SunGraphics2D.getFontMetrics(SunGraphics2D.java:875) ~[?:1.8.0]
at org.jfree.text.TextFragment.calculateDimensions(TextFragment.java:229) ~[jcommon-1.0.17.jar:?]
at org.jfree.text.TextLine.calculateDimensions(TextLine.java:190) ~[jcommon-1.0.17.jar:?]
at org.jfree.text.TextBlock.calculateDimensions(TextBlock.java:171) ~[jcommon-1.0.17.jar:?]
at org.jfree.chart.block.LabelBlock.arrange(LabelBlock.java:313) ~[jfreechart-1.0.18.jar:?]
at org.jfree.chart.block.BorderArrangement.arrangeNN(BorderArrangement.java:215) ~[jfreechart-1.0.18.jar:?]
at org.jfree.chart.block.BorderArrangement.arrange(BorderArrangement.java:141) ~[jfreechart-1.0.18.jar:?]
at org.jfree.chart.block.BlockContainer.arrange(BlockContainer.java:178) ~[jfreechart-1.0.18.jar:?]
at org.jfree.chart.block.CenterArrangement.arrangeNN(CenterArrangement.java:286) ~[jfreechart-1.0.18.jar:?]
at org.jfree.chart.block.CenterArrangement.arrange(CenterArrangement.java:100) ~[jfreechart-1.0.18.jar:?]
at org.jfree.chart.block.BlockContainer.arrange(BlockContainer.java:178) ~[jfreechart-1.0.18.jar:?]
at org.jfree.chart.block.FlowArrangement.arrangeNN(FlowArrangement.java:367) ~[jfreechart-1.0.18.jar:?]
at org.jfree.chart.block.FlowArrangement.arrangeRR(FlowArrangement.java:285) ~[jfreechart-1.0.18.jar:?]
at org.jfree.chart.block.FlowArrangement.arrange(FlowArrangement.java:160) ~[jfreechart-1.0.18.jar:?]
at org.jfree.chart.block.BlockContainer.arrange(BlockContainer.java:178) ~[jfreechart-1.0.18.jar:?]
at org.jfree.chart.title.LegendTitle.arrange(LegendTitle.java:540) ~[jfreechart-1.0.18.jar:?]
at org.jfree.chart.JFreeChart.drawTitle(JFreeChart.java:1321) ~[jfreechart-1.0.18.jar:?]
at org.jfree.chart.JFreeChart.draw(JFreeChart.java:1215) ~[jfreechart-1.0.18.jar:?]
at org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1400) ~[jfreechart-1.0.18.jar:?]
at org.jfree.chart.ChartUtilities.writeChartAsJPEG(ChartUtilities.java:437) ~[jfreechart-1.0.18.jar:?]
at org.jfree.chart.ChartUtilities.writeChartAsJPEG(ChartUtilities.java:385) ~[jfreechart-1.0.18.jar:?]

Can you guide me the root cause of the this exception.

perk
Posts: 1
Joined: Fri Feb 15, 2019 10:30 am
antibot: No, of course not.

Re: Getting ArrayIndexOutOfBoundsException exception while running in the Linux machine

Post by perk » Fri Feb 15, 2019 10:35 am

I get almost the exact same error. I have tried both JFreeChart 1.0.19 and 1.5.0 with the same error.

OS tested are RHEL 6.5 with java8

I get this error running automated tests and only about 1 in 5 times.

java.lang.ArrayIndexOutOfBoundsException: 0
at sun.font.CompositeStrike.getStrikeForSlot(CompositeStrike.java:79)
at sun.font.CompositeStrike.getFontMetrics(CompositeStrike.java:97)
at sun.font.FontDesignMetrics.initMatrixAndMetrics(FontDesignMetrics.java:359)
at sun.font.FontDesignMetrics.<init>(FontDesignMetrics.java:350)
at sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:302)
at sun.java2d.SunGraphics2D.getFontMetrics(SunGraphics2D.java:863)
at org.jfree.text.TextFragment.calculateDimensions(TextFragment.java:230)
at org.jfree.text.TextLine.calculateDimensions(TextLine.java:194)
at org.jfree.text.TextBlock.calculateDimensions(TextBlock.java:171)
at org.jfree.chart.block.LabelBlock.arrange(LabelBlock.java:313)
at org.jfree.chart.block.BorderArrangement.arrangeNN(BorderArrangement.java:215)
at org.jfree.chart.block.BorderArrangement.arrange(BorderArrangement.java:141)
at org.jfree.chart.block.BlockContainer.arrange(BlockContainer.java:178)
at org.jfree.chart.block.CenterArrangement.arrangeNN(CenterArrangement.java:286)
at org.jfree.chart.block.CenterArrangement.arrange(CenterArrangement.java:100)
at org.jfree.chart.block.BlockContainer.arrange(BlockContainer.java:178)
at org.jfree.chart.block.FlowArrangement.arrangeNN(FlowArrangement.java:367)
at org.jfree.chart.block.FlowArrangement.arrangeRR(FlowArrangement.java:285)
at org.jfree.chart.block.FlowArrangement.arrange(FlowArrangement.java:160)
at org.jfree.chart.block.BlockContainer.arrange(BlockContainer.java:178)
at org.jfree.chart.title.LegendTitle.arrange(LegendTitle.java:540)
at org.jfree.chart.JFreeChart.drawTitle(JFreeChart.java:1320)
at org.jfree.chart.JFreeChart.draw(JFreeChart.java:1214)
at org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1399)
at org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1379)
at org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1364)

Locked