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

Minor patch to avoid possible integer overflow in DayPart.add() in case of crazy Calendar values

XMLWordPrintable

      In

      public Date add(Date date, Duration duration) {
      Date end = null;

      Calendar calendar = BusinessCalendar.getCalendar();
      calendar.setTime(date);
      int hour = calendar.get(Calendar.HOUR_OF_DAY);
      int minute = calendar.get(Calendar.MINUTE);

      long dateMilliseconds = ((hour*60)+minute)*60*1000;
      long dayPartEndMilleseconds = ((toHour*60)+toMinute)*60*1000;

      change last two lines into:

      long dateMilliseconds = ((hour*60L)+minute)*60*1000;
      long dayPartEndMilleseconds = ((toHour*60L)+toMinute)*60*1000;

            aguizar_jira Alejandro Guizar (Inactive)
            Johan.Parent Johan Parent (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: