Handle null domain ojbect (useful if a search didn't find a match).

This commit is contained in:
Ben Alex 2005-04-20 12:06:47 +00:00
parent cea4bf11d1
commit 28a960cfab
1 changed files with 2 additions and 4 deletions

View File

@ -40,15 +40,13 @@ public class EvictionUtils {
* *
* @param daoOrServices the potential source for * @param daoOrServices the potential source for
* <code>EvictionCapable</code> services (never <code>null</code>) * <code>EvictionCapable</code> services (never <code>null</code>)
* @param entity to evict (never <code>null</code>) * @param entity to evict (can be <code>null</code>)
*/ */
public static void evictIfRequired(Object daoOrServices, public static void evictIfRequired(Object daoOrServices,
PersistableEntity entity) { PersistableEntity entity) {
Assert.notNull(entity, "Cannot evict an empty PersistableEntity object!");
EvictionCapable evictor = getEvictionCapable(daoOrServices); EvictionCapable evictor = getEvictionCapable(daoOrServices);
if (evictor != null) { if (evictor != null && entity != null) {
evictor.evict(entity); evictor.evict(entity);
} }
} }