AnsweredAssumed Answered

CompositeELResolver order in

Question asked by arandall on Apr 28, 2014
I have been working on trying to get Activiti running in Karaf and have stumbled across an error due to a difference in the order of the ELResolvers.

The error I get when trying to resolve a property in a HashMap running via Blueprint/OSGI is

2014-04-24 10:35:17,772 | WARN  | process/routing] | AggregateProcessor               | rg.apache.camel.util.CamelLogger  224 | 73 - org.apache.camel.camel-core - 2.12.3 | Error processing aggregated exchange. Exchange[JmsMessage[JmsMessageID: ID:localhost-45668-1398139515923-90:18:1:1:4]]. Caused by: [org.activiti.engine.ActivitiException - Unknown property used in expression: ${!empty(params.value)}]
org.activiti.engine.ActivitiException: Unknown property used in expression: ${!empty(params.value)}

Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Could not find property value in class java.util.HashMap
        at org.activiti.engine.impl.javax.el.BeanELResolver.toBeanProperty([163:org.activiti.engine:5.15.0]
        at org.activiti.engine.impl.javax.el.BeanELResolver.getValue([163:org.activiti.engine:5.15.0]

It is clear that the BeanELResolver will always throw this exception when the class is not a bean and as a result should probably be at the bottom of the list or modified to not throw this exception.

      compositeElResolver.add(new VariableScopeElResolver(variableScope));
      if (blueprintContextELResolver != null) {
      compositeElResolver.add(new BeanELResolver());
      compositeElResolver.add(new ArrayELResolver());
      compositeElResolver.add(new ListELResolver());
      compositeElResolver.add(new MapELResolver());

    CompositeELResolver compositeResolver = new CompositeELResolver();
    compositeResolver.add(new ArrayELResolver());
    compositeResolver.add(new ListELResolver());
    compositeResolver.add(new MapELResolver());
    compositeResolver.add(new ResourceBundleELResolver());
    compositeResolver.add(new DynamicBeanPropertyELResolver(ItemInstance.class, "getFieldValue", "setFieldValue"));
    compositeResolver.add(new BeanELResolver());

To fix this issue I have changed the order in the class.

Is there a better way to fix this issue?