Search in sources :

Example 1 with MethodInvocationException

use of org.springframework.beans.MethodInvocationException in project com.revolsys.open by revolsys.

the class ScriptExecutorRunnable method getBeanExceptionCause.

private static Throwable getBeanExceptionCause(final BeanCreationException e) {
    Throwable cause = e.getCause();
    while (cause instanceof BeanCreationException || cause instanceof MethodInvocationException || cause instanceof PropertyAccessException || cause instanceof PropertyBatchUpdateException || cause instanceof InvalidPropertyException) {
        Throwable newCause;
        if (cause instanceof PropertyBatchUpdateException) {
            final PropertyBatchUpdateException batchEx = (PropertyBatchUpdateException) cause;
            newCause = batchEx.getPropertyAccessExceptions()[0];
        } else {
            newCause = cause.getCause();
        }
        if (newCause != null) {
            cause = newCause;
        } else {
            return cause;
        }
    }
    return cause;
}
Also used : BeanCreationException(org.springframework.beans.factory.BeanCreationException) PropertyBatchUpdateException(org.springframework.beans.PropertyBatchUpdateException) InvalidPropertyException(org.springframework.beans.InvalidPropertyException) PropertyAccessException(org.springframework.beans.PropertyAccessException) MethodInvocationException(org.springframework.beans.MethodInvocationException)

Example 2 with MethodInvocationException

use of org.springframework.beans.MethodInvocationException in project com.revolsys.open by revolsys.

the class ScriptTool method getBeanExceptionCause.

private static Throwable getBeanExceptionCause(final BeanCreationException e) {
    Throwable cause = e.getCause();
    if (cause == null) {
        return e;
    }
    while (cause instanceof BeanCreationException || cause instanceof MethodInvocationException || cause instanceof PropertyAccessException || cause instanceof PropertyBatchUpdateException || cause instanceof InvalidPropertyException) {
        Throwable newCause;
        if (cause instanceof PropertyBatchUpdateException) {
            final PropertyBatchUpdateException batchEx = (PropertyBatchUpdateException) cause;
            newCause = batchEx.getPropertyAccessExceptions()[0];
        } else {
            newCause = cause.getCause();
        }
        if (newCause != null) {
            cause = newCause;
        } else {
            return cause;
        }
    }
    return cause;
}
Also used : BeanCreationException(org.springframework.beans.factory.BeanCreationException) PropertyBatchUpdateException(org.springframework.beans.PropertyBatchUpdateException) InvalidPropertyException(org.springframework.beans.InvalidPropertyException) PropertyAccessException(org.springframework.beans.PropertyAccessException) MethodInvocationException(org.springframework.beans.MethodInvocationException)

Aggregations

InvalidPropertyException (org.springframework.beans.InvalidPropertyException)2 MethodInvocationException (org.springframework.beans.MethodInvocationException)2 PropertyAccessException (org.springframework.beans.PropertyAccessException)2 PropertyBatchUpdateException (org.springframework.beans.PropertyBatchUpdateException)2 BeanCreationException (org.springframework.beans.factory.BeanCreationException)2