logger.debug("Successfully resolved property '" + beanName + "' in root WebApplicationContext"); elContext.setPropertyResolved(true); try { return wac.getType(beanName); throw new ELException(ex); elContext.setPropertyResolved(true); return WebApplicationContext.class;
public boolean isReadOnly(ELContext context, Object base, Object property) { if (property == null) { return true; } try { context.setPropertyResolved(true); if (base == null) { return false; // what can I do? } else { if (base instanceof List || base.getClass().isArray()) { return this.getPropertyResolver().isReadOnly(base, Integer.parseInt(property.toString())); } else { return this.getPropertyResolver().isReadOnly(base, property); } } } catch (PropertyNotFoundException e) { throw new javax.el.PropertyNotFoundException(e.getMessage(), e .getCause()); } catch (EvaluationException e) { throw new ELException(e.getMessage(), e.getCause()); } }
@Override public Object getValue(ELContext context, Object base, Object property) { Objects.requireNonNull(context); if (base == null) { context.setPropertyResolved(base, property); if (property != null) { try { return this.variableResolver.resolveVariable(property .toString()); } catch (javax.servlet.jsp.el.ELException e) { throw new ELException(e.getMessage(), e.getCause()); } } } if (!context.isPropertyResolved()) { return elResolver.getValue(context, base, property); } return null; }
public Object invoke(FacesContext facesContext, Object[] params) throws EvaluationException, MethodNotFoundException { try { return methodExpression.invoke(facesContext.getELContext(), params); } catch (javax.el.MethodNotFoundException e) { throw new javax.faces.el.MethodNotFoundException(e); } catch (ELException e) { throw new EvaluationException(e.getCause()); } }
@Override public Class<?> getType(ELContext context, Object base, Object property) { Objects.requireNonNull(context); if (base == null) { context.setPropertyResolved(base, property); if (property != null) { try { Object obj = this.variableResolver.resolveVariable(property .toString()); return (obj != null) ? obj.getClass() : null; } catch (javax.servlet.jsp.el.ELException e) { throw new ELException(e.getMessage(), e.getCause()); } } } if (!context.isPropertyResolved()) { return elResolver.getType(context, base, property); } return null; }
/** * <p>Evaluate with the legacy variable resolver chain and return * the value.</p> * * @param context <code>ELContext</code> for evaluating this value * @param base Base object against which this evaluation occurs * (must be null because we are evaluating a top level variable) * @param property Property name to be accessed */ public Object getValue(ELContext context, Object base, Object property) { if (base != null) { return null; } if (property == null) { throw new PropertyNotFoundException("No property specified"); } FacesContext fcontext = (FacesContext) context.getContext(FacesContext.class); ExternalContext econtext = fcontext.getExternalContext(); String name = property.toString(); context.setPropertyResolved(true); ELContext elContext = fcontext.getELContext(); VariableResolver vr = fcontext.getApplication().getVariableResolver(); try { return vr.resolveVariable(fcontext, name); } catch (Exception e) { context.setPropertyResolved(false); throw new ELException(e); } }
public Object getValue(FacesContext context) throws EvaluationException, PropertyNotFoundException { ELContext ctx = context.getELContext(); try { return this.delegate.getValue(ctx); } catch (javax.el.PropertyNotFoundException e) { throw new PropertyNotFoundException(e.getMessage(), e.getCause()); } catch (ELException e) { throw new EvaluationException(e.getMessage(), e.getCause()); } }
public void setValue(Bindings bindings, ELContext context, Object value) throws ELException { if (!lvalue) { throw new ELException(LocalMessages.get("error.value.set.rvalue", getStructuralId(bindings))); } 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.property.notfound", "null", base)); } context.setPropertyResolved(false); Class<?> type = context.getELResolver().getType(context, base, property); if (context.isPropertyResolved()) { if (type != null && (value != null || type.isPrimitive())) { value = bindings.convert(value, type); } context.setPropertyResolved(false); } context.getELResolver().setValue(context, base, property, value); if (!context.isPropertyResolved()) { throw new PropertyNotFoundException(LocalMessages.get("error.property.property.notfound", property, base)); } }
public Class getType(FacesContext context) throws MethodNotFoundException { try { return m.getMethodInfo(context.getELContext()).getReturnType(); } catch (javax.el.MethodNotFoundException e) { throw new MethodNotFoundException(e.getMessage(), e.getCause()); } catch (ELException e) { throw new EvaluationException(e.getMessage(), e.getCause()); } }
public Class getType(FacesContext context) throws EvaluationException, PropertyNotFoundException { ELContext ctx = context.getELContext(); try { return this.delegate.getType(ctx); } catch (javax.el.PropertyNotFoundException e) { throw new PropertyNotFoundException(e.getMessage(), e.getCause()); } catch (ELException e) { throw new EvaluationException(e.getMessage(), e.getCause()); } }
public boolean isReadOnly(FacesContext context) throws EvaluationException, PropertyNotFoundException { ELContext ctx = context.getELContext(); try { return this.delegate.isReadOnly(ctx); } catch (javax.el.PropertyNotFoundException e) { throw new PropertyNotFoundException(e.getMessage(), e.getCause()); } catch (ELException e) { throw new EvaluationException(e.getMessage(), e.getCause()); } }
public Object getValue(ELContext context, Object base, Object property) throws NullPointerException, PropertyNotFoundException, ELException { if (context == null) { throw new NullPointerException(); } if (base == null || property == null) { return null; } context.setPropertyResolved(true); Method m = this.property(context, base, property).read(context); try { return m.invoke(base, (Object[]) null); } catch (IllegalAccessException e) { throw new ELException(e); } catch (InvocationTargetException e) { throw new ELException(message(context, "propertyReadError", new Object[] { base.getClass().getName(), property.toString() }), e.getCause()); } catch (Exception e) { throw new ELException(e); } }
boolean propertyResolvedSave = isPropertyResolved(); try { setPropertyResolved(false); ELResolver elResolver = getELResolver(); if (elResolver != null) { Object res = elResolver.convertToType(this, obj, targetType); if (isPropertyResolved()) { return res; throw ex; } catch (Exception ex) { throw new ELException(ex); } finally { setPropertyResolved(propertyResolvedSave);
@Override public Object getValue(FacesContext context) throws ELException { try { return expression.getValue(context.getELContext()); } catch (javax.el.PropertyNotFoundException e) { throw new PropertyNotFoundException(e); } catch (ELException e) { throw new ELException(e); } }
@Override public Object getValue(ELContext context, Object base, Object property) { Objects.requireNonNull(context); if (base == null || property == null) { return null; } context.setPropertyResolved(base, property); Method m = this.property(context, base, property).read(context); try { return m.invoke(base, (Object[]) null); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); Util.handleThrowable(cause); throw new ELException(Util.message(context, "propertyReadError", base.getClass().getName(), property.toString()), cause); } catch (Exception e) { throw new ELException(e); } }
throw new ELException("Expected Argument " + fParam + " missing in Lambda Expression"); elContext.enterLambdaScope(lambdaArgs); Object ret = expression.getValue(elContext); ((LambdaExpression) ret).envirArgs.putAll(lambdaArgs); elContext.exitLambdaScope(); return ret;
@Override public void setValue(FacesContext context, Object value) throws EvaluationException, PropertyNotFoundException { ELContext ctx = context.getELContext(); try { this.delegate.setValue(ctx, value); } catch (PropertyNotWritableException | javax.el.PropertyNotFoundException e) { throw new PropertyNotFoundException(e.getMessage(), e.getCause()); } catch (ELException e) { throw new EvaluationException(e.getMessage(), e.getCause()); } }
BeanProperty bp = getBeanProperty(context, base, property); Method method = bp.getReadMethod(); if (method == null) { throw new PropertyNotFoundException( ELUtil.getExceptionMessageString(context, "propertyNotReadable", try { value = method.invoke(base, new Object[0]); context.setPropertyResolved(base, property); } catch (ELException ex) { throw ex; } catch (InvocationTargetException ite) { throw new ELException(ite.getCause()); } catch (Exception ex) { throw new ELException(ex);
public ValueDescriptor getPropertyDescriptor(FacesContext context, ValueExpression expression) throws ELException { if(null == context || null == expression){ throw new NullPointerException(); } CapturingELContext capturingContext = new CapturingELContext(context.getELContext()); Class<?> type = expression.getType(capturingContext); ValueReference reference = capturingContext.getReference(); if(null != reference && null != reference.getBase() && null != reference.getProperty()){ // TODO - detect arrays, maps and lists. Check JSF implementation code - seems that Mojarra dosn't validate such fields. ValueDescriptor descriptor = new ValueDescriptor(reference.getBase().getClass(),reference.getProperty().toString(),type); return descriptor; } else { throw new ELException("Cannot determine property for expression "+expression.getExpressionString()); } }
@Override public void setValue(FacesContext context, Object value) throws ELException { try { expression.setValue(context.getELContext(), value); } catch (javax.el.PropertyNotFoundException e) { throw new PropertyNotFoundException(e); } catch (ELException e) { throw new ELException(e); } }