Uploaded image for project: 'Batik'
  1. Batik
  2. BATIK-924

NegativeArraySizeException in MultipleGradientContextPaint.calculateGradientFractions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Resolution: Unresolved
    • 1.7
    • None
    • Utilities
    • None
    • Operating System: Windows XP
      Platform: PC

    Description

      Line 359 of org.apache.batik.ext.awt.MultipleGradientContextPaint compares the float value of Imin to 0.0. However, due to float-point limitations, under some conditions this value can be negative - leading to this exception stack trace:

      java.lang.NegativeArraySizeException
      at org.apache.batik.ext.awt.MultipleGradientPaintContext.calculateSingleArrayGradient(MultipleGradientPaintContext.java:460)
      at org.apache.batik.ext.awt.MultipleGradientPaintContext.calculateGradientFractions(MultipleGradientPaintContext.java:378)
      at org.apache.batik.ext.awt.MultipleGradientPaintContext.<init>(MultipleGradientPaintContext.java:297)
      at org.apache.batik.ext.awt.RadialGradientPaintContext.<init>(RadialGradientPaintContext.java:137)
      at org.apache.batik.ext.awt.RadialGradientPaint.createContext(RadialGradientPaint.java:464)
      at sun.java2d.pipe.AlphaPaintPipe.startSequence(AlphaPaintPipe.java:65)
      at sun.java2d.pipe.DuctusShapeRenderer.renderPath(DuctusShapeRenderer.java:74)
      at sun.java2d.pipe.DuctusShapeRenderer.fill(DuctusShapeRenderer.java:49)
      at sun.java2d.pipe.ValidatePipe.fill(ValidatePipe.java:142)
      at sun.java2d.SunGraphics2D.fill(SunGraphics2D.java:2261)

      The negative value is around 1e-07, and can be addressed by changing the condition from (Imin == 0) to (Imin <= 0)

      Thanks
      Kirill

      Attachments

        1. Bug47975.java
          2 kB
          Kirill Grouchnikov

        Activity

          People

            batik-dev@xmlgraphics.apache.org Batik Developer's Mailing list
            kirillcool@yahoo.com Kirill Grouchnikov
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: