<Swing Dev> [14] RFR JDK-8230235 - Rendering HTML with empty img attribute and documentBaseKey cause Exception
Sergey Bylokhov
Sergey.Bylokhov at oracle.com
Thu Oct 10 20:35:06 UTC 2019
Hi, Pankaj.
I guess that the problem is that the "image" is accessed w/o synchronization on "this"
like in other places, but it will be necessary to add one null check before usage of "image".
Also, it is not necessary to have a try/catch block in the test, just call the problematic method
On 10/10/19 11:01 am, Pankaj Bansal wrote:
> Hi All,
>
> Please review the following fix for jdk14.
>
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8230235
>
> Webrev: http://cr.openjdk.java.net/~pbansal/8230235/webrev00/
>
> Issue:
>
> Rendering HTML with empty img attribute and documentBaseKey set causes NPE
>
> Fix:
>
> The issues is introduced after https://bugs.openjdk.java.net/browse/JDK-8218674.
>
> When the documentBaseKey is set, but img tag is not set, the image URL may not be complete and may not point to actual image. In ImageView class, when getWidth(ImageObserver) is called from the updateImageSize, it checks if image source is null and adds the ImageObserver (ImageView.ImageHandler) on the Image and sets the ImageView image as null. When getHeight is called, as image is set to null, it results in NPE.
>
> We should verify that image is not null.
>
> Testing:
>
> I have tested it on Window, Linux and Mac.
>
>
> Regards,
> Pankaj Bansal
>
--
Best regards, Sergey.
More information about the swing-dev
mailing list