Author: tchemit Date: 2010-06-12 22:46:40 +0200 (Sat, 12 Jun 2010) New Revision: 2005 Url: http://nuiton.org/repositories/revision/topia/2005 Log: Evolution #683: Throw a NullPointerException when adding or removing a null listener in TopiaFireSupport Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java =================================================================== --- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java 2010-06-12 15:54:17 UTC (rev 2004) +++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java 2010-06-12 20:46:40 UTC (rev 2005) @@ -899,6 +899,9 @@ public void addTopiaEntityListener( Class<? extends TopiaEntity> entityClass, TopiaEntityListener listener) { + if (listener == null) { + throw new NullPointerException("listener can not be null."); + } entityListeners.add(entityClass, listener); } @@ -909,26 +912,44 @@ public void addTopiaEntityVetoable( Class<? extends TopiaEntity> entityClass, TopiaEntityVetoable vetoable) { + if (vetoable == null) { + throw new NullPointerException("listener can not be null."); + } entityVetoables.add(entityClass, vetoable); } public void addTopiaTransactionListener(TopiaTransactionListener listener) { + if (listener == null) { + throw new NullPointerException("listener can not be null."); + } transactionListeners.add(listener); } public void addTopiaTransactionVetoable(TopiaTransactionVetoable vetoable) { + if (vetoable== null) { + throw new NullPointerException("listener can not be null."); + } transactionVetoables.add(vetoable); } public void addPropertyChangeListener(PropertyChangeListener listener) { + if (listener == null) { + throw new NullPointerException("listener can not be null."); + } propertyChangeListeners.add(listener); } public void addTopiaContextListener(TopiaContextListener listener) { + if (listener == null) { + throw new NullPointerException("listener can not be null."); + } topiaContextListeners.add(listener); } public void addTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable) { + if (vetoable == null) { + throw new NullPointerException("listener can not be null."); + } entitiesVetoables.add(vetoable); } @@ -941,6 +962,9 @@ public void removeTopiaEntityListener( Class<? extends TopiaEntity> entityClass, TopiaEntityListener listener) { + if (listener == null) { + throw new NullPointerException("listener can not be null."); + } entityListeners.remove(entityClass, listener); } @@ -951,26 +975,44 @@ public void removeTopiaEntityVetoable( Class<? extends TopiaEntity> entityClass, TopiaEntityVetoable vetoable) { + if (vetoable == null) { + throw new NullPointerException("listener can not be null."); + } entityVetoables.remove(entityClass, vetoable); } public void removeTopiaTransactionListener(TopiaTransactionListener listener) { + if (listener == null) { + throw new NullPointerException("listener can not be null."); + } transactionListeners.remove(listener); } public void removeTopiaTransactionVetoable(TopiaTransactionVetoable vetoable) { + if (vetoable == null) { + throw new NullPointerException("listener can not be null."); + } transactionVetoables.remove(vetoable); } public void removePropertyChangeListener(PropertyChangeListener listener) { + if (listener == null) { + throw new NullPointerException("listener can not be null."); + } propertyChangeListeners.remove(listener); } public void removeTopiaContextListener(TopiaContextListener listener) { + if (listener == null) { + throw new NullPointerException("listener can not be null."); + } topiaContextListeners.remove(listener); } public void removeTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable) { + if (vetoable == null) { + throw new NullPointerException("listener can not be null."); + } entitiesVetoables.remove(vetoable); }