Java Code Examples for org.springframework.expression.ExpressionInvocationTargetException

Following code examples demonstrate how to use org.springframework.expression.ExpressionInvocationTargetExceptionfrom spring-framework. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.springframework.expression.ExpressionInvocationTargetExceptionand various code implementation of this class.

	private void throwSimpleExceptionIfPossible(ExpressionState state, AccessException ae) {
		if (ae.getCause() instanceof InvocationTargetException) {
			Throwable rootCause = ae.getCause().getCause();
			if (rootCause instanceof RuntimeException) {
				throw (RuntimeException) rootCause;
			}
			else {
				throw new ExpressionInvocationTargetException(getStartPosition(),
						"A problem occurred when trying to execute method '" + this.name +
						"' on object of type '" + state.getActiveContextObject().getValue().getClass().getName() + "'",
						rootCause);
			}			
		}
	} 


Advertisement
Javadoc
This exception wraps (as cause) a checked exception thrown by some method that SpEL invokes. It diff

ers from a SpelEvaluationException because this indicates the occurrence of a checked exception that the invoked method was defined to throw. SpelEvaluationExceptions are for handling (and wrapping) unexpected exceptions. @author Andy Clement @since 3.0.3

Read More
Advertisement