[OpenJDK 2D-Dev] Fix for JDK-8139192 : Custom ImageFilters return blank images in Java 8(.45) while working in 7

Ajit Ghaisas ajit.ghaisas at oracle.com
Wed May 25 08:31:44 UTC 2016


Hi

 

Bug :

https://bugs.openjdk.java.net/browse/JDK-8139192

Custom ImageFilters return blank images in Java 8(.45) while working in 7

 

 

Root cause : 

private method produce() in OffScreenImageSource.java consumes a NullPointerException that originates from a custom ImageConsumer (a 3rd party image library class - com.jhlabs.image.WaterFilter)

 

 

Analysis:

1. How the behavior changed between JDK7 and JK8 :

A call to imageComplete(ImageConsumer.SINGLEFRAMEDONE) was added in addition to imageComplete(ImageConsumer. STATICIMAGEDONE)  as a fix for JDK-7143612.

 

2. What debugging revealed:

A NullPointerException is being thrown from the library during the call to imageComplete(ImageConsumer.STATICIMAGEDONE)

 

3. It looks like the fix of JDK-7143612 is valid and successive calls to imageComplete() are allowed.

 

4. The 3rd party library behavior appears incorrect (if it can not handle subsequent calls to imageComplete(), it should de-register itself). 

The 3rd-party library code should be fixed.

 

 

 

Possible modifications in JDK  :

 

Currently, OffScreenImageSource::produce() consumes the NullPointerException - this is incorrect and results in silent failure of this particular image filter.

We need to let the image filter library know that exception has occurred in its code and not in JDK. We have two options -

 

Option 1 : Rethrow the NullPointerException   --- It is the clearest way to let 3rd party library know that their code is erroneous with latest JDK. This will change the 3rd party image filter behavior that generates blank image.

Option 2 : Add a stack trace where the exception is being consumed --- Adding stack trace provides more information regarding failure of 3rd party image filter with retaining the current behavior that generates blank image.

 

I have implemented both the options:

Option 1: http://cr.openjdk.java.net/~aghaisas/8139192/webrev.00/

Option 2:  http://cr.openjdk.java.net/~aghaisas/8139192/webrev.01/

 

Request you to review both the webrevs and provide your preference.

I will add a test to the selected webrev.

 

Regards,

Ajit

 

 

 

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20160525/d8cbb4c3/attachment.html>


More information about the 2d-dev mailing list