From 050aad717d2db8ff90d5b77e824caa0d3345ee76 Mon Sep 17 00:00:00 2001 From: Tom Eugelink Date: Tue, 3 Feb 2015 15:47:58 +0100 Subject: [PATCH] Exceptions in events are swallowed --- .../server/deploy/BeanLifecycleAdapterFactory.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanLifecycleAdapterFactory.java b/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanLifecycleAdapterFactory.java index a33b53d2e..71c053945 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanLifecycleAdapterFactory.java +++ b/src/main/java/com/avaje/ebeaninternal/server/deploy/BeanLifecycleAdapterFactory.java @@ -1,8 +1,10 @@ package com.avaje.ebeaninternal.server.deploy; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Set; +import javax.persistence.PersistenceException; import javax.persistence.PostLoad; import javax.persistence.PostPersist; import javax.persistence.PostRemove; @@ -121,9 +123,13 @@ public class BeanLifecycleAdapterFactory { private void invoke(Method method, Object bean) { try { method.invoke(bean); - } catch (Exception e) { - logger.error("Error invoking lifecycle adapter", e); - } + } + catch (InvocationTargetException e) { + throw new PersistenceException("Error invoking lifecycle method", e); + } + catch (IllegalAccessException e) { + throw new PersistenceException("Error invoking lifecycle method", e); + } } private void invoke(Method method, BeanPersistRequest request) {