Java 类javax.el.MethodNotFoundException 实例源码

项目:lams    文件:AstIdentifier.java   
private final Object invokeTarget(EvaluationContext ctx, Object target,
        Object[] paramValues) throws ELException {
    if (target instanceof MethodExpression) {
        MethodExpression me = (MethodExpression) target;
        return me.invoke(ctx.getELContext(), paramValues);
    } else if (target == 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: "
                        + target.getClass().getName());
    }
}
项目:lams    文件:ReflectionUtil.java   
/**
 * Returns a method based on the criteria
 * @param base the object that owns the method
 * @param property the name of the method
 * @param paramTypes the parameter types to use
 * @return the method specified
 * @throws MethodNotFoundException
 */
public static Method getMethod(Object base, Object property,
        Class[] paramTypes) throws MethodNotFoundException {
    if (base == null || property == null) {
        throw new MethodNotFoundException(MessageFactory.get(
                "error.method.notfound", base, property,
                paramString(paramTypes)));
    }

    String methodName = (property instanceof String) ? (String) property
            : property.toString();

    Method method = null;
    try {
        method = base.getClass().getMethod(methodName, paramTypes);
    } catch (NoSuchMethodException nsme) {
        throw new MethodNotFoundException(MessageFactory.get(
                "error.method.notfound", base, property,
                paramString(paramTypes)));
    }
    return method;
}
项目:xlsmapper    文件:ExpressionLangaugeEL2ImplTest.java   
/**
 * ラムダ式のテスト - EL2.xでは非さぽーとのため失敗する
 */
@Test(expected=ExpressionEvaluationException.class)
public void testEvaluate_lambda() {

    String expression = "sum=0;list.stream().forEach(x->(sum=sum+x));sum";

    Map<String, Object> vars = new HashMap<>();
    vars.put("list", Arrays.asList(1, 2, 3, 4, 5, 6));

    try {
        el.evaluate(expression, vars);
        fail();

    } catch(Exception e) {
        assertThat(e, is(instanceOf(ExpressionEvaluationException.class)));
        assertThat(e.getCause(), is(instanceOf(MethodNotFoundException.class)));

        throw e;
    }

}
项目:jboss-el    文件:ReflectionUtil.java   
public static Method findMethod(Object base, Object name, Object[] params) {
        Method r = null;
        if (base != null && name != null) {
            Class type = base.getClass();
            String methodName = ELSupport.coerceToString(name);
            MethodCache m = methodCache.get(type);
//            if (m == null || type != m.getType()) {
//                m = new MethodCache(type);
//                methodCache.set(type, m);
//            }
            r = m.findMethod(methodName, params);
            if (r == null) {
                throw new MethodNotFoundException(MessageFactory.get(
                        "error.method.notfound", base, name,
                        paramString(paramTypes(params))));
            }
        } else {
            throw new MethodNotFoundException();
        }
        return r;
    }
项目:jboss-el    文件:ReflectionUtil.java   
/**
 * Returns a method based on the criteria
 *
 * @param base
 *            the object that owns the method
 * @param property
 *            the name of the method
 * @param paramTypes
 *            the parameter types to use
 * @return the method specified
 * @throws MethodNotFoundException
 */
public static Method getMethod(Object base, Object property,
        Class[] paramTypes) throws MethodNotFoundException {
    if (base == null || property == null) {
        throw new MethodNotFoundException(MessageFactory.get(
                "error.method.notfound", base, property,
                paramString(paramTypes)));
    }

    String methodName = (property instanceof String) ? (String) property
            : property.toString();

    Method method = null;
    try {
        method = base.getClass().getMethod(methodName, paramTypes);
    } catch (NoSuchMethodException nsme) {
        throw new MethodNotFoundException(MessageFactory.get(
                "error.method.notfound", base, property,
                paramString(paramTypes)));
    }
    return method;
}
项目:tomcat7    文件:AstIdentifier.java   
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());
    }
}
项目:lams    文件:AstIdentifier.java   
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());
    }
}
项目:apache-tomcat-7.0.73-with-comment    文件:AstIdentifier.java   
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());
    }
}
项目:lazycat    文件:AstIdentifier.java   
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());
    }
}
项目:class-guard    文件:AstIdentifier.java   
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());
    }
}
项目:apache-tomcat-7.0.57    文件:AstIdentifier.java   
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());
    }
}
项目:apache-tomcat-7.0.57    文件:AstIdentifier.java   
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());
    }
}
项目:protobuf-el    文件:BuilderELResolver.java   
@Override
public Object invoke(final ELContext context, final Object base, final Object method,
    final Class<?>[] paramTypes, final Object[] params) {
  if (resolveType(base)) {
    if (isStrictMode) {
      throw new MethodNotFoundException();
    }
  }

  return null;
}
项目:protobuf-el    文件:BeanELResolverEx.java   
protected Method findMethodOrThrow(final String methodName, final Class<?>[] paramTypes,
    final Object[] params, final boolean staticOnly, final MethodDescriptor[] methodDescriptors) {
  final Method method = findMethod(methodName, paramTypes, params, staticOnly, methodDescriptors);

  if (method == null) {
    throw new MethodNotFoundException("Method " + methodName + "for bean class "
        + "not found or accessible");
  }

  return method;
}
项目:protobuf-el    文件:BeanELResolverEx.java   
protected Method findMethodOrThrow(final String methodName, final Class<?>[] paramTypes,
    final Object[] params, final boolean staticOnly,
    final Map<String, List<MethodDescriptor>> methodDescriptors) {
  final Method method = findMethod(methodName, paramTypes, params, staticOnly, methodDescriptors);

  if (method == null) {
    throw new MethodNotFoundException("Method " + methodName + " for bean class "
        + "not found or accessible");
  }

  return method;
}
项目:protobuf-el    文件:BeanELResolverEx.java   
protected Method findMethodOrThrow(final Class<?> klass, final String methodName,
    final Class<?>[] paramTypes, final Object[] params, final boolean staticOnly) {
  final Method method = findMethod(klass, methodName, paramTypes, params, staticOnly);

  if (method == null) {
    throw new MethodNotFoundException("Method " + methodName + "for class " + klass
        + " not found or accessible");
  }

  return method;
}
项目:jinjava    文件:JinjavaBeanELResolver.java   
@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());
  }
  return super.invoke(context, base, method, paramTypes, params);
}
项目:jboss-el    文件:AstIdentifier.java   
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());
    }
}
项目:WBSAirback    文件:AstIdentifier.java   
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());
    }
}
项目:tomcat7    文件:JspMethodNotFoundException.java   
public JspMethodNotFoundException(String mark, MethodNotFoundException e) {
    super(mark + " " + e.getMessage(), e.getCause());
}
项目:tomcat7    文件:TestReflectionUtil.java   
@Test(expected=MethodNotFoundException.class)
public void testBug54370a() {
    ReflectionUtil.getMethod(BASE, "testA",
            new Class[] {null, String.class},
            new Object[] {null, ""});
}
项目:tomcat7    文件:TestReflectionUtil.java   
@Test(expected=MethodNotFoundException.class)
public void testBug54370b() {
    ReflectionUtil.getMethod(BASE, "testB",
            new Class[] {null, String.class},
            new Object[] {null, ""});
}
项目:lams    文件:JspMethodNotFoundException.java   
public JspMethodNotFoundException(String mark, MethodNotFoundException e) {
    super(mark + " " + e.getMessage(), e.getCause());
}
项目:apache-tomcat-7.0.73-with-comment    文件:JspMethodNotFoundException.java   
public JspMethodNotFoundException(String mark, MethodNotFoundException e) {
    super(mark + " " + e.getMessage(), e.getCause());
}
项目:apache-tomcat-7.0.73-with-comment    文件:TestReflectionUtil.java   
@Test(expected=MethodNotFoundException.class)
public void testBug54370a() {
    ReflectionUtil.getMethod(BASE, "testA",
            new Class[] {null, String.class},
            new Object[] {null, ""});
}
项目:apache-tomcat-7.0.73-with-comment    文件:TestReflectionUtil.java   
@Test(expected=MethodNotFoundException.class)
public void testBug54370b() {
    ReflectionUtil.getMethod(BASE, "testB",
            new Class[] {null, String.class},
            new Object[] {null, ""});
}
项目:lazycat    文件:JspMethodNotFoundException.java   
public JspMethodNotFoundException(String mark, MethodNotFoundException e) {
    super(mark + " " + e.getMessage(), e.getCause());
}
项目:beyondj    文件:JspMethodNotFoundException.java   
public JspMethodNotFoundException(String mark, MethodNotFoundException e) {
    super(mark + " " + e.getMessage(), e.getCause());
}
项目:class-guard    文件:JspMethodNotFoundException.java   
public JspMethodNotFoundException(String mark, MethodNotFoundException e) {
    super(mark + " " + e.getMessage(), e.getCause());
}
项目:class-guard    文件:TestReflectionUtil.java   
@Test(expected=MethodNotFoundException.class)
public void testBug54370a() {
    ReflectionUtil.getMethod(BASE, "testA",
            new Class[] {null, String.class},
            new Object[] {null, ""});
}
项目:class-guard    文件:TestReflectionUtil.java   
@Test(expected=MethodNotFoundException.class)
public void testBug54370b() {
    ReflectionUtil.getMethod(BASE, "testB",
            new Class[] {null, String.class},
            new Object[] {null, ""});
}
项目:apache-tomcat-7.0.57    文件:JspMethodNotFoundException.java   
public JspMethodNotFoundException(String mark, MethodNotFoundException e) {
    super(mark + " " + e.getMessage(), e.getCause());
}
项目:apache-tomcat-7.0.57    文件:TestReflectionUtil.java   
@Test(expected=MethodNotFoundException.class)
public void testBug54370a() {
    ReflectionUtil.getMethod(BASE, "testA",
            new Class[] {null, String.class},
            new Object[] {null, ""});
}
项目:apache-tomcat-7.0.57    文件:TestReflectionUtil.java   
@Test(expected=MethodNotFoundException.class)
public void testBug54370b() {
    ReflectionUtil.getMethod(BASE, "testB",
            new Class[] {null, String.class},
            new Object[] {null, ""});
}
项目:apache-tomcat-7.0.57    文件:TestReflectionUtil.java   
@Test(expected=MethodNotFoundException.class)
public void testBug54370a() {
    ReflectionUtil.getMethod(BASE, "testA",
            new Class[] {null, String.class},
            new Object[] {null, ""});
}
项目:apache-tomcat-7.0.57    文件:TestReflectionUtil.java   
@Test(expected=MethodNotFoundException.class)
public void testBug54370b() {
    ReflectionUtil.getMethod(BASE, "testB",
            new Class[] {null, String.class},
            new Object[] {null, ""});
}
项目:apache-tomcat-7.0.57    文件:JspMethodNotFoundException.java   
public JspMethodNotFoundException(String mark, MethodNotFoundException e) {
    super(mark + " " + e.getMessage(), e.getCause());
}
项目:airavata    文件:ExperimentSummaryResource.java   
@Override
public ExperimentCatResource create(ResourceType type) throws RegistryException {
    throw new MethodNotFoundException();
}
项目:airavata    文件:ExperimentSummaryResource.java   
@Override
public void remove(ResourceType type, Object name) throws RegistryException {
    throw new MethodNotFoundException();
}
项目:airavata    文件:ExperimentSummaryResource.java   
@Override
public ExperimentCatResource get(ResourceType type, Object name) throws RegistryException {
    throw new MethodNotFoundException();
}