summaryrefslogtreecommitdiff
path: root/java/beans
diff options
context:
space:
mode:
authorDavid Gilbert <david.gilbert@object-refinery.com>2006-06-28 14:13:39 +0000
committerDavid Gilbert <david.gilbert@object-refinery.com>2006-06-28 14:13:39 +0000
commit5d0f5686ce69ece22c60f04df64ddb2e3f78c286 (patch)
treee78ee1fb48b63af8ec559ac1b8597bc8788c0a5b /java/beans
parentf593f9e0668e33b5ea36e7b6b96fb634cc80cccc (diff)
downloadclasspath-5d0f5686ce69ece22c60f04df64ddb2e3f78c286.tar.gz
2006-06-28 David Gilbert <david.gilbert@object-refinery.com>
* java/beans/VetoableChangeSupport.java (addVetoableChangeListener(VetoableChangeListener)): Do nothing for null listener, (addVetoableChangeListener(String, VetoableChangeListener)): Do nothing for null property name and/or listener, * javax/swing/JComponent.java (getListeners): Handle VetoableChangeListener.class as a special case, (getVetoableChangeListeners): Fetch these from the vetoableChangeSupport object.
Diffstat (limited to 'java/beans')
-rw-r--r--java/beans/VetoableChangeSupport.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/java/beans/VetoableChangeSupport.java b/java/beans/VetoableChangeSupport.java
index dce8dffd3..12051d2ff 100644
--- a/java/beans/VetoableChangeSupport.java
+++ b/java/beans/VetoableChangeSupport.java
@@ -1,5 +1,6 @@
/* VetoableChangeSupport.java -- support to manage vetoable change listeners
- Copyright (C) 1998, 1999, 2000, 2002, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2005, 2006,
+ Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -120,14 +121,15 @@ public class VetoableChangeSupport implements Serializable
* vetoable change events will be sent to this listener. The listener add
* is not unique: that is, <em>n</em> adds with the same listener will
* result in <em>n</em> events being sent to that listener for every
- * vetoable change. Adding a null listener may cause a NullPointerException
- * down the road. This method will unwrap a VetoableChangeListenerProxy,
+ * vetoable change. This method will unwrap a VetoableChangeListenerProxy,
* registering the underlying delegate to the named property list.
*
- * @param l the listener to add
+ * @param l the listener to add (<code>null</code> ignored).
*/
public synchronized void addVetoableChangeListener(VetoableChangeListener l)
{
+ if (l == null)
+ return;
if (l instanceof VetoableChangeListenerProxy)
{
VetoableChangeListenerProxy p = (VetoableChangeListenerProxy) l;
@@ -215,19 +217,19 @@ public class VetoableChangeSupport implements Serializable
* being sent to that listener when that property is changed. The effect is
* cumulative, too; if you are registered to listen to receive events on
* all vetoable changes, and then you register on a particular property,
- * you will receive change events for that property twice. Adding a null
- * listener may cause a NullPointerException down the road. This method
+ * you will receive change events for that property twice. This method
* will unwrap a VetoableChangeListenerProxy, registering the underlying
* delegate to the named property list if the names match, and discarding
* it otherwise.
*
* @param propertyName the name of the property to listen on
* @param l the listener to add
- * @throws NullPointerException if propertyName is null
*/
public synchronized void addVetoableChangeListener(String propertyName,
VetoableChangeListener l)
{
+ if (propertyName == null || l == null)
+ return;
while (l instanceof VetoableChangeListenerProxy)
{
VetoableChangeListenerProxy p = (VetoableChangeListenerProxy) l;