javax.el.MethodNotFoundException Java Examples
The following examples show how to use
javax.el.MethodNotFoundException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JuelExpression.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
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); } }
Example #2
Source File: JinjavaBeanELResolver.java From jinjava with Apache License 2.0 | 5 votes |
@Override public Object invoke( ELContext context, Object base, Object method, Class<?>[] paramTypes, Object[] params ) { if (method == null || RESTRICTED_METHODS.contains(method.toString())) { throw new MethodNotFoundException( "Cannot find method '" + method + "' in " + base.getClass() ); } if (isRestrictedClass(base)) { throw new MethodNotFoundException( "Cannot find method '" + method + "' in " + base.getClass() ); } Object result = super.invoke(context, base, method, paramTypes, params); if (isRestrictedClass(result)) { throw new MethodNotFoundException( "Cannot find method '" + method + "' in " + base.getClass() ); } return result; }
Example #3
Source File: AstIdentifier.java From tomcatsrc with Apache License 2.0 | 5 votes |
private final MethodExpression getMethodExpression(EvaluationContext ctx) throws ELException { Object obj = null; // case A: ValueExpression exists, getValue which must // be a MethodExpression VariableMapper varMapper = ctx.getVariableMapper(); ValueExpression ve = null; if (varMapper != null) { ve = varMapper.resolveVariable(this.image); if (ve != null) { obj = ve.getValue(ctx); } } // case B: evaluate the identity against the ELResolver, again, must be // a MethodExpression to be able to invoke if (ve == null) { ctx.setPropertyResolved(false); obj = ctx.getELResolver().getValue(ctx, null, this.image); } // finally provide helpful hints if (obj instanceof MethodExpression) { return (MethodExpression) obj; } else if (obj == null) { throw new MethodNotFoundException("Identity '" + this.image + "' was null and was unable to invoke"); } else { throw new ELException( "Identity '" + this.image + "' does not reference a MethodExpression instance, returned type: " + obj.getClass().getName()); } }
Example #4
Source File: AstIdentifier.java From Tomcat8-Source-Read with MIT License | 5 votes |
private final MethodExpression getMethodExpression(EvaluationContext ctx) throws ELException { Object obj = null; // case A: ValueExpression exists, getValue which must // be a MethodExpression VariableMapper varMapper = ctx.getVariableMapper(); ValueExpression ve = null; if (varMapper != null) { ve = varMapper.resolveVariable(this.image); if (ve != null) { obj = ve.getValue(ctx); } } // case B: evaluate the identity against the ELResolver, again, must be // a MethodExpression to be able to invoke if (ve == null) { ctx.setPropertyResolved(false); obj = ctx.getELResolver().getValue(ctx, null, this.image); } // finally provide helpful hints if (obj instanceof MethodExpression) { return (MethodExpression) obj; } else if (obj == null) { throw new MethodNotFoundException("Identity '" + this.image + "' was null and was unable to invoke"); } else { throw new ELException( "Identity '" + this.image + "' does not reference a MethodExpression instance, returned type: " + obj.getClass().getName()); } }
Example #5
Source File: AstIdentifier.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
private final MethodExpression getMethodExpression(EvaluationContext ctx) throws ELException { Object obj = null; // case A: ValueExpression exists, getValue which must // be a MethodExpression VariableMapper varMapper = ctx.getVariableMapper(); ValueExpression ve = null; if (varMapper != null) { ve = varMapper.resolveVariable(this.image); if (ve != null) { obj = ve.getValue(ctx); } } // case B: evaluate the identity against the ELResolver, again, must be // a MethodExpression to be able to invoke if (ve == null) { ctx.setPropertyResolved(false); obj = ctx.getELResolver().getValue(ctx, null, this.image); } // finally provide helpful hints if (obj instanceof MethodExpression) { return (MethodExpression) obj; } else if (obj == null) { throw new MethodNotFoundException("Identity '" + this.image + "' was null and was unable to invoke"); } else { throw new ELException( "Identity '" + this.image + "' does not reference a MethodExpression instance, returned type: " + obj.getClass().getName()); } }
Example #6
Source File: JuelExpression.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public Object getValue(Map<String, Object> variables) { ELContext elContext = expressionManager.createElContext(variables); try { return valueExpression.getValue(elContext); } catch (PropertyNotFoundException pnfe) { throw new ActivitiFormException("Unknown property used in expression: " + expressionText, pnfe); } catch (MethodNotFoundException mnfe) { throw new ActivitiFormException("Unknown method used in expression: " + expressionText, mnfe); } catch (ELException ele) { throw new ActivitiFormException("Error while evaluating expression: " + expressionText, ele); } catch (Exception e) { throw new ActivitiFormException("Error while evaluating expression: " + expressionText, e); } }
Example #7
Source File: TestMethodExpressionImpl.java From Tomcat8-Source-Read with MIT License | 5 votes |
@Test(expected=MethodNotFoundException.class) public void testBug57855e() { MethodExpression me = factory.createMethodExpression(context, "${beanB.echo}", null , new Class[]{String.class}); Object r = me.invoke(context, new String[] { "aaa", "bbb" }); Assert.assertEquals("aaa, bbb", r.toString()); }
Example #8
Source File: TestReflectionUtil.java From Tomcat8-Source-Read with MIT License | 4 votes |
@Test(expected=MethodNotFoundException.class) public void testBug54370a() { ReflectionUtil.getMethod(null, BASE, "testA", new Class[] {null, String.class}, new Object[] {null, ""}); }
Example #9
Source File: TestReflectionUtil.java From Tomcat8-Source-Read with MIT License | 4 votes |
@Test(expected=MethodNotFoundException.class) public void testBug54370b() { ReflectionUtil.getMethod(null, BASE, "testB", new Class[] {null, String.class}, new Object[] {null, ""}); }
Example #10
Source File: TestMethodExpressionImpl.java From Tomcat8-Source-Read with MIT License | 4 votes |
@Test(expected=MethodNotFoundException.class) public void testBug57855a() { MethodExpression me = factory.createMethodExpression(context, "${beanAA.echo2}", null , new Class[]{String.class}); me.invoke(context, new Object[0]); }
Example #11
Source File: JspMethodNotFoundException.java From Tomcat8-Source-Read with MIT License | 4 votes |
public JspMethodNotFoundException(String mark, MethodNotFoundException e) { super(mark + " " + e.getMessage(), e.getCause()); }
Example #12
Source File: TestReflectionUtil.java From tomcatsrc with Apache License 2.0 | 4 votes |
@Test(expected=MethodNotFoundException.class) public void testBug54370b() { ReflectionUtil.getMethod(BASE, "testB", new Class[] {null, String.class}, new Object[] {null, ""}); }
Example #13
Source File: TestReflectionUtil.java From tomcatsrc with Apache License 2.0 | 4 votes |
@Test(expected=MethodNotFoundException.class) public void testBug54370a() { ReflectionUtil.getMethod(BASE, "testA", new Class[] {null, String.class}, new Object[] {null, ""}); }
Example #14
Source File: JspMethodNotFoundException.java From Tomcat7.0.67 with Apache License 2.0 | 4 votes |
public JspMethodNotFoundException(String mark, MethodNotFoundException e) { super(mark + " " + e.getMessage(), e.getCause()); }
Example #15
Source File: TestReflectionUtil.java From Tomcat7.0.67 with Apache License 2.0 | 4 votes |
@Test(expected=MethodNotFoundException.class) public void testBug54370a() { ReflectionUtil.getMethod(BASE, "testA", new Class[] {null, String.class}, new Object[] {null, ""}); }
Example #16
Source File: TestReflectionUtil.java From Tomcat7.0.67 with Apache License 2.0 | 4 votes |
@Test(expected=MethodNotFoundException.class) public void testBug54370b() { ReflectionUtil.getMethod(BASE, "testB", new Class[] {null, String.class}, new Object[] {null, ""}); }
Example #17
Source File: JspMethodNotFoundException.java From tomcatsrc with Apache License 2.0 | 4 votes |
public JspMethodNotFoundException(String mark, MethodNotFoundException e) { super(mark + " " + e.getMessage(), e.getCause()); }
Example #18
Source File: MethodExpressionImpl.java From Tomcat7.0.67 with Apache License 2.0 | 3 votes |
/** * Evaluates the expression relative to the provided context, and returns * information about the actual referenced method. * * @param context * The context of this evaluation * @return an instance of <code>MethodInfo</code> containing information * about the method the expression evaluated to. * @throws NullPointerException * if context is <code>null</code> or the base object is * <code>null</code> on the last resolution. * @throws PropertyNotFoundException * if one of the property resolutions failed because a specified * variable or property does not exist or is not readable. * @throws MethodNotFoundException * if no suitable method can be found. * @throws ELException * if an exception was thrown while performing property or * variable resolution. The thrown exception must be included as * the cause property of this exception, if available. * @see javax.el.MethodExpression#getMethodInfo(javax.el.ELContext) */ @Override public MethodInfo getMethodInfo(ELContext context) throws PropertyNotFoundException, MethodNotFoundException, ELException { Node n = this.getNode(); EvaluationContext ctx = new EvaluationContext(context, this.fnMapper, this.varMapper); return n.getMethodInfo(ctx, this.paramTypes); }
Example #19
Source File: MethodExpressionImpl.java From tomcatsrc with Apache License 2.0 | 3 votes |
/** * Evaluates the expression relative to the provided context, invokes the * method that was found using the supplied parameters, and returns the * result of the method invocation. * * @param context * The context of this evaluation. * @param params * The parameters to pass to the method, or <code>null</code> * if no parameters. * @return the result of the method invocation (<code>null</code> if the * method has a <code>void</code> return type). * @throws NullPointerException * if context is <code>null</code> or the base object is * <code>null</code> on the last resolution. * @throws PropertyNotFoundException * if one of the property resolutions failed because a specified * variable or property does not exist or is not readable. * @throws MethodNotFoundException * if no suitable method can be found. * @throws ELException * if an exception was thrown while performing property or * variable resolution. The thrown exception must be included as * the cause property of this exception, if available. If the * exception thrown is an <code>InvocationTargetException</code>, * extract its <code>cause</code> and pass it to the * <code>ELException</code> constructor. * @see javax.el.MethodExpression#invoke(javax.el.ELContext, * java.lang.Object[]) */ @Override public Object invoke(ELContext context, Object[] params) throws PropertyNotFoundException, MethodNotFoundException, ELException { EvaluationContext ctx = new EvaluationContext(context, this.fnMapper, this.varMapper); return this.getNode().invoke(ctx, this.paramTypes, params); }
Example #20
Source File: MethodExpressionImpl.java From tomcatsrc with Apache License 2.0 | 3 votes |
/** * Evaluates the expression relative to the provided context, and returns * information about the actual referenced method. * * @param context * The context of this evaluation * @return an instance of <code>MethodInfo</code> containing information * about the method the expression evaluated to. * @throws NullPointerException * if context is <code>null</code> or the base object is * <code>null</code> on the last resolution. * @throws PropertyNotFoundException * if one of the property resolutions failed because a specified * variable or property does not exist or is not readable. * @throws MethodNotFoundException * if no suitable method can be found. * @throws ELException * if an exception was thrown while performing property or * variable resolution. The thrown exception must be included as * the cause property of this exception, if available. * @see javax.el.MethodExpression#getMethodInfo(javax.el.ELContext) */ @Override public MethodInfo getMethodInfo(ELContext context) throws PropertyNotFoundException, MethodNotFoundException, ELException { Node n = this.getNode(); EvaluationContext ctx = new EvaluationContext(context, this.fnMapper, this.varMapper); return n.getMethodInfo(ctx, this.paramTypes); }
Example #21
Source File: MethodExpressionImpl.java From Tomcat7.0.67 with Apache License 2.0 | 3 votes |
/** * Evaluates the expression relative to the provided context, invokes the * method that was found using the supplied parameters, and returns the * result of the method invocation. * * @param context * The context of this evaluation. * @param params * The parameters to pass to the method, or <code>null</code> * if no parameters. * @return the result of the method invocation (<code>null</code> if the * method has a <code>void</code> return type). * @throws NullPointerException * if context is <code>null</code> or the base object is * <code>null</code> on the last resolution. * @throws PropertyNotFoundException * if one of the property resolutions failed because a specified * variable or property does not exist or is not readable. * @throws MethodNotFoundException * if no suitable method can be found. * @throws ELException * if an exception was thrown while performing property or * variable resolution. The thrown exception must be included as * the cause property of this exception, if available. If the * exception thrown is an <code>InvocationTargetException</code>, * extract its <code>cause</code> and pass it to the * <code>ELException</code> constructor. * @see javax.el.MethodExpression#invoke(javax.el.ELContext, * java.lang.Object[]) */ @Override public Object invoke(ELContext context, Object[] params) throws PropertyNotFoundException, MethodNotFoundException, ELException { EvaluationContext ctx = new EvaluationContext(context, this.fnMapper, this.varMapper); return this.getNode().invoke(ctx, this.paramTypes, params); }
Example #22
Source File: MethodExpressionImpl.java From Tomcat8-Source-Read with MIT License | 3 votes |
/** * Evaluates the expression relative to the provided context, invokes the * method that was found using the supplied parameters, and returns the * result of the method invocation. * * @param context * The context of this evaluation. * @param params * The parameters to pass to the method, or <code>null</code> * if no parameters. * @return the result of the method invocation (<code>null</code> if the * method has a <code>void</code> return type). * @throws NullPointerException * if context is <code>null</code> or the base object is * <code>null</code> on the last resolution. * @throws PropertyNotFoundException * if one of the property resolutions failed because a specified * variable or property does not exist or is not readable. * @throws MethodNotFoundException * if no suitable method can be found. * @throws ELException * if an exception was thrown while performing property or * variable resolution. The thrown exception must be included as * the cause property of this exception, if available. If the * exception thrown is an <code>InvocationTargetException</code>, * extract its <code>cause</code> and pass it to the * <code>ELException</code> constructor. * @see javax.el.MethodExpression#invoke(javax.el.ELContext, * java.lang.Object[]) */ @Override public Object invoke(ELContext context, Object[] params) throws PropertyNotFoundException, MethodNotFoundException, ELException { EvaluationContext ctx = new EvaluationContext(context, this.fnMapper, this.varMapper); ctx.notifyBeforeEvaluation(getExpressionString()); Object result = this.getNode().invoke(ctx, this.paramTypes, params); ctx.notifyAfterEvaluation(getExpressionString()); return result; }
Example #23
Source File: MethodExpressionImpl.java From Tomcat8-Source-Read with MIT License | 3 votes |
/** * Evaluates the expression relative to the provided context, and returns * information about the actual referenced method. * * @param context * The context of this evaluation * @return an instance of <code>MethodInfo</code> containing information * about the method the expression evaluated to. * @throws NullPointerException * if context is <code>null</code> or the base object is * <code>null</code> on the last resolution. * @throws PropertyNotFoundException * if one of the property resolutions failed because a specified * variable or property does not exist or is not readable. * @throws MethodNotFoundException * if no suitable method can be found. * @throws ELException * if an exception was thrown while performing property or * variable resolution. The thrown exception must be included as * the cause property of this exception, if available. * @see javax.el.MethodExpression#getMethodInfo(javax.el.ELContext) */ @Override public MethodInfo getMethodInfo(ELContext context) throws PropertyNotFoundException, MethodNotFoundException, ELException { Node n = this.getNode(); EvaluationContext ctx = new EvaluationContext(context, this.fnMapper, this.varMapper); ctx.notifyBeforeEvaluation(getExpressionString()); MethodInfo result = n.getMethodInfo(ctx, this.paramTypes); ctx.notifyAfterEvaluation(getExpressionString()); return result; }