dev@javaserverfaces.java.net

[REVIEW] Event Classes Should Throw IllegalArgumentException

From: Roger Kitain <Roger.Kitain_at_Sun.COM>
Date: Tue, 16 Dec 2008 01:24:47 -0500

M jsf-api/src/javax/faces/event/ViewMapCreatedEvent.java
M jsf-api/src/javax/faces/event/ComponentSystemEvent.java
M jsf-api/src/javax/faces/event/ViewMapDestroyedEvent.java
M jsf-api/src/javax/faces/event/BeforeRenderEvent.java
M jsf-api/src/javax/faces/event/AfterRestoreStateEvent.java
M jsf-api/src/javax/faces/event/AfterAddToViewEvent.java
M jsf-api/src/javax/faces/event/SystemEvent.java
M jsf-api/src/javax/faces/event/InitialStateEvent.java

JavaDocs: throw IllegalArgumentException instead of NullPointerException
for consistency with other Faces event classes like ActionEvent.

All tests run.

====================
Index: jsf-api/src/javax/faces/event/AfterAddToViewEvent.java
===================================================================
--- jsf-api/src/javax/faces/event/AfterAddToViewEvent.java (revision
6121)
+++ jsf-api/src/javax/faces/event/AfterAddToViewEvent.java (working copy)
@@ -86,7 +86,7 @@
      * @param component the <code>UIComponent</code> that has just been
      * added to the view.
      *
- * @throws <code>NullPointerException</code> if the argument is
<code>null</code>.
+ * @throws <code>IllegalArgumentException</code> if the argument is
<code>null</code>.
      */
     public AfterAddToViewEvent(UIComponent component) {
 
Index: jsf-api/src/javax/faces/event/AfterRestoreStateEvent.java
===================================================================
--- jsf-api/src/javax/faces/event/AfterRestoreStateEvent.java
(revision 6121)
+++ jsf-api/src/javax/faces/event/AfterRestoreStateEvent.java
(working copy)
@@ -32,7 +32,7 @@
 
      * @param component the <code>UIComponent</code> whose state was
just restored.
 
- * @throws <code>NullPointerException</code> if the argument is
<code>null</code>.
+ * @throws <code>IllegalArgumentException</code> if the argument is
<code>null</code>.
      */
     public AfterRestoreStateEvent(UIComponent component) {
         super(component);
Index: jsf-api/src/javax/faces/event/BeforeRenderEvent.java
===================================================================
--- jsf-api/src/javax/faces/event/BeforeRenderEvent.java (revision 6121)
+++ jsf-api/src/javax/faces/event/BeforeRenderEvent.java (working copy)
@@ -36,7 +36,7 @@
      * @param component the <code>UIComponent</code> that is about to be
      * rendered.
 
- * @throws <code>NullPointerException</code> if the argument is
<code>null</code>.
+ * @throws <code>IllegalArgumentException</code> if the argument is
<code>null</code>.
      */
     public BeforeRenderEvent(UIComponent component) {
         super(component);
Index: jsf-api/src/javax/faces/event/ComponentSystemEvent.java
===================================================================
--- jsf-api/src/javax/faces/event/ComponentSystemEvent.java (revision
6121)
+++ jsf-api/src/javax/faces/event/ComponentSystemEvent.java (working
copy)
@@ -30,7 +30,7 @@
      * @param component the <code>UIComponent</code> reference to be
      * passed to the superclass constructor.
      *
- * @throws <code>NullPointerException</code> if the argument is
<code>null</code>.
+ * @throws <code>IllegalArgumentException</code> if the argument is
<code>null</code>.
      *
      * @since 2.0
      */
Index: jsf-api/src/javax/faces/event/InitialStateEvent.java
===================================================================
--- jsf-api/src/javax/faces/event/InitialStateEvent.java (revision 6121)
+++ jsf-api/src/javax/faces/event/InitialStateEvent.java (working copy)
@@ -30,7 +30,7 @@
 
      * @param component the <code>UIComponent</code> whose state was
just restored.
 
- * @throws <code>NullPointerException</code> if the argument is
<code>null</code>.
+ * @throws <code>IllegalArgumentException</code> if the argument is
<code>null</code>.
      */
     public InitialStateEvent(UIComponent component) {
         super(component);
Index: jsf-api/src/javax/faces/event/SystemEvent.java
===================================================================
--- jsf-api/src/javax/faces/event/SystemEvent.java (revision 6121)
+++ jsf-api/src/javax/faces/event/SystemEvent.java (working copy)
@@ -29,7 +29,7 @@
      * @param source the <code>source</code> reference to be
      * passed to the superclass constructor.
      *
- * @throws <code>NullPointerException</code> if the argument is
+ * @throws <code>IllegalArgumentException</code> if the argument is
      * <code>null</code>.
      */
     public SystemEvent(Object source) {
Index: jsf-api/src/javax/faces/event/ViewMapCreatedEvent.java
===================================================================
--- jsf-api/src/javax/faces/event/ViewMapCreatedEvent.java (revision
6121)
+++ jsf-api/src/javax/faces/event/ViewMapCreatedEvent.java (working copy)
@@ -34,7 +34,7 @@
      * @param root the <code>UIViewRoot</code> for which a view map has
      * just been created.
      *
- * @throws <code>NullPointerException</code> if the argument is
<code>null</code>.
+ * @throws <code>IllegalArgumentException</code> if the argument is
<code>null</code>.
      */
     public ViewMapCreatedEvent(UIViewRoot root) {
         super(root);
Index: jsf-api/src/javax/faces/event/ViewMapDestroyedEvent.java
===================================================================
--- jsf-api/src/javax/faces/event/ViewMapDestroyedEvent.java
(revision 6121)
+++ jsf-api/src/javax/faces/event/ViewMapDestroyedEvent.java (working
copy)
@@ -36,7 +36,7 @@
      * @param root the <code>UIViewRoot</code> for which the view map has
      * just been destroyed.
      *
- * @throws <code>NullPointerException</code> if the argument is
<code>null</code>.
+ * @throws <code>IllegalArgumentException</code> if the argument is
<code>null</code>.
      */
     public ViewMapDestroyedEvent(UIViewRoot root) {
         super(root);