use of org.activiti.engine.impl.javax.el.PropertyNotFoundException in project Activiti by Activiti.
the class AstProperty method invoke.
public Object invoke(Bindings bindings, ELContext context, Class<?> returnType, Class<?>[] paramTypes, Object[] paramValues) {
Object base = prefix.eval(bindings, context);
if (base == null) {
throw new PropertyNotFoundException(LocalMessages.get("error.property.base.null", prefix));
}
Object property = getProperty(bindings, context);
if (property == null && strict) {
throw new PropertyNotFoundException(LocalMessages.get("error.property.method.notfound", "null", base));
}
String name = bindings.convert(property, String.class);
Method method = findMethod(name, base.getClass(), returnType, paramTypes);
try {
return method.invoke(base, paramValues);
} catch (IllegalAccessException e) {
throw new ELException(LocalMessages.get("error.property.method.access", name, base.getClass()));
} catch (IllegalArgumentException e) {
throw new ELException(LocalMessages.get("error.property.method.invocation", name, base.getClass()), e);
} catch (InvocationTargetException e) {
throw new ELException(LocalMessages.get("error.property.method.invocation", name, base.getClass()), e.getCause());
}
}
use of org.activiti.engine.impl.javax.el.PropertyNotFoundException in project Activiti by Activiti.
the class JuelExpression method getValue.
public Object getValue(VariableScope variableScope) {
ELContext elContext = Context.getProcessEngineConfiguration().getExpressionManager().getElContext(variableScope);
try {
ExpressionGetInvocation invocation = new ExpressionGetInvocation(valueExpression, elContext);
Context.getProcessEngineConfiguration().getDelegateInterceptor().handleInvocation(invocation);
return invocation.getInvocationResult();
} catch (PropertyNotFoundException pnfe) {
throw new ActivitiException("Unknown property used in expression: " + expressionText, pnfe);
} catch (MethodNotFoundException mnfe) {
throw new ActivitiException("Unknown method used in expression: " + expressionText, mnfe);
} catch (ELException ele) {
throw new ActivitiException("Error while evaluating expression: " + expressionText, ele);
} catch (Exception e) {
throw new ActivitiException("Error while evaluating expression: " + expressionText, e);
}
}
use of org.activiti.engine.impl.javax.el.PropertyNotFoundException in project Activiti by Activiti.
the class ExpressionBeanAccessTest method testConfigurationBeanAccess.
@Deployment
public void testConfigurationBeanAccess() {
// Exposed bean returns 'I'm exposed' when to-string is called in first service-task
ProcessInstance pi = runtimeService.startProcessInstanceByKey("expressionBeanAccess");
assertEquals("I'm exposed", runtimeService.getVariable(pi.getId(), "exposedBeanResult"));
// is not added to the beans-list
try {
runtimeService.signal(pi.getId());
fail("Exception expected");
} catch (ActivitiException ae) {
assertNotNull(ae.getCause());
assertTrue(ae.getCause() instanceof PropertyNotFoundException);
}
}
Aggregations