bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/22792] PropertyEditorSupport::setValue throws exception w


From: gcc-bugzilla at gcc dot gnu dot org
Subject: [Bug classpath/22792] PropertyEditorSupport::setValue throws exception when oldVal is null
Date: 16 Oct 2005 01:27:14 -0000

java.beans.PropertyEditorSupport's "public void setValue(Object value)" method
throws a NullPointerException when oldVal is equal to null.  The method should
check for cases where the old value is null.  If both the new and the old
values are null, no property change event should be fired.  If only the old
value is null, a property change event should be fired.


------- Comment #1 from from-classpath at savannah dot gnu dot org  2004-10-25 
20:32 -------
It appears that old value is also being set inappropriately.  (oldValue = val
instead of oldValue = this.val).  Better variable names would improve the
clarity here.


------- Comment #2 from from-classpath at savannah dot gnu dot org  2004-10-26 
21:17 -------
thanks for report.

the fix is easy but I am going to write some mauve tests before I close the
bug.


------- Comment #3 from from-classpath at savannah dot gnu dot org  2004-10-26 
21:51 -------
> "If both the new and the old values are null, no property
> change event should be fired."
IMHO this is not true. A PropertyEditorSupport provides no property name (its
null). The doc for PropertyChangeEvent says when there is no property name, the
old and the new value should be null, too. Now, for each change (even null for
null or oldValue being equal to newValue) the change event is thrown. 

If you change the value of a PropertyEditorSupport PES using
PSE.setValue(whatEver) the following holds for the PropertyChangeEvent
delivered to all registered PropertyChangeListeners:

PropertyChangeEvent pce
pce.getOldValue() == pce.getNewValue() == null

(as said pce.getPropertyName() is null, too)

I know that this is horribly confusing but its specified that way in
PropertyChangeEvent. Rest assured: I am going to stress this behaviour when I
update the documentation.
:)


------- Comment #4 from from-classpath at savannah dot gnu dot org  2004-11-02 
12:02 -------
Fixed that and provided test cases for it.


------- Comment #5 from from-classpath at savannah dot gnu dot org  2005-04-15 
13:08 -------
Forgot to mark this as fixed.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22792





reply via email to

[Prev in Thread] Current Thread [Next in Thread]