From 28a960cfab58e31e3cdac7467b44e4c3b437a151 Mon Sep 17 00:00:00 2001 From: Ben Alex Date: Wed, 20 Apr 2005 12:06:47 +0000 Subject: [PATCH] Handle null domain ojbect (useful if a search didn't find a match). --- .../java/org/acegisecurity/domain/dao/EvictionUtils.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/domain/src/main/java/org/acegisecurity/domain/dao/EvictionUtils.java b/domain/src/main/java/org/acegisecurity/domain/dao/EvictionUtils.java index 277dd574d9..68f78afb53 100644 --- a/domain/src/main/java/org/acegisecurity/domain/dao/EvictionUtils.java +++ b/domain/src/main/java/org/acegisecurity/domain/dao/EvictionUtils.java @@ -40,15 +40,13 @@ public class EvictionUtils { * * @param daoOrServices the potential source for * EvictionCapable services (never null) - * @param entity to evict (never null) + * @param entity to evict (can be null) */ public static void evictIfRequired(Object daoOrServices, PersistableEntity entity) { - Assert.notNull(entity, "Cannot evict an empty PersistableEntity object!"); - EvictionCapable evictor = getEvictionCapable(daoOrServices); - if (evictor != null) { + if (evictor != null && entity != null) { evictor.evict(entity); } }