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

BusinessCalendar produces infinite loop in method findNextDayPart, method isInBusinessHours is wrongly implemented

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • jBPM 3.1.0
    • jBPM 3.0.1, jBPM 3.0.2
    • Runtime Engine
    • None

      The method findNextDayPart produces an infinite loop if the date in the argument has its hours and minutes outisde of business hours. This can be fixed by the following change:
      public DayPart findNextDayPart(Date date) {
      DayPart nextDayPart = null;
      while(nextDayPart==null) {
      nextDayPart = findDayPart(date);
      if (nextDayPart==null)

      { date = findStartOfNextDay(date); Object result[] = new Object[2]; Day day = findDay(date); day.findNextDayPartStart(0, date, result); nextDayPart = (DayPart) result[1]; }

      }
      return nextDayPart;
      }

      Furthermore the method isInBusinessHours is wrongly implemented; the use of findNextDayPart would always lead to a result of true (if findNextDayPart would work). This failure can be fixed as follows:

      public boolean isInBusinessHours(Date date)

      { return (findDayPart(date)!=null); }

            tom.baeyens Tom Baeyens (Inactive)
            ludwig.balke Ludwig Balke (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: