<Swing Dev> [9] Fix for JDK-8041909 : Uncaught exceptions in JComboBox listeners cause listener not to receive events

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Fri Jun 17 17:01:59 UTC 2016


+1

On 17.06.16 15:55, Alexandr Scherbatiy wrote:
> The fix looks good to me.
>
> Thanks,
> Alexandr.
>
> On 6/17/2016 2:03 PM, Ajit Ghaisas wrote:
>> Thanks Alex for the review.
>> Here is the updated webrev :
>> http://cr.openjdk.java.net/~aghaisas/8041909/webrev.01/
>>
>> Request you to review.
>>
>> Regards,
>> Ajit
>>
>> -----Original Message-----
>> From: Alexandr Scherbatiy
>> Sent: Thursday, June 16, 2016 7:54 PM
>> To: Ajit Ghaisas; Rajeev Chamyal; Sergey Bylokhov;
>> swing-dev at openjdk.java.net
>> Subject: Re: [9] Fix for JDK-8041909 : Uncaught exceptions in
>> JComboBox listeners cause listener not to receive events
>>
>>
>> Just two small comments:
>> - JComboBox line 1256 and 1257: the 'finally' keyword should be on the
>> same line as open bracket
>> - ActionListenerExceptionTest.test() method: all calls to Swing
>> objects should be done on EDT
>>
>> Thanks,
>> Alexandr.
>>
>> On 6/15/2016 10:05 AM, Ajit Ghaisas wrote:
>>> Hi,
>>>
>>> Bug :
>>>       https://bugs.openjdk.java.net/browse/JDK-8041909
>>>
>>> Issue :
>>>       Uncaught exceptions in JComboBox listeners cause listener not
>>> to receive events.
>>>       If an uncaught exception is thrown inside an action listener
>>> for a JComboBox, that action listener will no longer receive action
>>> events.
>>>       Note that if an uncaught exception is thrown inside the action
>>> listener for a JButton for example, the listener will still receive
>>> subsequent action events.
>>>
>>> Root Cause :
>>>       fireActionEvent() method in JComboBox class has a boolean guard
>>> (namely firingActionEvent) to ensure that an infinite loop is not
>>> created.
>>>       This guard is not reset if any exception occurs in
>>> actionPerformed() method.
>>>       This results in permanent breaking of subsequent action
>>> listener invocations of JComboBox.
>>>
>>> Fix :
>>>       The boolean guard (namely firingActionEvent) is reset in
>>> finally block.
>>>       This results in firingActionEvent being set to false at the end
>>> of fireActionEvent() method even in case of exception in
>>> actionPerformed() method.
>>>
>>> Webrev :
>>>       http://cr.openjdk.java.net/~aghaisas/8041909/webrev.00/
>>>
>>> Request you to review.
>>>
>>> Regards,
>>> Ajit
>


-- 
Best regards, Sergey.



More information about the swing-dev mailing list