<Swing Dev> [10] RFR: 8182577: Crash when Tab key moves focus to a JCheckbox with a custom ButtonModel

Sergey Bylokhov sergey.bylokhov at oracle.com
Wed Jun 21 12:56:54 UTC 2017


Hi, Prasanta.
This can be a good fix for jdk10, but since it is a regression in jdk9 we should try to backport the fix jdk10->jdk9. Note that we cannot introduce the new method in jdk9.

----- prasanta.sadhukhan at oracle.com wrote:

> Hi Semyon,
> 
> Yes, it seems the problem will be there in that case. Modified to have
> 
> getGroup() in the interface
> http://cr.openjdk.java.net/~psadhukhan/8182577/webrev.01/
> 
> Regards
> Prasanta
> On 6/20/2017 11:16 PM, Semyon Sadetsky wrote:
> > Hi Prasanta,
> >
> > With the DefaultButtonModel we can get the same exception if a
> custom 
> > implementation of the ButtonModel is used.
> >
> > So, it is better check whether  the model is a DefaultButtonModel
> and 
> > skip if grouping is not supported. Or, perhaps, it is reasonable to
> 
> > pull up the getGroup() into the ButtonModel interface which already
> 
> > has setGroup().
> >
> > --Semyon
> >
> >
> > On 06/20/2017 10:21 AM, Prasanta Sadhukhan wrote:
> >> Hi All,
> >>
> >> Please review a fix for an issue where a crash is reported when
> focus 
> >> is moved with custom ButtonModel.
> >> Issue was in LayoutFocusTraversalPolicy, the ButtonModel was
> wrongly 
> >> typecasted to JToggleButton when the button model is 
> >> DefaultButtonModel, resulting in ClassCastException.
> >>
> >> Proposed fix is to cast to super class DefaultButtonModel and then
> 
> >> check for JToggleButton member.
> >>
> >> Bug: https://bugs.openjdk.java.net/browse/JDK-8182577
> >> webrev: http://cr.openjdk.java.net/~psadhukhan/8182577/webrev.00/
> >>
> >> Regards
> >> Prasanta
> >



More information about the swing-dev mailing list