<Swing Dev> RFR JDK-6709913: BasicComboBoxUI.isPopupVisible returns NullPointerException
    Sergey Bylokhov 
    Sergey.Bylokhov at oracle.com
       
    Tue Aug  4 06:52:14 UTC 2020
    
    
  
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
-- 
Best regards, Sergey.
    
    
More information about the swing-dev
mailing list