7 Replies Latest reply on Sep 28, 2007 10:06 AM by Olivier Thierry

    Complex EL Expressions in JPDL decisions aren't being evalua

    David Heggie Newbie

      Since upgrading to 2.0.0 CR1 (from BETA1) some of the el expressions in my jpdl decisions are causing exceptions. Example:

      org.jbpm.JbpmException: couldn't evaluate expression '#{simpleStateMachine.addressValid and empty simpleStateMachine.addressList}'
       org.jbpm.jpdl.el.impl.JbpmExpressionEvaluator.evaluate(JbpmExpressionEvaluator.java:43)
       org.jbpm.jpdl.el.impl.JbpmExpressionEvaluator.evaluate(JbpmExpressionEvaluator.java:30)
       org.jbpm.graph.node.Decision.execute(Decision.java:95)
       org.jbpm.graph.def.Node.enter(Node.java:318)
       org.jbpm.graph.def.Transition.take(Transition.java:151)
       org.jbpm.graph.def.Node.leave(Node.java:393)
       org.jbpm.graph.exe.Token.signal(Token.java:194)
       org.jbpm.graph.exe.Token.signal(Token.java:157)
       org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:282)
       org.jboss.seam.pageflow.Pageflow.signal(Pageflow.java:477)
       org.jboss.seam.pageflow.Pageflow.navigate(Pageflow.java:336)
       org.jboss.seam.jsf.SeamNavigationHandler.handleNavigation(SeamNavigationHandler.java:40)
       org.test.navigation.BackNavigationHandler.handleNavigation(BackNavigationHandler.java:30)
       com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:119)
       javax.faces.component.UICommand.broadcast(UICommand.java:383)
       org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:186)
       org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:164)
       org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:352)
       com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
       com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
       com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
       javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
       org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:307)
       org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:100)
       org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
       org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
       org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
       org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
       org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
       org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
       org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
       org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
       org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:150)
       org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
      
      root cause
      
      javax.el.ELException: Not a Valid Method Expression: ${simpleStateMachine.addressValid and empty simpleStateMachine.addressList}
       org.jboss.el.lang.ExpressionBuilder.createMethodExpression(ExpressionBuilder.java:210)
       org.jboss.el.ExpressionFactoryImpl.createMethodExpression(ExpressionFactoryImpl.java:57)
       org.jboss.seam.bpm.SeamExpressionEvaluator$1.initMethodExpression(SeamExpressionEvaluator.java:54)
       org.jboss.seam.bpm.SeamExpressionEvaluator$1.evaluate(SeamExpressionEvaluator.java:69)
       org.jboss.seam.bpm.SeamExpressionEvaluator.evaluate(SeamExpressionEvaluator.java:35)
       org.jbpm.jpdl.el.impl.JbpmExpressionEvaluator.evaluate(JbpmExpressionEvaluator.java:39)
       org.jbpm.jpdl.el.impl.JbpmExpressionEvaluator.evaluate(JbpmExpressionEvaluator.java:30)
       org.jbpm.graph.node.Decision.execute(Decision.java:95)
       org.jbpm.graph.def.Node.enter(Node.java:318)
       org.jbpm.graph.def.Transition.take(Transition.java:151)
       org.jbpm.graph.def.Node.leave(Node.java:393)
       org.jbpm.graph.exe.Token.signal(Token.java:194)
       org.jbpm.graph.exe.Token.signal(Token.java:157)
       org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:282)
       org.jboss.seam.pageflow.Pageflow.signal(Pageflow.java:477)
       org.jboss.seam.pageflow.Pageflow.navigate(Pageflow.java:336)
       org.jboss.seam.jsf.SeamNavigationHandler.handleNavigation(SeamNavigationHandler.java:40)
       org.test.navigation.BackNavigationHandler.handleNavigation(BackNavigationHandler.java:30)
       com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:119)
       javax.faces.component.UICommand.broadcast(UICommand.java:383)
       org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:186)
       org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:164)
       org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:352)
       com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
       com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
       com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
       javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
       org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:307)
       org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:100)
       org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
       org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
       org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
       org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
       org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
       org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
       org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
       org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
       org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:150)
       org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
      


      Looking into this further I noticed that the culprit is this method in the org.jboss.seam.bpm.SeamExpressionResolver

      public Object evaluate(VariableResolver resolver) throws ELException
       {
       try
       {
       try
       {
       if (me==null && ve==null) initMethodExpression();
       if (me!=null && ve==null) return me.invoke( createELContext(resolver, mapper), new Object[0] );
       }
       catch (javax.el.MethodNotFoundException mnfe)
       {
       if (ve==null) initValueExpression();
       if (ve!=null) return ve.getValue( createELContext(resolver, mapper) );
       }
       throw new ELException();
       }
       catch (javax.el.ELException vele)
       {
       throw new ELException(vele);
       }
       }
      


      The initMethodExpression() method call tries to create a method expression and fails, throwing a ELException which causes us to miss trying to create a value expression. What I think should be changed is rather than catching the javax.el.MethodNotFoundException we should just catch a javax.el.ELException so we have 2 goes at evaluating the expression.

      What do people think?