0 Replies Latest reply on Jul 6, 2010 2:50 PM by simon lebettre

    Swallowed exceptions in entityQuery.getResultList

    simon lebettre Newbie

      Hi ,

      I figured exceptions that occur in EntityQuery.getResultList() are swallowed, the Exceptions handler chain is not invoked.

      For example if I have a @Restrict on loading an entity, the AuthorizationException is swallowed and in the server log there are only those dreadful transaction in abort stackTraces.

      The only way to know the real cause is to put a breakpoint in org.jboss.seam.util.Reflections and to look at invocationTargetException.target

      My dirty workaround is to use my own base class for EntityQuery wich overrides getResultList and calls Exceptions.instance().handle(e);

      (I do return null because if I throw, the error message appears 2 times in the error page).

      public abstract class BaseQuery<E> extends EntityQuery<E> {
           public List<E> getResultList() {
                try {
                     return super.getResultList();
                } catch (RuntimeException e) {
                     try {
                          //handle makes a redirect, so returning null is acceptable
                          return null;
                     } catch (Exception e1) {
                          if (e1 instanceof RuntimeException) {
                               throw (RuntimeException) e1;
                          } else {
                               throw new RuntimeException(e1);

      So, does anyone know a clean way to have the Exceptions handler doing it's work, or any insight on why entityQuery acts this way ?