-
Enhancement
-
Resolution: Duplicate
-
P5
-
None
-
6
-
x86
-
linux
A DESCRIPTION OF THE REQUEST :
PropertyChangeSupport.firePropertyChange(String propertyName, Object oldValue, Object newValue) fires PropertyChange when both values are null. This is not real change and should not firePropertyChange.
JUSTIFICATION :
Avoid infinite loops and StackOverflowException.
ACTUAL -
/**
* Report a bound property update to any registered listeners.
* No event is fired if old and new are equal and non-null.
*
* <p>
* This is merely a convenience wrapper around the more general
* firePropertyChange method that takes {@code
* PropertyChangeEvent} value.
*
* @param propertyName The programmatic name of the property
* that was changed.
* @param oldValue The old value of the property.
* @param newValue The new value of the property.
*/
public void firePropertyChange(String propertyName,
Object oldValue, Object newValue) {
if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
return;
}
firePropertyChange(new PropertyChangeEvent(source, propertyName,
oldValue, newValue));
}
---------- BEGIN SOURCE ----------
if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
return;
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
if (oldValue == null) {
if (newValue == null) return;
} else {
if (oldValue.equals(newValue)) return;
}
PropertyChangeSupport.firePropertyChange(String propertyName, Object oldValue, Object newValue) fires PropertyChange when both values are null. This is not real change and should not firePropertyChange.
JUSTIFICATION :
Avoid infinite loops and StackOverflowException.
ACTUAL -
/**
* Report a bound property update to any registered listeners.
* No event is fired if old and new are equal and non-null.
*
* <p>
* This is merely a convenience wrapper around the more general
* firePropertyChange method that takes {@code
* PropertyChangeEvent} value.
*
* @param propertyName The programmatic name of the property
* that was changed.
* @param oldValue The old value of the property.
* @param newValue The new value of the property.
*/
public void firePropertyChange(String propertyName,
Object oldValue, Object newValue) {
if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
return;
}
firePropertyChange(new PropertyChangeEvent(source, propertyName,
oldValue, newValue));
}
---------- BEGIN SOURCE ----------
if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
return;
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
if (oldValue == null) {
if (newValue == null) return;
} else {
if (oldValue.equals(newValue)) return;
}
- duplicates
-
JDK-4763463 PropertyChangeSupport.firePropertyChange() notifies when oldVal == newVal ==null
-
- Closed
-
- relates to
-
JDK-4528354 firePropertyChange(null, null, null) doesn't notify enough listeners
-
- Open
-
-
JDK-6967462 AbstractAction firePropertyChange fires when oldValue == newValue == null
-
- Closed
-