Program: 62877
Project: 62877
Buggy source:
private static void repeatNotification(Context context,NotificationDetails notificationDetails,Boolean updateScheduledNotificationsCache){
  Notification notification=createNotification(context,notificationDetails);
  Intent notificationIntent=new Intent(context,ScheduledNotificationReceiver.class);
  notificationIntent.putExtra(NOTIFICATION_ID,notificationDetails.id);
  notificationIntent.putExtra(NOTIFICATION,notification);
  notificationIntent.putExtra(REPEAT,true);
  PendingIntent pendingIntent=PendingIntent.getBroadcast(context,notificationDetails.id,notificationIntent,PendingIntent.FLAG_CANCEL_CURRENT);
  AlarmManager alarmManager=getAlarmManager(context);
  long repeatInterval=0;
switch (notificationDetails.repeatInterval) {
case EveryMinute:
    repeatInterval=60000;
  break;
case Hourly:
repeatInterval=60000 * 60;
break;
case Daily:
repeatInterval=60000 * 60 * 24;
break;
case Weekly:
repeatInterval=60000 * 60 * 24* 7;
break;
default :
break;
}
long startTimeMilliseconds=notificationDetails.calledAt;
if (notificationDetails.repeatTime != null) {
Calendar calendar=Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.set(Calendar.HOUR_OF_DAY,notificationDetails.repeatTime.hour);
calendar.set(Calendar.MINUTE,notificationDetails.repeatTime.minute);
calendar.set(Calendar.SECOND,notificationDetails.repeatTime.second);
if (notificationDetails.day != null) {
calendar.set(Calendar.DAY_OF_WEEK,notificationDetails.day);
}
startTimeMilliseconds=calendar.getTimeInMillis();
}
long currentTime=System.currentTimeMillis();
while (startTimeMilliseconds < currentTime) {
startTimeMilliseconds+=repeatInterval;
}
alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP,startTimeMilliseconds,repeatInterval,pendingIntent);
if (updateScheduledNotificationsCache) {
ArrayList<NotificationDetails> scheduledNotifications=loadScheduledNotifications(context);
scheduledNotifications.add(notificationDetails);
saveScheduledNotifications(context,scheduledNotifications);
}
}

Fixed version (ground truth):
private static void repeatNotification(Context context,NotificationDetails notificationDetails,Boolean updateScheduledNotificationsCache){
  setIconResourceId(context,notificationDetails);
  Gson gson=buildGson();
  String notificationDetailsJson=gson.toJson(notificationDetails);
  Intent notificationIntent=new Intent(context,ScheduledNotificationReceiver.class);
  notificationIntent.putExtra(NOTIFICATION_DETAILS,notificationDetailsJson);
  notificationIntent.putExtra(REPEAT,true);
  PendingIntent pendingIntent=PendingIntent.getBroadcast(context,notificationDetails.id,notificationIntent,PendingIntent.FLAG_CANCEL_CURRENT);
  AlarmManager alarmManager=getAlarmManager(context);
  long repeatInterval=0;
switch (notificationDetails.repeatInterval) {
case EveryMinute:
    repeatInterval=60000;
  break;
case Hourly:
repeatInterval=60000 * 60;
break;
case Daily:
repeatInterval=60000 * 60 * 24;
break;
case Weekly:
repeatInterval=60000 * 60 * 24* 7;
break;
default :
break;
}
long startTimeMilliseconds=notificationDetails.calledAt;
if (notificationDetails.repeatTime != null) {
Calendar calendar=Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.set(Calendar.HOUR_OF_DAY,notificationDetails.repeatTime.hour);
calendar.set(Calendar.MINUTE,notificationDetails.repeatTime.minute);
calendar.set(Calendar.SECOND,notificationDetails.repeatTime.second);
if (notificationDetails.day != null) {
calendar.set(Calendar.DAY_OF_WEEK,notificationDetails.day);
}
startTimeMilliseconds=calendar.getTimeInMillis();
}
long currentTime=System.currentTimeMillis();
while (startTimeMilliseconds < currentTime) {
startTimeMilliseconds+=repeatInterval;
}
alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP,startTimeMilliseconds,repeatInterval,pendingIntent);
if (updateScheduledNotificationsCache) {
ArrayList<NotificationDetails> scheduledNotifications=loadScheduledNotifications(context);
scheduledNotifications.add(notificationDetails);
saveScheduledNotifications(context,scheduledNotifications);
}
}