The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
Additional Information:
. Here is the stack trace information (shared by submitter) leading to Null Pointer Exception
java.lang.NullPointerException
at java.awt.image.FilteredImageSource.startProduction(FilteredImageSource.java:181)
at java.awt.image.FilteredImageSource.startProduction(FilteredImageSource.java:183)
at sun.awt.image.ImageRepresentation.startProduction(ImageRepresentation.java:732)
at sun.awt.image.ToolkitImage.addWatcher(ToolkitImage.java:221)
. I was able to reproduce the exception at FilteredImageSource.java: 181.
. Refer to the attached image- Indicates the exception occurrence with JDK9.
. The image also shows the test passing with JDK10 local build containing the fix.
Inferences from inspection are as follows:
. FilteredImageSource implements ImageProducer (interface).
. As documented by ImageProducer (interface), the FilteredImageSource.startProduction method checks whether the given ImageConsumer in argument is a registered consumer, & updates the "proxies" object (a HashTable<ImageConsumer, ImageFilter>) but does not do so in a proper way.
. First, The method could utilize existing "synchronized" method- addConsumer to update "proxies" object & thus register the current consumer rather than doing it internally duplicating the code.
. Second, To guarantee safe execution, any getter or setter method working on common data (invoked from multiple threads) should be synchronized. Thus the method requires "synchronized" keyword in the signature or a synchronized(this) { ... } block within startProduction method that gives a similar result.
I shall arrive at a fix for this issue but without a test-case because it 's hard to generate a failure in this particular scenario.