Hi All,

 

Please review the fix for JDK 11.

 

Bug:

https://bugs.openjdk.java.net/browse/JDK-6562442

 

webrev:

http://cr.openjdk.java.net/~pbansal/6562442/webrev.00/

 

 

Issue:

JList may not set ListModel properly on calling JList.setModel in some cases.

 

The ListModel should be checked for equality by reference not by actual values, 
while calling JList.setModel. JList.setModel informs the UI delegate about the 
change by firing a propertyChange. Now firePropertyChange checks for equality 
between the models by calling equals. This may return a false true, if a 
subclass of ListModel has overridden the equals method to test the ListModels 
for actual values for some other purpose. This may leave UI delegate in 
inconsistent state.

 

Fix:

Made changes in JList.setModel to check for equality by reference and then call 
firePropertyChange. In first call to firePropertyChange, newValue is sent as 
null, so that ListDataListeners are removed from the old ListModel. Then new 
ListModel is set.

In test, for automation, the check is added on number of ListDataListeners in 
ListModel as JList.setModel should remove the listeners from old model and add 
to new model.

 

 

Regards,

Pankaj Bansal

 

Reply via email to