0 Replies Latest reply on May 11, 2009 1:42 AM by galanfish

    JBPM4 defining exception handler to redirect the sequence fl

    galanfish

      hi, everybody
      i've defined an exceptionHandler which was supposed to affect the propagation of the execution, once the matched exception occur,
      the exceptionHandler will redirect the normal sequence flow by choosing another non-default transition.
      the definition is like this: ExceptionHahndlerImpl#createEventListenerReference, #setTransitionName, ActivityImpl#addExceptionHandler, etc.
      but the execution didn't go right, the atomicOperations did have been added, but the execution keep propagating with the default transition, the execution didn't return to execute another ActomicOperation but call proceed()
      then i modified the code in ExceptionHandlerImpl as follow, it seems work:

      ExceptionHandlerImpl#executeHandler(ExecutionImpl execution, Exception exception)

      if (activity!=null) {
       TransitionImpl transition = activity.findOutgoingTransition(transitionName);
       if (transition!=null) {
       log.trace(toString()+" takes transition "+transitionName);
       execution.setTransition(transition);
      
       // modification begins
       execution.propagation = Propagation.EXPLICIT;
       execution.setTransitionOrigin(activity);
       // modification ends
      
       execution.performAtomicOperationSync(ExecutionImpl.TAKE_TRANSITION);
       } else {
       log.info("WARNING: "+toString()+" couldn't find transition "+transitionName+" on "+activity);
       }
       } else {
       log.info("WARNING: "+toString()+" couldn't find current activity to take transition "+transitionName);
       }


      is that a bug or that there are something wrong with my testcase, help please, appreciate!