[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] FYI: SwingPropertyChangeSupport.firePropertyChange() fix
From: |
David Gilbert |
Subject: |
[cp-patches] FYI: SwingPropertyChangeSupport.firePropertyChange() fix |
Date: |
Wed, 12 Oct 2005 10:06:14 +0000 |
User-agent: |
Mozilla Thunderbird 1.0.6 (X11/20050728) |
The API docs state that "No event is fired if the given event's old and new values
are equal and non-null". I wrote a Mauve test that confirms this, and that the
event IS sent if the old and new values are both null (see also the Sun bug report
4229935). In Classpath, we're not sending the event in the latter case, but this is
fixed with this patch (committed):
2005-10-12 David Gilbert <address@hidden>
* javax/swing/event/SwingPropertyChangeSupport.java
(firePropertyChange(PropertyChangeEvent)): if old and new values are
both null, listeners should be notified.
Regards,
Dave
Index: javax/swing/event/SwingPropertyChangeSupport.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/javax/swing/event/SwingPropertyChangeSupport.java,v
retrieving revision 1.7
diff -u -r1.7 SwingPropertyChangeSupport.java
--- javax/swing/event/SwingPropertyChangeSupport.java 23 Aug 2005 10:53:30
-0000 1.7
+++ javax/swing/event/SwingPropertyChangeSupport.java 12 Oct 2005 08:52:49
-0000
@@ -289,10 +289,9 @@
int index;
PropertyChangeListener listener;
- // Check Values if they are equal
- if (event.getOldValue() == null && event.getNewValue() == null ||
- (event.getOldValue() != null && event.getNewValue() != null &&
- event.getOldValue().equals(event.getNewValue())))
+ // if the old and new values are non-null and equal, don't notify listeners
+ if (event.getOldValue() != null && event.getNewValue() != null &&
+ event.getOldValue().equals(event.getNewValue()))
return;
// Process Main Listener List
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cp-patches] FYI: SwingPropertyChangeSupport.firePropertyChange() fix,
David Gilbert <=