https://issues.apache.org/bugzilla/show_bug.cgi?id=47975

           Summary: NegativeArraySizeException in
                    MultipleGradientContextPaint.calculateGradientFraction
                    s
           Product: Batik
           Version: 1.8
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: major
          Priority: P2
         Component: Utilities
        AssignedTo: [email protected]
        ReportedBy: [email protected]


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

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to