Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-667

jBPM unable to pass null variables to bsh scripts

    XMLWordPrintable

Details

    Description

      While it is possible to now create null variables (i.e. "NullInstance" typed variables), it doesn't look like these make it through to the bsh scripts. Real code where I encountered this not provided to save the sanity of the innocent, but imagine you have an object of a class:

      public class Foo() {
      public void myMethod(Object myArg)

      { ... }

      }

      and you use a ContextInstance.setVariable to provide two variables to your workflow:

      ci.setVariable("foo", new Foo());
      ci.setVariable("arg", null);

      There is no <script> element that you can create that will process anything like this, you just get bsh.EvalErrors. I've tried the obvious:

      <script><expression>foo.myMethod(arg);</expression></script>

      I've tried doing explicit casts:

      <script><expression>foo.myMethod((java.lang.Object)arg);</expression></script>

      I've tried adding in read-mode variable declarations to the script, and assorted syntactic variations on all of the above. Doesn't matter if you are talking about method arguments, expressions in an if-test, whatever. I'd have hoped that null variables would make it through to bsh at least as a java.lang.Object-typed null reference, but I don't think that is happening.

      The only workaround I know of is to never have cause to use a null, like creating a pojo to contain variables, instead of individually setting variables through the context instance.

      Normally don't like to flag things as "critical", but having variables that may have null values seems a pretty desirable thing to have available for non-trivial use of jBPM.

      Attachments

        Activity

          People

            tom.baeyens Tom Baeyens (Inactive)
            reidmp_jira Reid Pinchback (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: