Constantine Kulak [http://community.jboss.org/people/ity75303] created the 
discussion

"How to check in jBPM 4.3 that java activity returned null?"

To view the discussion, visit: http://community.jboss.org/message/554156#554156

--------------------------------------------------------------
Hello,

is there any way to store null value in a variable and then check it for being 
empty? I'm trying to do it like this:

    <java
        method="someMethod" name="Java" var="variable">
        <transition to="Decision" />
    </java>

    <decision name="Decision">
        <transition to="Variable is empty">
                    <condition expr="#{empty variable}" />
                </transition>
        <transition to="Default" />
    </decision>

here xxx.Test.someMethod returns null, and +decision+ throws an exception:

org.jbpm.api.JbpmException: script evaluation error: 
javax.el.PropertyNotFoundException: Cannot find property variable
    org.jbpm.pvm.internal.script.ScriptManager.evaluate(ScriptManager.java:130)
    org.jbpm.pvm.internal.script.ScriptManager.evaluate(ScriptManager.java:118)
    
org.jbpm.pvm.internal.script.ScriptManager.evaluateExpression(ScriptManager.java:90)
    
org.jbpm.pvm.internal.model.ExpressionCondition.evaluate(ExpressionCondition.java:41)
    
org.jbpm.jpdl.internal.activity.DecisionConditionActivity.findTransitionUsingConditions(DecisionConditionActivity.java:61)
    
org.jbpm.jpdl.internal.activity.DecisionConditionActivity.execute(DecisionConditionActivity.java:46)
    
org.jbpm.jpdl.internal.activity.DecisionConditionActivity.execute(DecisionConditionActivity.java:42)
    
org.jbpm.pvm.internal.model.op.ExecuteActivity.perform(ExecuteActivity.java:60)
    
org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:656)
    
org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:616)
    org.jbpm.pvm.internal.model.ExecutionImpl.start(ExecutionImpl.java:217)
    
org.jbpm.pvm.internal.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:61)
    
org.jbpm.pvm.internal.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:37)
    
org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
    
org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:54)
    
org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
    
org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
    org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
    org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:43)
    
org.jbpm.pvm.internal.svc.ExecutionServiceImpl.startProcessInstanceById(ExecutionServiceImpl.java:58)
    
org.jbpm.integration.console.ProcessManagementImpl.newInstance(ProcessManagementImpl.java:151)
    
org.jboss.bpm.console.server.FormProcessingFacade.startProcessWithUI(FormProcessingFacade.java:202)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    
org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:117)
    
org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:260)
    org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:232)
    org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:166)
    
org.jboss.resteasy.core.DispatcherUtilities.getJaxrsResponse(DispatcherUtilities.java:142)
    
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356)
    
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:173)
    
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:93)
    
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:68)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    
org.jboss.bpm.console.server.util.GWTJsonFilter.doFilter(GWTJsonFilter.java:59)

So I guess it doesn't create a variable if null is returned. To overcome this 
I'm returning List instead of a single object and check whether it is empty or 
not, but it looks ugly. Is there any better way to check for null values 
returned by +java+ activity?

Thanks in advance for your suggestions.

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/554156#554156]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to