2 Replies Latest reply on Sep 1, 2005 9:21 AM by soshah

    Bug in TaskInstance

      I've been working with the webapp and ran into a TaskInstance bug. As I'm still pretty new to the process I'm not really sure where to put this. I assume someone will see it here. Anyway...

      If you come out of a start state task with multiple transitions, and select the leaving trasition by the buttons displayed, you'll get an error. The offending code is in TaskInstance starting at line 286 (or thereabouts).

      public void end(String transitionName) {
       if ( (task==null)
       || (task.getTaskNode()==null)
       || (task.getTaskNode()==null)
       || (!task.getTaskNode().hasLeavingTransition(transitionName))
       ) {
       throw new NullPointerException("task node does not have leaving transition '"+transitionName+"'");
       }
       end(task.getTaskNode().getLeavingTransition(transitionName));
       }
      


      The code above assumes a task node parent. If you're coming out of a start state, the task node will be null. It also checks if task node exists twice (might be a source control merge bug of some type?).

      It really should check the abstract node parent for leaving transitions. The following should work...

      public void end(String transitionName) {
       Node parentNode = (Node) task.getParent();
       if ( (task==null)
       || (parentNode == null)
       || (!parentNode.hasLeavingTransition(transitionName))
       ) {
       throw new NullPointerException("task node does not have leaving transition '"+transitionName+"'");
       }
       end(parentNode.getLeavingTransition(transitionName));
       }
      


      task.getParent() returns a GraphElement rather than a Node object. Can the parent be something other than a Node? If so this code will also bomb, but then again, GraphElement doesn't have leaving transitions, so I don't imagine it'll creep up. Should getParent return Node instead?

      Thanks.