Hi Pankaj,
Looks good to me.
However, I suggest following the formatting of the surrounding code
where arguments are aligned to the opening parenthesis:
797 Dimension d =
adjustWidthHeight(img.getWidth(imageObserver),
798 img.getHeight(imageObserver));
(when the mail message is rendered using proportional font, the lines
don't align; img in either line is in the same columns.)
In the test, there's an extra space between main and the opening
parenthesis:
39 public static void main (String[] args) throws Exception {
I believe there's no need for additional webrev to make these trivial
changes.
Regards,
Alexey
On 18/11/2019 15:44, Pankaj Bansal wrote:
Hi Alexey,
<< I guess the image loader thread already detected an error that's why it
works. Yet if it takes a while to load the image, for example slow network
connection, the call img.getWidth will block. Then ImageObserver, i.e.
ImageHandler.imageUpdate(), will be called from another thread to set the width or to
reset image field to null if an error occurs. In this case, it would deadlock waiting
to enter the synchronized section, right?
I agree, it is possible. Also, your suggested code has less code in
synchronized block, which is better anyway. I have updated the code.
webrev: http://cr.openjdk.java.net/~pbansal/8230235/webrev03/
Regards,
Pankaj