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

Leaving node in super-state throws org.jbpm.JbpmException: cannot leave Node without leaving transition

    XMLWordPrintable

Details

    Description

      Leaving <node> in <super-state> throws

      org.jbpm.JbpmException: cannot leave Node(node2) without leaving transition

      when I execute process definition like:

      ================
      <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="id41">
      <start-state name="start">
      <transition to="super-state1"></transition>
      </start-state>
      <super-state name="super-state1">
      <transition to="end"></transition>
      <node name="node1">
      <transition to="node2"></transition>
      </node>
      <node name="node2">
      </node>
      </super-state>
      <end-state name="end">
      </end-state>
      </process-definition>
      =================

      Note: <node name="node2"> doesn't have its own transition. but I expect super-state's transition is available then.

      The process definition works if you test via ProcessDefinition.parseXmlResource(String xmlResource) without DB/Hibernate (like org.jbpm.graph.exe.SuperStateActionExecutionTest.testNestedSuperStateLeaveViaSuperStateTransition()).

      What's the difference?

      org.jbpm.graph.def.Node:
      =========
      public Transition getDefaultLeavingTransition() {
      Transition defaultTransition = null;
      if (leavingTransitions != null) {
      // Select the first unconditional transition
      for (Iterator i = leavingTransitions.iterator(); i.hasNext() {
      Transition auxTransition = (Transition) i.next();
      if (auxTransition.getCondition() == null)

      { defaultTransition = auxTransition; break; }

      }
      }
      else if (superState != null)

      { defaultTransition = superState.getDefaultLeavingTransition(); }

      return defaultTransition;
      }
      =========

      The logic of getDefaultLeavingTransition() depends on whether leavingTransitions is null or not. But in case that hibernate kicks lazy initialization, leavingTransitions will be a zero sized collection, not null.

      BTW, I think the concept that super-state's transition can be chosen from nodes inside is better to be documented.

      Attachments

        Issue Links

          Activity

            People

              aguizar_jira Alejandro Guizar (Inactive)
              rhn-support-tkobayas Toshiya Kobayashi
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: