return aue; }  else if ( InvalidDataAccessResourceUsageException.class .isAssignableFrom( t.getClass() ) ) { ApiUsageException aue = new ApiUsageException( t.getMessage() ); aue.setStackTrace( t.getStackTrace() ); log.warn("InvalidDataAccessResourceUsageException thrown:\n"+aue.getStackTrace());
    protected Throwable getAndLogException(Throwable t){        if (null == t)        {            log.error("Exception thrown. (null)");            return new InternalException("Exception thrown with null message");        }         else {            String msg = " Wrapped Exception: ("                + t.getClass().getName()+"):\n"                + t.getMessage();                        log.error("Exception thrown: "+msg);                        if ( RootException.class.isAssignableFrom( t.getClass() ) )                return t;            else if ( OptimisticLockingFailureException.class.isAssignableFrom( t.getClass() ))            {                OptimisticLockException ole = new OptimisticLockException( t.getMessage() );                ole.setStackTrace( t.getStackTrace() );                return ole;            }                        else if ( IllegalArgumentException.class.isAssignableFrom( t.getClass() ))            {                ApiUsageException aue = new ApiUsageException( t.getMessage() );                aue.setStackTrace( t.getStackTrace() );                log.warn("IllegalArgumentException thrown:\n"+aue.getStackTrace());                return aue;            }                        else             {                // Wrap all other exceptions in InternalException                InternalException re = new InternalException(msg);                re.setStackTrace(t.getStackTrace());                return re;            }                               }                }