javax.el.PropertyNotFoundException Java Examples

The following examples show how to use javax.el.PropertyNotFoundException. 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: AstIdentifier.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Override
public Class<?> getType(EvaluationContext ctx) throws ELException {
    VariableMapper varMapper = ctx.getVariableMapper();
    if (varMapper != null) {
        ValueExpression expr = varMapper.resolveVariable(this.image);
        if (expr != null) {
            return expr.getType(ctx.getELContext());
        }
    }
    ctx.setPropertyResolved(false);
    Class<?> result = ctx.getELResolver().getType(ctx, null, this.image);
    if (!ctx.isPropertyResolved()) {
        throw new PropertyNotFoundException(MessageFactory.get(
                "error.resolver.unhandled.null", this.image));
    }
    return result;
}
 
Example #2
Source File: ImplicitObjectELResolver.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Override
public void setValue(ELContext context, Object base, Object property,
        Object value) throws NullPointerException,
        PropertyNotFoundException, PropertyNotWritableException,
        ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null && property != null) {
        int idx = Arrays.binarySearch(SCOPE_NAMES, property.toString());
        if (idx >= 0) {
            context.setPropertyResolved(true);
            throw new PropertyNotWritableException();
        }
    }
}
 
Example #3
Source File: AstValue.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@Override
public void setValue(EvaluationContext ctx, Object value)
        throws ELException {
    Target t = getTarget(ctx);
    ctx.setPropertyResolved(false);
    ELResolver resolver = ctx.getELResolver();

    // coerce to the expected type
    Class<?> targetClass = resolver.getType(ctx, t.base, t.property);
    resolver.setValue(ctx, t.base, t.property,
            ELSupport.coerceToType(ctx, value, targetClass));
    if (!ctx.isPropertyResolved()) {
        throw new PropertyNotFoundException(MessageFactory.get(
                "error.resolver.unhandled", t.base, t.property));
    }
}
 
Example #4
Source File: ScopedAttributeELResolver.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Override
public void setValue(ELContext context, Object base, Object property,
        Object value) throws NullPointerException,
        PropertyNotFoundException, PropertyNotWritableException,
        ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        if (property != null) {
            String key = property.toString();
            PageContext page = (PageContext) context
                    .getContext(JspContext.class);
            int scope = page.getAttributesScope(key);
            if (scope != 0) {
                page.setAttribute(key, value, scope);
            } else {
                page.setAttribute(key, value);
            }
        }
    }
}
 
Example #5
Source File: ELResolverImpl.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Override
public Object getValue(ELContext context, Object base, Object property)
        throws NullPointerException, PropertyNotFoundException, ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        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;
}
 
Example #6
Source File: ELResolverImpl.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Override
public void setValue(ELContext context, Object base, Object property,
        Object value) throws NullPointerException,
        PropertyNotFoundException, PropertyNotWritableException,
        ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        throw new PropertyNotWritableException(
                "Legacy VariableResolver wrapped, not writable");
    }

    if (!context.isPropertyResolved()) {
        elResolver.setValue(context, base, property, value);
    }
}
 
Example #7
Source File: AstIdentifier.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@Override
public Class<?> getType(EvaluationContext ctx) throws ELException {
    VariableMapper varMapper = ctx.getVariableMapper();
    if (varMapper != null) {
        ValueExpression expr = varMapper.resolveVariable(this.image);
        if (expr != null) {
            return expr.getType(ctx.getELContext());
        }
    }
    ctx.setPropertyResolved(false);
    Class<?> result = ctx.getELResolver().getType(ctx, null, this.image);
    if (!ctx.isPropertyResolved()) {
        throw new PropertyNotFoundException(MessageFactory.get(
                "error.resolver.unhandled.null", this.image));
    }
    return result;
}
 
Example #8
Source File: ScopedAttributeELResolver.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Override
public Object getValue(ELContext context, Object base, Object property)
        throws NullPointerException, PropertyNotFoundException, ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        if (property != null) {
            String key = property.toString();
            PageContext page = (PageContext) context
                    .getContext(JspContext.class);
            return page.findAttribute(key);
        }
    }

    return null;
}
 
Example #9
Source File: AstIdentifier.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@Override
public boolean isReadOnly(EvaluationContext ctx) throws ELException {
    VariableMapper varMapper = ctx.getVariableMapper();
    if (varMapper != null) {
        ValueExpression expr = varMapper.resolveVariable(this.image);
        if (expr != null) {
            return expr.isReadOnly(ctx.getELContext());
        }
    }
    ctx.setPropertyResolved(false);
    boolean result = ctx.getELResolver().isReadOnly(ctx, null, this.image);
    if (!ctx.isPropertyResolved()) {
        throw new PropertyNotFoundException(MessageFactory.get(
                "error.resolver.unhandled.null", this.image));
    }
    return result;
}
 
Example #10
Source File: JuelExpression.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
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 #11
Source File: AstIdentifier.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@Override
public void setValue(EvaluationContext ctx, Object value)
        throws ELException {
    VariableMapper varMapper = ctx.getVariableMapper();
    if (varMapper != null) {
        ValueExpression expr = varMapper.resolveVariable(this.image);
        if (expr != null) {
            expr.setValue(ctx.getELContext(), value);
            return;
        }
    }
    ctx.setPropertyResolved(false);
    ctx.getELResolver().setValue(ctx, null, this.image, value);
    if (!ctx.isPropertyResolved()) {
        throw new PropertyNotFoundException(MessageFactory.get(
                "error.resolver.unhandled.null", this.image));
    }
}
 
Example #12
Source File: ImplicitObjectELResolver.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Override
@SuppressWarnings({ "unchecked", "rawtypes" }) // TCK signature test fails with generics
public Class getType(ELContext context, Object base, Object property)
        throws NullPointerException, PropertyNotFoundException, ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null && property != null) {
        int idx = Arrays.binarySearch(SCOPE_NAMES, property.toString());
        if (idx >= 0) {
            context.setPropertyResolved(true);
        }
    }
    return null;
}
 
Example #13
Source File: ExpressionBeanAccessTest.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@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"));

  // After signaling, an expression tries to use a bean that is present in
  // the configuration but is not added to the beans-list
  try {
    runtimeService.trigger(runtimeService.createExecutionQuery().processInstanceId(pi.getId()).onlyChildExecutions().singleResult().getId());
    fail("Exception expected");
  } catch (ActivitiException ae) {
    assertNotNull(ae.getCause());
    assertTrue(ae.getCause() instanceof RuntimeException);
    RuntimeException runtimeException = (RuntimeException) ae.getCause();
    assertTrue(runtimeException.getCause() instanceof PropertyNotFoundException);
  }
}
 
Example #14
Source File: ImplicitObjectELResolver.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Override
public boolean isReadOnly(ELContext context, Object base, Object property)
        throws NullPointerException, PropertyNotFoundException, ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null && property != null) {
        int idx = Arrays.binarySearch(SCOPE_NAMES, property.toString());
        if (idx >= 0) {
            context.setPropertyResolved(true);
            return true;
        }
    }
    return false;
}
 
Example #15
Source File: AstIdentifier.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Override
public Object getValue(EvaluationContext ctx) throws ELException {
    VariableMapper varMapper = ctx.getVariableMapper();
    if (varMapper != null) {
        ValueExpression expr = varMapper.resolveVariable(this.image);
        if (expr != null) {
            return expr.getValue(ctx.getELContext());
        }
    }
    ctx.setPropertyResolved(false);
    Object result = ctx.getELResolver().getValue(ctx, null, this.image);
    if (!ctx.isPropertyResolved()) {
        throw new PropertyNotFoundException(MessageFactory.get(
                "error.resolver.unhandled.null", this.image));
    }
    return result;
}
 
Example #16
Source File: AstIdentifier.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Override
public boolean isReadOnly(EvaluationContext ctx) throws ELException {
    VariableMapper varMapper = ctx.getVariableMapper();
    if (varMapper != null) {
        ValueExpression expr = varMapper.resolveVariable(this.image);
        if (expr != null) {
            return expr.isReadOnly(ctx.getELContext());
        }
    }
    ctx.setPropertyResolved(false);
    boolean result = ctx.getELResolver().isReadOnly(ctx, null, this.image);
    if (!ctx.isPropertyResolved()) {
        throw new PropertyNotFoundException(MessageFactory.get(
                "error.resolver.unhandled.null", this.image));
    }
    return result;
}
 
Example #17
Source File: AstValue.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Override
public void setValue(EvaluationContext ctx, Object value)
        throws ELException {
    Target t = getTarget(ctx);
    ctx.setPropertyResolved(false);
    ELResolver resolver = ctx.getELResolver();

    // coerce to the expected type
    Class<?> targetClass = resolver.getType(ctx, t.base, t.property);
    if (COERCE_TO_ZERO == true
            || !isAssignable(value, targetClass)) {
        resolver.setValue(ctx, t.base, t.property,
                ELSupport.coerceToType(value, targetClass));
    } else {
        resolver.setValue(ctx, t.base, t.property, value);
    }
    if (!ctx.isPropertyResolved()) {
        throw new PropertyNotFoundException(MessageFactory.get(
                "error.resolver.unhandled", t.base, t.property));            
    }
}
 
Example #18
Source File: AstIdentifier.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Override
public Class<?> getType(EvaluationContext ctx) throws ELException {
    VariableMapper varMapper = ctx.getVariableMapper();
    if (varMapper != null) {
        ValueExpression expr = varMapper.resolveVariable(this.image);
        if (expr != null) {
            return expr.getType(ctx.getELContext());
        }
    }
    ctx.setPropertyResolved(false);
    Class<?> result = ctx.getELResolver().getType(ctx, null, this.image);
    if (!ctx.isPropertyResolved()) {
        throw new PropertyNotFoundException(MessageFactory.get(
                "error.resolver.unhandled.null", this.image));
    }
    return result;
}
 
Example #19
Source File: AstIdentifier.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Override
public Object getValue(EvaluationContext ctx) throws ELException {
    VariableMapper varMapper = ctx.getVariableMapper();
    if (varMapper != null) {
        ValueExpression expr = varMapper.resolveVariable(this.image);
        if (expr != null) {
            return expr.getValue(ctx.getELContext());
        }
    }
    ctx.setPropertyResolved(false);
    Object result = ctx.getELResolver().getValue(ctx, null, this.image);
    if (!ctx.isPropertyResolved()) {
        throw new PropertyNotFoundException(MessageFactory.get(
                "error.resolver.unhandled.null", this.image));
    }
    return result;
}
 
Example #20
Source File: AstIdentifier.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Override
public boolean isReadOnly(EvaluationContext ctx) throws ELException {
    VariableMapper varMapper = ctx.getVariableMapper();
    if (varMapper != null) {
        ValueExpression expr = varMapper.resolveVariable(this.image);
        if (expr != null) {
            return expr.isReadOnly(ctx.getELContext());
        }
    }
    ctx.setPropertyResolved(false);
    boolean result = ctx.getELResolver().isReadOnly(ctx, null, this.image);
    if (!ctx.isPropertyResolved()) {
        throw new PropertyNotFoundException(MessageFactory.get(
                "error.resolver.unhandled.null", this.image));
    }
    return result;
}
 
Example #21
Source File: AstIdentifier.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Override
public void setValue(EvaluationContext ctx, Object value)
        throws ELException {
    VariableMapper varMapper = ctx.getVariableMapper();
    if (varMapper != null) {
        ValueExpression expr = varMapper.resolveVariable(this.image);
        if (expr != null) {
            expr.setValue(ctx.getELContext(), value);
            return;
        }
    }
    ctx.setPropertyResolved(false);
    ctx.getELResolver().setValue(ctx, null, this.image, value);
    if (!ctx.isPropertyResolved()) {
        throw new PropertyNotFoundException(MessageFactory.get(
                "error.resolver.unhandled.null", this.image));
    }
}
 
Example #22
Source File: AstValue.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Override
public void setValue(EvaluationContext ctx, Object value)
        throws ELException {
    Target t = getTarget(ctx);
    ctx.setPropertyResolved(false);
    ELResolver resolver = ctx.getELResolver();

    // coerce to the expected type
    Class<?> targetClass = resolver.getType(ctx, t.base, t.property);
    if (COERCE_TO_ZERO == true
            || !isAssignable(value, targetClass)) {
        resolver.setValue(ctx, t.base, t.property,
                ELSupport.coerceToType(value, targetClass));
    } else {
        resolver.setValue(ctx, t.base, t.property, value);
    }
    if (!ctx.isPropertyResolved()) {
        throw new PropertyNotFoundException(MessageFactory.get(
                "error.resolver.unhandled", t.base, t.property));            
    }
}
 
Example #23
Source File: ELResolverImpl.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Override
public Object getValue(ELContext context, Object base, Object property)
        throws NullPointerException, PropertyNotFoundException, ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        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;
}
 
Example #24
Source File: ELResolverImpl.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Override
public Class<?> getType(ELContext context, Object base, Object property)
        throws NullPointerException, PropertyNotFoundException, ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        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;
}
 
Example #25
Source File: ELResolverImpl.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Override
public void setValue(ELContext context, Object base, Object property,
        Object value) throws NullPointerException,
        PropertyNotFoundException, PropertyNotWritableException,
        ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        throw new PropertyNotWritableException(
                "Legacy VariableResolver wrapped, not writable");
    }

    if (!context.isPropertyResolved()) {
        elResolver.setValue(context, base, property, value);
    }
}
 
Example #26
Source File: ImplicitObjectELResolver.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Override
public boolean isReadOnly(ELContext context, Object base, Object property)
        throws NullPointerException, PropertyNotFoundException, ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null && property != null) {
        int idx = Arrays.binarySearch(SCOPE_NAMES, property.toString());
        if (idx >= 0) {
            context.setPropertyResolved(true);
            return true;
        }
    }
    return false;
}
 
Example #27
Source File: ImplicitObjectELResolver.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Override
public void setValue(ELContext context, Object base, Object property,
        Object value) throws NullPointerException,
        PropertyNotFoundException, PropertyNotWritableException,
        ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null && property != null) {
        int idx = Arrays.binarySearch(SCOPE_NAMES, property.toString());
        if (idx >= 0) {
            context.setPropertyResolved(true);
            throw new PropertyNotWritableException();
        }
    }
}
 
Example #28
Source File: ScopedAttributeELResolver.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Override
public Object getValue(ELContext context, Object base, Object property)
        throws NullPointerException, PropertyNotFoundException, ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        if (property != null) {
            String key = property.toString();
            PageContext page = (PageContext) context
                    .getContext(JspContext.class);
            return page.findAttribute(key);
        }
    }

    return null;
}
 
Example #29
Source File: ImplicitObjectELResolver.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Override
@SuppressWarnings({ "unchecked", "rawtypes" }) // TCK signature test fails with generics
public Class getType(ELContext context, Object base, Object property)
        throws NullPointerException, PropertyNotFoundException, ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null && property != null) {
        int idx = Arrays.binarySearch(SCOPE_NAMES, property.toString());
        if (idx >= 0) {
            context.setPropertyResolved(true);
        }
    }
    return null;
}
 
Example #30
Source File: ScopedAttributeELResolver.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Override
public void setValue(ELContext context, Object base, Object property,
        Object value) throws NullPointerException,
        PropertyNotFoundException, PropertyNotWritableException,
        ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        if (property != null) {
            String key = property.toString();
            PageContext page = (PageContext) context
                    .getContext(JspContext.class);
            int scope = page.getAttributesScope(key);
            if (scope != 0) {
                page.setAttribute(key, value, scope);
            } else {
                page.setAttribute(key, value);
            }
        }
    }
}