You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2009/11/18 21:01:51 UTC
svn commit: r881907 -
/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponent.java
Author: lu4242
Date: Wed Nov 18 20:01:51 2009
New Revision: 881907
URL: http://svn.apache.org/viewvc?rev=881907&view=rev
Log:
MYFACES-2408 UIComponent.subscribeToEvent and unsubscribeToEvent should throw NullPointerException when eventClass or componentListener is null
Modified:
myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponent.java
Modified: myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponent.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponent.java?rev=881907&r1=881906&r2=881907&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponent.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponent.java Wed Nov 18 20:01:51 2009
@@ -653,6 +653,15 @@
public void subscribeToEvent(Class<? extends SystemEvent> eventClass, ComponentSystemEventListener componentListener) {
// The default implementation creates an inner SystemEventListener instance that wraps argument
// componentListener as the listener argument.
+ if (eventClass == null)
+ {
+ throw new NullPointerException("eventClass required");
+ }
+ if (componentListener == null)
+ {
+ throw new NullPointerException("componentListener required");
+ }
+
SystemEventListener listener = new EventListenerWrapper(this, componentListener);
// Make sure the map exists
@@ -681,6 +690,15 @@
* What is that supposed to mean? Are we supposed to keep an internal map of created listener wrappers? TODO:
* Check with the EG what's the meaning of this, equals should be commutative -= Simon Lessard =-
*/
+ if (eventClass == null)
+ {
+ throw new NullPointerException("eventClass required");
+ }
+ if (componentListener == null)
+ {
+ throw new NullPointerException("componentListener required");
+ }
+
SystemEventListener listener = new EventListenerWrapper(this, componentListener);
getFacesContext().getApplication().unsubscribeFromEvent(eventClass, listener);