5 Replies Latest reply on Jul 25, 2014 12:38 PM by Maciej Swiderski

    Impossible to use BusinessCalendar and Date type deadlines together

    b r Newbie

      I'm not sure if this is intentional but when there is a BussinesCalendar (even default implementation) set in Environment it is not possible to use Date type deadlines. Problematic code in StateBasedNodeInstance.createTimerInstance (jbpm 6.0.1.Final):

       

      if (kruntime != null && kruntime.getEnvironment().get("jbpm.business.calendar") != null){
                  BusinessCalendar businessCalendar = (BusinessCalendar) kruntime.getEnvironment().get("jbpm.business.calendar");
                  
                  String delay = resolveVariable(timer.getDelay());
                  
                  timerInstance.setDelay(businessCalendar.calculateBusinessTimeAsDuration(delay));
                  
                  if (timer.getPeriod() == null) {
                      timerInstance.setPeriod(0);
                  } else {
                      String period = resolveVariable(timer.getPeriod());
                      timerInstance.setPeriod(businessCalendar.calculateBusinessTimeAsDuration(period));
                  }
              } else {
                  configureTimerInstance(timer, timerInstance);
              }
      

      Example deadline definition:

       

       <Deadline Execution="SYNCHR" Type="DATE">
            <DeadlineDuration>#{DATE}</DeadlineDuration>
            <ExceptionName>Wybudzenie1</ExceptionName>
      </Deadline>
      

       

      Date type deadline has both delay and period set to null so when one is passed here it ends with NullPointerException in method that resolves delay. Besides when calendar is set date is never being checked. Is usage of this type of deadlines not supported with calendars?