An error occurs in Java with "ArrayIndexOutOfBoundsException at sun.java2d.pisces.Dasher.goTo(Dasher.java:151)"

Solution Verified - Updated -

Issue

  • We couldn't transcode from SVG to JPG using “apache batik svg toolkit” and OpenJDK8.

    $ java -cp .:batik-1.9/batik-1.9.jar -Djava.awt.headless=true SaveAsJPEG NG.svg NG.jpg 400 200
    org.apache.batik.transcoder.TranscoderException: null
    Enclosed Exception:
    null
      at org.apache.batik.transcoder.image.ImageTranscoder.transcode(ImageTranscoder.java:132)
      at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:142)
      at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:156)
      at SaveAsJPEG.main(SaveAsJPEG.java:40)
    Caused by the underlying exception: java.lang.ArrayIndexOutOfBoundsException
      at java.lang.System.arraycopy(Native Method)
      at sun.java2d.pisces.Dasher.goTo(Dasher.java:151)
      at sun.java2d.pisces.Dasher.lineTo(Dasher.java:188)
      at sun.java2d.pipe.RenderingEngine.feedConsumer(RenderingEngine.java:366)
      at sun.java2d.pisces.PiscesRenderingEngine.pathTo(PiscesRenderingEngine.java:484)
      at sun.java2d.pisces.PiscesRenderingEngine.strokeTo(PiscesRenderingEngine.java:363)
      at sun.java2d.pisces.PiscesRenderingEngine.createStrokedShape(PiscesRenderingEngine.java:69)
      at java.awt.BasicStroke.createStrokedShape(BasicStroke.java:301)
      at org.apache.batik.gvt.StrokeShapePainter.getPaintedArea(StrokeShapePainter.java:125)
      at org.apache.batik.gvt.StrokeShapePainter.getPaintedBounds2D(StrokeShapePainter.java:134)
      at org.apache.batik.gvt.CompositeShapePainter.getPaintedBounds2D(CompositeShapePainter.java:156)
      at org.apache.batik.gvt.ShapeNode.getPrimitiveBounds(ShapeNode.java:238)
      at org.apache.batik.gvt.AbstractGraphicsNode.getTransformedPrimitiveBounds(AbstractGraphicsNode.java:854)
      at org.apache.batik.gvt.AbstractGraphicsNode.getTransformedBounds(AbstractGraphicsNode.java:820)
      at org.apache.batik.gvt.CompositeGraphicsNode.getPrimitiveBounds(CompositeGraphicsNode.java:224)
      at org.apache.batik.gvt.CompositeGraphicsNode.getTransformedPrimitiveBounds(CompositeGraphicsNode.java:295)
      at org.apache.batik.gvt.AbstractGraphicsNode.getTransformedBounds(AbstractGraphicsNode.java:820)
      at org.apache.batik.gvt.CompositeGraphicsNode.getPrimitiveBounds(CompositeGraphicsNode.java:207)
      at org.apache.batik.gvt.filter.GraphicsNodeRable8Bit.getBounds2D(GraphicsNodeRable8Bit.java:156)
      at org.apache.batik.gvt.filter.GraphicsNodeRable8Bit.createRendering(GraphicsNodeRable8Bit.java:261)
      at org.apache.batik.gvt.renderer.StaticRenderer.renderGNR(StaticRenderer.java:481)
      at org.apache.batik.gvt.renderer.StaticRenderer.updateWorkingBuffers(StaticRenderer.java:508)
      at org.apache.batik.gvt.renderer.StaticRenderer.repaint(StaticRenderer.java:375)
      at org.apache.batik.gvt.renderer.StaticRenderer.repaint(StaticRenderer.java:344)
      at org.apache.batik.transcoder.image.ImageTranscoder.transcode(ImageTranscoder.java:111)
      at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:142)
      at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:156)
      at SaveAsJPEG.main(SaveAsJPEG.java:40)
    

Environment

  • Red Hat Enteprise Linux 7
  • OpenJDK 8

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In