RFR: 8319925: CSS.BackgroundImage incorrectly uses double-checked locking
Prasanta Sadhukhan
psadhukhan at openjdk.org
Tue Dec 5 13:32:33 UTC 2023
On Tue, 5 Dec 2023 13:02:36 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
> if the URL is invalid, the image isn't loaded
if (!loadedImage) {
URL url = CSS.getURL(base, svalue);
if (url != null) {
image = new ImageIcon();
Image tmpImg = Toolkit.getDefaultToolkit().createImage(url);
if (tmpImg != null) {
image.setImage(tmpImg);
}
}
loadedImage = true;
}
As per your change, if URL is invalid ie url = null, image is not loaded but `loadedImage` is set to true so it will not give another chance to load the URL again via `CSS.getURL` just in case user decides to call setBase with a valid URL (after finding `getImage `returning null)
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16917#issuecomment-1840794783
More information about the client-libs-dev
mailing list