<Swing Dev> RFR JDK-6709913: BasicComboBoxUI.isPopupVisible returns NullPointerException

Prasanta Sadhukhan prasanta.sadhukhan at oracle.com
Thu Jul 30 06:18:52 UTC 2020


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