Hi,

There is a bug in the pisces Renderer in crossingListFinished(). Both
crossings and crossingIndices might not have been initialized, so have
to be checked for being null. They only get initialized if
setCrossingsExtents() was called earlier, which might not always be the
case when crossingListFinished() is called from _endRendering().

You can see this with for example this applet (you will need to have the
IcedTeaPlugin installed):
http://www.jroller.com/dgilbert/entry/jfreechart_and_jxlayer
The magnifying glass will not work, and you will get an exception:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
  at sun.java2d.pisces.Renderer.crossingListFinished(Renderer.java:778)
  at sun.java2d.pisces.Renderer._endRendering(Renderer.java:466)
  at sun.java2d.pisces.Renderer.endRendering(Renderer.java:478)
  at 
sun.java2d.pisces.PiscesRenderingEngine.getAATileGenerator(PiscesRenderingEngine.java:327)
  at sun.java2d.pipe.AAShapePipe.renderPath(AAShapePipe.java:93)
  at sun.java2d.pipe.AAShapePipe.fill(AAShapePipe.java:65)
  at sun.java2d.pipe.ValidatePipe.fill(ValidatePipe.java:160)
  at sun.java2d.SunGraphics2D.fill(SunGraphics2D.java:2422)
  at org.jfree.chart.plot.Plot.fillBackground(Plot.java:1021)
[...]

Attached is the workaround that I checked into IcedTea to make this work
reliably:

2008-10-27  Mark Wielaard  <[EMAIL PROTECTED]>

        * patches/icedtea-renderer-crossing.patch: New patch.
        * Makefile.am (ICEDTEA_PATCHES): Add new patch.
        * HACKING: Document new patch.

Cheers,

Mark
--- openjdk6/jdk/src/share/classes/sun/java2d/pisces/Renderer.java	2008-08-28 10:14:15.000000000 +0200
+++ openjdk/jdk/src/share/classes/sun/java2d/pisces/Renderer.java	2008-10-27 13:54:25.000000000 +0100
@@ -775,10 +775,10 @@
 
     // Free sorting arrays if larger than maximum size
     private void crossingListFinished() {
-        if (crossings.length > DEFAULT_CROSSINGS_SIZE) {
+        if (crossings != null && crossings.length > DEFAULT_CROSSINGS_SIZE) {
             crossings = new int[DEFAULT_CROSSINGS_SIZE];
         }
-        if (crossingIndices.length > DEFAULT_INDICES_SIZE) {
+        if (crossingIndices != null && crossingIndices.length > DEFAULT_INDICES_SIZE) {
             crossingIndices = new int[DEFAULT_INDICES_SIZE];
         }
     }

Reply via email to