<Swing Dev> RFR JDK-6709913: BasicComboBoxUI.isPopupVisible returns NullPointerException
Prasanta Sadhukhan
prasanta.sadhukhan at oracle.com
Tue Aug 4 09:56:35 UTC 2020
OK. Please find modified
http://cr.openjdk.java.net/~psadhukhan/6709913/webrev.1/
Regards
Prasanta
On 04-Aug-20 12:22 PM, Sergey Bylokhov wrote:
> Hi, Prasanta.
>
> I suggest making the change in the isPopupVisible shorter:
>
> return popup != null && popup.isVisible();
>
> On 29.07.2020 23:18, Prasanta Sadhukhan wrote:
>> Hi All,
>>
>> Please review a fix for an issue whereby
>> javax.swing.plaf.basic.BasicComboBoxUI.isPopupVisible returns
>> NullPointerException when called from a overridden method of getModel().
>>
>> If a class extends JComboBox and overrides getModel() and then it
>> calls isPopupVisible() from the overriden getModel() it gets
>> NullPointerException the first time.
>>
>> Because the popup variable in javax.swing.plaf.basic.BasicComboBoxUI
>> is not set yet.
>>
>> Proposed fix is to guard against it by doing a null check for the
>> methods which can be overriden from JComboBox to access "popup"
>> variable.
>>
>> Bug: https://bugs.openjdk.java.net/browse/JDK-6709913
>>
>> webrev: http://cr.openjdk.java.net/~psadhukhan/6709913/webrev.0/
>>
>> Regards
>> Prasanta
>
>
More information about the swing-dev
mailing list