[jboss-jira] [JBoss JIRA] Created: (JBPM-1059) Minor patch to avoid possible integer overflow in DayPart.add() in case of crazy Calendar values

Johan Parent (JIRA) jira-events at lists.jboss.org
Tue Sep 25 10:19:41 EDT 2007


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

                 Key: JBPM-1059
                 URL: http://jira.jboss.com/jira/browse/JBPM-1059
             Project: JBoss jBPM
          Issue Type: Patch
    Affects Versions: jBPM 3.1.4
            Reporter: Johan Parent
         Assigned To: Tom Baeyens
             Fix For: jBPM 3.1.4


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;


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list