-
Bug
-
Resolution: Fixed
-
P2
-
7
-
b17
-
generic
-
generic
-
Verified
The following constructor:
http://download.oracle.com/javase/7/docs/api/java/beans/PropertyChangeEvent.html#PropertyChangeEvent%28java.lang.Object,%20java.lang.String,%20java.lang.Object,%20java.lang.Object%29
Does not specify thrown NullPointerException for passed null source object
However the parent constructor which is used by the implementation specifies:
http://download.oracle.com/javase/7/docs/api/java/util/EventObject.html#EventObject%28java.lang.Object%29
The following code illustrates this issue:
import java.beans.PropertyChangeEvent;
/**
*
*/
public class PropChangeEvent {
public static void main(String[] args) {
/**
* Constructs a new PropertyChangeEvent.
Parameters:
source - The bean that fired the event.
propertyName - The programmatic name of the property that was changed.
oldValue - The old value of the property.
newValue - The new value of the property.
*/
new PropertyChangeEvent(null, null, null, null);
}
}
The output will be:
Exception in thread "main" java.lang.IllegalArgumentException: null source
at java.util.EventObject.<init>(EventObject.java:56)
at java.beans.PropertyChangeEvent.<init>(PropertyChangeEvent.java:60)
at bugs.PropChangeEvent.main(PropChangeEvent.java:20)
http://download.oracle.com/javase/7/docs/api/java/beans/PropertyChangeEvent.html#PropertyChangeEvent%28java.lang.Object,%20java.lang.String,%20java.lang.Object,%20java.lang.Object%29
Does not specify thrown NullPointerException for passed null source object
However the parent constructor which is used by the implementation specifies:
http://download.oracle.com/javase/7/docs/api/java/util/EventObject.html#EventObject%28java.lang.Object%29
The following code illustrates this issue:
import java.beans.PropertyChangeEvent;
/**
*
*/
public class PropChangeEvent {
public static void main(String[] args) {
/**
* Constructs a new PropertyChangeEvent.
Parameters:
source - The bean that fired the event.
propertyName - The programmatic name of the property that was changed.
oldValue - The old value of the property.
newValue - The new value of the property.
*/
new PropertyChangeEvent(null, null, null, null);
}
}
The output will be:
Exception in thread "main" java.lang.IllegalArgumentException: null source
at java.util.EventObject.<init>(EventObject.java:56)
at java.beans.PropertyChangeEvent.<init>(PropertyChangeEvent.java:60)
at bugs.PropChangeEvent.main(PropChangeEvent.java:20)