I could go too ways on this.

It looks like the code is looking to drop arrays that have grown so that it doesn't waste memory. Do we reuse these objects? If not, then the code can be deleted.

If we do reuse them, then why not just set them to null and let them get recreated the next time rather than allocate something which may not get used for a while?

In either case, if the array was null, is there a need to allocate one? Shouldn't it be "if (array != null && array.length > DEFAULT)"?

                        ...jim

Dmitri Trembovetski wrote:

  Hi Roman,

Roman Kennke wrote:
Hi Dmitri,

a comment about the test: would the bug reproduce if you just rendered into a BufferedImage? If so, no need for creating a frame and such.

Oh yes. Stupid me :-)

Regarding the fix, it looks ok - but there are other places in the code where the 'crossings' is accessed - are those safe from an NPE?

I followed all usages of crossings and crossingsIndices and they all end
up in endRendering(). There is a loop at the beginning of which the
arrays get initialized using setCrossingsExtends(). The problem occured
when this loop was never entered, in that case we hit
crossingListFinished() with (possibly) null arrays. There I added the
null checks and it should cover all potential NPEs on these arrays.

The updated webrev is:

http://cr.openjdk.java.net/~rkennke/100053/webrev.01/

Ok now?

  Yes, looks fine.

  Thanks,
    Dmitri



Thanks, Roman


Reply via email to