4 Replies Latest reply on Mar 4, 2009 7:20 AM by s p

    RuntimeException when ending subprocess

    Eduardo Jimenez Newbie

      Ok, this is a pet peeve. Imagine a scenario where process A calls process B. Process A provides "in" parameters for process B through "read" access variables, and "out" parameters through "write" access variables.

      Now imagine one of the "out" parameters is optional, say a failure code for instance (say documentation submitted with an application was imcomplete, the code indicates what part of the application was unacceptable). It might be set by process B or it might not be set.

      Well, when jBPM notifies process A that process B is done, it tries to copy the "out" variable value from process B to process A. If the variable was never set in process B, hence its value is NULL, jBPM throws a RuntimeException because the variable cannot be created in process A with a null value.

      Now, do you see any reason why an exception must be thrown when creating a variable with a null value? In my mind, it either be ignored, or the variable be created as expected.

      Or, if you don't think that's a good idea, then add a check, if a variable is not set, don't try to write it to the parent process, period. Let actions deal with whether the variable got transferred or not, through hasVariable().

      If this was fixed in 3.0.2, or somewhere in between, let me know. If this is not going to be fixed before 3.1, also let me know.