Fix for null dbobjects causing NPEs in event framework.

This commit is contained in:
Jon Brisbin
2011-03-30 17:08:38 -05:00
committed by J. Brisbin
parent 27ba19eac6
commit 2c5d0b3893

View File

@@ -1203,14 +1203,12 @@ public class MongoTemplate implements InitializingBean, MongoOperations, Applica
}
public T doWith(DBObject object) {
maybeEmitEvent(new AfterLoadEvent<DBObject>(object));
if (null != object) {
maybeEmitEvent(new AfterLoadEvent<DBObject>(object));
}
T source = reader.read(type, object);
if (null != source) {
maybeEmitEvent(new AfterConvertEvent<T>(object, source));
} else {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Source object was <NULL>, so couldn't fire AfterConvertEvent<" + type.getName() + ">");
}
}
return source;
}