@Override public void setValue(ELContext elContext, @Nullable Object base, Object property, Object value) throws ELException { if (base == null) { String beanName = property.toString(); WebApplicationContext wac = getWebApplicationContext(elContext); if (wac.containsBean(beanName)) { if (value == wac.getBean(beanName)) { // Setting the bean reference to the same value is alright - can simply be ignored... elContext.setPropertyResolved(true); } else { throw new PropertyNotWritableException( "Variable '" + beanName + "' refers to a Spring bean which by definition is not writable"); } } } }
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;
/** * Converts an object to a specific type. * * <p>An <code>ELException</code> is thrown if an error occurs during * the conversion.</p> * * @param context The context of this evaluation. * @param obj The object to convert. * @param targetType The target type for the convertion. * @throws ELException thrown if errors occur. * * @since EL 3.0 */ @Override public Object convertToType(ELContext context, Object obj, Class<?> targetType) { context.setPropertyResolved(false); Object value = null; for (int i = 0; i < size; i++) { value = elResolvers[i].convertToType(context, obj, targetType); if (context.isPropertyResolved()) { return value; } } return null; }
context.setPropertyResolved(true); int index = toInteger (property); if (index < 0 || index >= Array.getLength(base)) { throw new PropertyNotFoundException();
@Override public Object eval(Bindings bindings, ELContext context) { ValueExpression expression = bindings.getVariable(index); if (expression != null) { return expression.getValue(context); } context.setPropertyResolved(false); Object result = context.getELResolver().getValue(context, null, name); if (!context.isPropertyResolved()) { throw new PropertyNotFoundException(LocalMessages.get("error.identifier.property.notfound", name)); } return result; }
context.setPropertyResolved(base, property); if (isReadOnly) { throw new PropertyNotWritableException(); throw new PropertyNotFoundException();
public void setValue(ELContext ctx, Object base, Object property, Object value) throws PropertyNotFoundException, PropertyNotWritableException, ELException { if (ctx == null) throw new IllegalArgumentException(); if (base == null) { ctx.setPropertyResolved(true); throw new PropertyNotWritableException(); } if (!ctx.isPropertyResolved()) DEFAULT.setValue(ctx, base, property, value); }
throw new PropertyNotWritableException( ELUtil.getExceptionMessageString(context, "resolverNotwritable", Method method = bp.getWriteMethod(); if (method == null) { throw new PropertyNotWritableException( ELUtil.getExceptionMessageString(context, "propertyNotWritable", context.setPropertyResolved(base, property); } catch (ELException ex) { throw ex; } catch (InvocationTargetException ite) { throw new ELException(ite.getCause()); } catch (Exception ex) { if (null == val) { new Object[] { property.toString(), base.getClass().getName(), val }); throw new ELException(message, ex);
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);
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);
/** * If the base object is a ResourceBundle, throw a * {@link PropertyNotWritableException}. * * @param context * The context of this evaluation. * @param base * The ResourceBundle to be modified. Only bases that are of type * ResourceBundle are handled. * @param property * The String property to use. * @param value * The value to be set. * @throws NullPointerException * if context is <code>null</code>. * @throws PropertyNotWritableException * Always thrown if base is an instance of ReasourceBundle. */ public void setValue(ELContext context, Object base, Object property, Object value) { if (context == null) { throw new NullPointerException(); } if (base instanceof ResourceBundle) { context.setPropertyResolved(true); throw new PropertyNotWritableException( "ResourceBundles are immutable"); } }
Object val) { context.setPropertyResolved(false); if (context.isPropertyResolved()) { return;
logger.debug("Successfully resolved property '" + beanName + "' in root WebApplicationContext"); elContext.setPropertyResolved(true); try { return wac.getBean(beanName); throw new ELException(ex); elContext.setPropertyResolved(true); return getWebApplicationContext(elContext);
context.setPropertyResolved(true); List list = (List) base; int index = toInteger(property); if (index < 0 || index >= list.size()) { throw new PropertyNotFoundException();
public Class<?> getType(Bindings bindings, ELContext context) { ValueExpression expression = bindings.getVariable(index); if (expression != null) { return expression.getType(context); } context.setPropertyResolved(false); Class<?> result = context.getELResolver().getType(context, null, name); if (!context.isPropertyResolved()) { throw new PropertyNotFoundException(LocalMessages.get("error.identifier.property.notfound", name)); } return result; }
context.setPropertyResolved(base, property); int index = toInteger(property); if (isReadOnly) { throw new PropertyNotWritableException(); throw new PropertyNotWritableException(); } catch (IndexOutOfBoundsException ex) { throw new PropertyNotFoundException(); } catch (ClassCastException ex) { throw ex;
@Override public void setValue(ELContext context, Object base, Object property, Object value) { Objects.requireNonNull(context); if (base == null) { context.setPropertyResolved(base, property); throw new PropertyNotWritableException( "Legacy VariableResolver wrapped, not writable"); } if (!context.isPropertyResolved()) { elResolver.setValue(context, base, property, value); } }
throw new PropertyNotWritableException( ELUtil.getExceptionMessageString(context, "resolverNotwritable", Method method = bp.getWriteMethod(); if (method == null) { throw new PropertyNotWritableException( ELUtil.getExceptionMessageString(context, "propertyNotWritable", context.setPropertyResolved(true); } catch (ELException ex) { throw ex; } catch (InvocationTargetException ite) { throw new ELException(ite.getCause()); } catch (Exception ex) { if (null == val) { new Object[] { property.toString(), base.getClass().getName(), val }); throw new ELException(message, ex);
Method method = bp.getReadMethod(); if (method == null) { throw new PropertyNotFoundException( ELUtil.getExceptionMessageString(context, "propertyNotReadable", try { value = method.invoke(base, new Object[0]); context.setPropertyResolved(true); } catch (ELException ex) { throw ex; } catch (InvocationTargetException ite) { throw new ELException(ite.getCause()); } catch (Exception ex) { throw new ELException(ex);
@Override public void setValue(ELContext elContext, @Nullable Object base, Object property, Object value) throws ELException { if (base == null) { String beanName = property.toString(); WebApplicationContext wac = getWebApplicationContext(elContext); if (wac.containsBean(beanName)) { if (value == wac.getBean(beanName)) { // Setting the bean reference to the same value is alright - can simply be ignored... elContext.setPropertyResolved(true); } else { throw new PropertyNotWritableException( "Variable '" + beanName + "' refers to a Spring bean which by definition is not writable"); } } } }