I'm getting the following exception from time to time, when generating a complex chart graphic: java.lang.ArrayIndexOutOfBoundsException: 28 >= 10 at java.util.Vector.elementAt(Vector.java:432) at org.apache.batik.svggen.DOMTreeManager.appendGroup(DOMTreeManager.java:175) at org.apache.batik.svggen.DOMGroupManager.addElement(DOMGroupManager.java:159) at org.apache.batik.svggen.SVGGraphics2D.fill(SVGGraphics2D.java:1384) at org.apache.batik.ext.awt.g2d.AbstractGraphics2D.drawGlyphVector(AbstractGraphics2D.java:960) at sun.font.ExtendedTextSourceLabel.handleDraw(ExtendedTextSourceLabel.java:131) at sun.font.Decoration.drawTextAndDecorations(Decoration.java:99) at sun.font.ExtendedTextSourceLabel.draw(ExtendedTextSourceLabel.java:135) at java.awt.font.TextLine.draw(TextLine.java:550) at java.awt.font.TextLayout.draw(TextLayout.java:2699) at com.werum.chartgen.Axis.drawYAxis(Axis.java:313) at com.werum.chartgen.Axis.draw(Axis.java:130) at com.werum.chartgen.CoordPlane.drawAxes(CoordPlane.java:165) at com.werum.chartgen.CoordPlane.draw(CoordPlane.java:138) at com.werum.chartgen.Chart.draw(Chart.java:144) at com.werum.chartgen.Chart.draw(Chart.java:155) at com.werum.chartgen.test.TestChart02.run(TestChart02.java:87) at com.werum.chartgen.test.TestChart02.main(TestChart02.java:261) The code of method DOMTreeManager.appendGroup is rather short: public void appendGroup(Element group, DOMGroupManager groupManager){ topLevelGroup.appendChild(group); int nManagers = groupManagers.size(); for(int i=0; i<nManagers; i++){ DOMGroupManager gm = (DOMGroupManager)groupManagers.elementAt(i); if( gm != groupManager ) gm.recycleCurrentGroup(); } } I think the problem has something to do with the disposer thread running in the background and modifying the 'groupManagers' Vector during the iteration. This happens when SVGGraphics2D objects are disposed: public void dispose() { this.domTreeManager.removeGroupManager(this.domGroupManager); } My proposal is to protect the 'groupManagers' Vector against modifications during iterations in class DOMTreeManager. Because I have compiled batik from source, I will make the modification and test it in my environment. Currently I'm working on a Fedora Core5 Linux using Eclipse 3.2 and JDK 1.5.0_09, but I have seen the same problem on a Windows XP environment. Bernd
Created attachment 18999 [details] Modified class DOMTreeManager This is the modified DOMTreeManager with synchronization around the groupManagers member. It works in my test environment.
fixed in svn 522302