nus-yam/ex-repair huggingface dataset:
Program: 186164
Project: 186164
Buggy source:
@Override public void run(){
  try {
    startCassandraAsDaemon();
    startupLatch.countDown();
  }
 catch (  InterruptedException e) {
    throw new IllegalStateException(e);
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    startCassandraProcess();
    startupLatch.countDown();
  }
 catch (  InterruptedException e) {
    throw new IllegalStateException(e);
  }
}
Program: 186165
Project: 186165
Buggy source:
private List<String> startCassandraAsDaemon() throws InterruptedException {
  try {
    pwd=startProcess();
    pwd.waitFor();
    if (pwd.exitValue() != 0) {
      List<String> consoleOutput=getConsoleOutput(pwd);
      throw new IllegalStateException("String_Node_Str" + cassandraPath + "String_Node_Str"+ port+ "String_Node_Str"+ consoleOutput);
    }
    return null;
  }
 catch (  IOException e) {
    throw new IllegalStateException("String_Node_Str" + cassandraPath + "String_Node_Str"+ port+ "String_Node_Str");
  }
}

Fixed version (ground truth):
private void startCassandraAsDaemon() throws AssertionError {
  final CountDownLatch startupLatch=new CountDownLatch(1);
  new Thread(new Runnable(){
    @Override public void run(){
      try {
        startCassandraProcess();
        startupLatch.countDown();
      }
 catch (      InterruptedException e) {
        throw new IllegalStateException(e);
      }
    }
  }
).start();
  try {
    startupLatch.await(10,SECONDS);
  }
 catch (  InterruptedException e) {
    throw new AssertionError(e);
  }
}
Program: 186166
Project: 186166
Buggy source:
@Override protected void doStart() throws Throwable {
  final CountDownLatch startupLatch=new CountDownLatch(1);
  new Thread(new Runnable(){
    @Override public void run(){
      try {
        startCassandraAsDaemon();
        startupLatch.countDown();
      }
 catch (      InterruptedException e) {
        throw new IllegalStateException(e);
      }
    }
  }
).start();
  try {
    startupLatch.await(10,SECONDS);
  }
 catch (  InterruptedException e) {
    throw new AssertionError(e);
  }
}

Fixed version (ground truth):
@Override protected void doStart() throws Throwable {
  File targetPathDirectory=ensureTargetPathDoesNotExitsAndReturnCompositePath();
  if (targetPathDirectory.mkdirs()) {
    startCassandraAsDaemon();
  }
 else {
    throw new IllegalStateException("String_Node_Str" + targetPathDirectory + "String_Node_Str");
  }
}
Program: 186167
Project: 186167
Buggy source:
private static void checkColumnValue(RowModel expectedRowModel,HColumn<byte[],byte[]> hColumn) throws Error {
  byte[] expectedColumnName=hColumn.getName();
  byte[] expectedColumnValue=hColumn.getValue();
  if (!areLoadValuesOnExpectedList(expectedRowModel.getColumns(),expectedColumnName,expectedColumnValue)) {
    throw FailureHandler.createFailure("String_Node_Str",expectedRowModel.getKey().getValue(),new String(expectedColumnName),new String(expectedColumnValue));
  }
}

Fixed version (ground truth):
private static void checkColumnValue(RowModel expectedRowModel,HColumn<byte[],byte[]> hColumn) throws Error {
  byte[] expectedColumnName=hColumn.getName();
  byte[] expectedColumnValue=hColumn.getValue();
  if (!areLoadValuesOnExpectedList(expectedRowModel.getColumns(),expectedColumnName,expectedColumnValue)) {
    throw FailureHandler.createFailure("String_Node_Str",asString(expectedRowModel.getKey()),new String(expectedColumnName),new String(expectedColumnValue));
  }
}
Program: 186168
Project: 186168
Buggy source:
private static int countNumberOfColumnsByKey(Keyspace keyspace,String expectedColumnFamilyName,RowModel expectedRowModel){
  QueryResult<Integer> qr=HFactory.createCountQuery(keyspace,StringSerializer.get(),StringSerializer.get()).setColumnFamily(expectedColumnFamilyName).setKey(expectedRowModel.getKey().getValue()).setRange(null,null,1000000000).execute();
  int numberOfColumns=qr.get();
  return numberOfColumns;
}

Fixed version (ground truth):
private static int countNumberOfColumnsByKey(Keyspace keyspace,String expectedColumnFamilyName,RowModel expectedRowModel){
  QueryResult<Integer> qr=HFactory.createCountQuery(keyspace,GenericTypeSerializer.get(),StringSerializer.get()).setColumnFamily(expectedColumnFamilyName).setKey(expectedRowModel.getKey()).setRange(null,null,1000000000).execute();
  int numberOfColumns=qr.get();
  return numberOfColumns;
}
Program: 186169
Project: 186169
Buggy source:
private static void checkNumberOfSuperColumns(Keyspace keyspace,String expectedColumnFamilyName,RowModel expectedRowModel,int size) throws Error {
  int countNumberOfSuperColumnsByKey=countNumberOfColumnsByKey(keyspace,expectedColumnFamilyName,expectedRowModel);
  if (countNumberOfSuperColumnsByKey != size) {
    throw FailureHandler.createFailure("String_Node_Str",expectedRowModel.getKey().getValue(),size,countNumberOfSuperColumnsByKey);
  }
}

Fixed version (ground truth):
private static void checkNumberOfSuperColumns(Keyspace keyspace,String expectedColumnFamilyName,RowModel expectedRowModel,int size) throws Error {
  int countNumberOfSuperColumnsByKey=countNumberOfColumnsByKey(keyspace,expectedColumnFamilyName,expectedRowModel);
  if (countNumberOfSuperColumnsByKey != size) {
    throw FailureHandler.createFailure("String_Node_Str",asString(expectedRowModel.getKey()),size,countNumberOfSuperColumnsByKey);
  }
}
Program: 186170
Project: 186170
Buggy source:
private static void checkColumnsOfSuperColumn(RowModel expectedRowModel,SuperColumnModel expectedSuperColumnModel,List<ColumnModel> expectedColumns,List<HColumn<byte[],byte[]>> columns) throws Error {
  for (  HColumn<byte[],byte[]> hColumn : columns) {
    if (!areLoadValuesOnExpectedList(expectedColumns,hColumn.getName(),hColumn.getValue())) {
      throw FailureHandler.createFailure("String_Node_Str",expectedRowModel.getKey().getValue(),expectedSuperColumnModel.getName().getValue());
    }
  }
}

Fixed version (ground truth):
private static void checkColumnsOfSuperColumn(RowModel expectedRowModel,SuperColumnModel expectedSuperColumnModel,List<ColumnModel> expectedColumns,List<HColumn<byte[],byte[]>> columns) throws Error {
  for (  HColumn<byte[],byte[]> hColumn : columns) {
    if (!areLoadValuesOnExpectedList(expectedColumns,hColumn.getName(),hColumn.getValue())) {
      throw FailureHandler.createFailure("String_Node_Str",asString(expectedRowModel.getKey()),expectedSuperColumnModel.getName().getValue());
    }
  }
}
Program: 186171
Project: 186171
Buggy source:
private static void checkNumberOfColumns(Keyspace keyspace,String expectedColumnFamilyName,RowModel expectedRowModel) throws Error {
  int numberOfColumns=countNumberOfColumnsByKey(keyspace,expectedColumnFamilyName,expectedRowModel);
  int expectedNumberOfColumns=expectedRowModel.getColumns().size();
  if (numberOfColumns != expectedNumberOfColumns) {
    throw FailureHandler.createFailure("String_Node_Str",expectedRowModel.getKey().getValue(),expectedNumberOfColumns,numberOfColumns);
  }
}

Fixed version (ground truth):
private static void checkNumberOfColumns(Keyspace keyspace,String expectedColumnFamilyName,RowModel expectedRowModel) throws Error {
  int numberOfColumns=countNumberOfColumnsByKey(keyspace,expectedColumnFamilyName,expectedRowModel);
  int expectedNumberOfColumns=expectedRowModel.getColumns().size();
  if (numberOfColumns != expectedNumberOfColumns) {
    throw FailureHandler.createFailure("String_Node_Str",asString(expectedRowModel.getKey()),expectedNumberOfColumns,numberOfColumns);
  }
}
Program: 186172
Project: 186172
Buggy source:
private static void checkColumnName(ColumnModel expectedColumnModel,HColumn<byte[],byte[]> hColumn) throws Error {
  if (hColumn == null) {
    throw FailureHandler.createFailure("String_Node_Str",expectedColumnModel.getName().getValue());
  }
}

Fixed version (ground truth):
private static void checkColumnName(ColumnModel expectedColumnModel,HColumn<byte[],byte[]> hColumn) throws Error {
  if (hColumn == null) {
    throw FailureHandler.createFailure("String_Node_Str",asString(expectedColumnModel.getName()));
  }
}
Program: 186173
Project: 186173
Buggy source:
private static void checkNotStandardColumnsInSuperColumns(RowModel expectedRowModel,int size) throws Error {
  if (size > 0) {
    throw FailureHandler.createFailure("String_Node_Str",expectedRowModel.getKey().getValue());
  }
}

Fixed version (ground truth):
private static void checkNotStandardColumnsInSuperColumns(RowModel expectedRowModel,int size) throws Error {
  if (size > 0) {
    throw FailureHandler.createFailure("String_Node_Str",asString(expectedRowModel.getKey()));
  }
}
Program: 186174
Project: 186174
Buggy source:
@Override public Object connectionManager(){
  return keyspace;
}

Fixed version (ground truth):
@Override public Keyspace connectionManager(){
  return keyspace;
}
Program: 186175
Project: 186175
Buggy source:
@Override public DatabaseOperation getDatabaseOperation(){
  return databaseOperation;
}

Fixed version (ground truth):
@Override public DatabaseOperation<Keyspace> getDatabaseOperation(){
  return databaseOperation;
}
Program: 186176
Project: 186176
Buggy source:
Object connectionManager();

Fixed version (ground truth):
T connectionManager();
Program: 186177
Project: 186177
Buggy source:
private long getStartOfTimeRange(long millisNow){
  return EndedSometimeAgo.fromValue(PreferenceManager.getDefaultSharedPreferences(context).getString(PREF_EVENTS_ENDED,"String_Node_Str")).endedAt(millisNow);
}

Fixed version (ground truth):
private long getStartOfTimeRange(long millisNow){
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(context);
  int period=Integer.valueOf(prefs.getString(PREF_EVENTS_START,PREF_EVENTS_START_DEFAULT));
  if (period == PREF_EVENTS_START_TODAY) {
    return new DateTime(millisNow).withTimeAtStartOfDay().getMillis();
  }
 else   if (period == 0) {
    return millisNow;
  }
  return new DateTime(millisNow).minusHours(period).getMillis();
}
Program: 186178
Project: 186178
Buggy source:
private List<CalendarEvent> getTimeFilteredEventList(){
  long millisNow=System.currentTimeMillis();
  Uri.Builder builder=Instances.CONTENT_URI.buildUpon();
  ContentUris.appendId(builder,getStartOfTimeRange(millisNow));
  ContentUris.appendId(builder,getEndOfTimeRange(millisNow));
  Cursor cursor=context.getContentResolver().query(builder.build(),getProjection(),getCalendarSelection(),null,EVENT_SORT_ORDER);
  List<CalendarEvent> eventList=new ArrayList<>();
  if (cursor != null) {
    eventList=cursor2TimeFilteredEventList(cursor);
    cursor.close();
  }
  return eventList;
}

Fixed version (ground truth):
private List<CalendarEvent> getTimeFilteredEventList(){
  long millisNow=System.currentTimeMillis();
  Uri.Builder builder=Instances.CONTENT_URI.buildUpon();
  ContentUris.appendId(builder,getStartOfTimeRange(millisNow));
  ContentUris.appendId(builder,getEndOfTimeRange(millisNow));
  Cursor cursor=context.getContentResolver().query(builder.build(),getProjection(),getCalendarSelection(),null,EVENT_SORT_ORDER);
  List<CalendarEvent> eventList=new ArrayList<>();
  if (cursor != null) {
    eventList=cursorToTimeFilteredEventList(cursor);
    cursor.close();
  }
  return eventList;
}
Program: 186179
Project: 186179
Buggy source:
public List<CalendarEvent> getEvents(){
  List<CalendarEvent> eventList=getTimeFilteredEventList();
  for (  CalendarEvent event : getPastEventWithColorList()) {
    if (!eventList.contains(event)) {
      eventList.add(event);
    }
  }
  Collections.sort(eventList);
  return eventList;
}

Fixed version (ground truth):
public List<CalendarEvent> getEvents(){
  List<CalendarEvent> eventList=getTimeFilteredEventList();
  Collections.sort(eventList);
  return eventList;
}
Program: 186180
Project: 186180
Buggy source:
private void setupDayOneEntry(List<CalendarEvent> eventList,CalendarEvent event){
  if (isEqualOrAfterTodayAtMidnight(event.getStartDate())) {
    if (event.daysSpanned() > 1) {
      CalendarEvent clone=event.clone();
      clone.setEndDate(event.getStartDay().plusDays(1));
      clone.setSpansMultipleDays(true);
      clone.setOriginalEvent(event);
      eventList.add(clone);
    }
 else {
      eventList.add(event);
    }
  }
}

Fixed version (ground truth):
private void setupDayOneEntry(List<CalendarEvent> eventList,CalendarEvent event){
  if (isEqualOrAfterStartOfPeriod(event.getStartDate())) {
    if (event.daysSpanned() > 1) {
      CalendarEvent clone=event.clone();
      clone.setEndDate(event.getStartDay().plusDays(1));
      clone.setSpansMultipleDays(true);
      clone.setOriginalEvent(event);
      eventList.add(clone);
    }
 else {
      eventList.add(event);
    }
  }
}
Program: 186181
Project: 186181
Buggy source:
private List<CalendarEvent> getTimeFilteredEventList(){
  long millisNow=System.currentTimeMillis();
  Uri.Builder builder=Instances.CONTENT_URI.buildUpon();
  ContentUris.appendId(builder,getStartOfTimeRange(millisNow));
  ContentUris.appendId(builder,getEndOfTimeRange(millisNow));
  Cursor cursor=context.getContentResolver().query(builder.build(),getProjection(),getCalendarSelection(),null,EVENT_SORT_ORDER);
  List<CalendarEvent> eventList=new ArrayList<>();
  if (cursor != null) {
    eventList=cursorToTimeFilteredEventList(cursor);
    cursor.close();
  }
  return eventList;
}

Fixed version (ground truth):
private List<CalendarEvent> getTimeFilteredEventList(){
  long millisNow=System.currentTimeMillis();
  Uri.Builder builder=Instances.CONTENT_URI.buildUpon();
  ContentUris.appendId(builder,getStartOfPeriod(millisNow).getMillis());
  ContentUris.appendId(builder,getEndOfPeriod(millisNow).getMillis());
  Cursor cursor=context.getContentResolver().query(builder.build(),getProjection(),getCalendarSelection(),null,EVENT_SORT_ORDER);
  List<CalendarEvent> eventList=new ArrayList<>();
  if (cursor != null) {
    eventList=cursorToTimeFilteredEventList(cursor);
    cursor.close();
  }
  return eventList;
}
Program: 186182
Project: 186182
Buggy source:
private void createFollowingEntries(List<CalendarEvent> eventList,CalendarEvent event){
  int daysCovered=event.daysSpanned();
  for (int j=1; j < daysCovered; j++) {
    DateTime startDate=event.getStartDay().plusDays(j);
    if (isEqualOrAfterTodayAtMidnight(startDate)) {
      DateTime endDate;
      if (j < daysCovered - 1) {
        endDate=startDate.plusDays(1);
      }
 else {
        endDate=event.getEndDate();
      }
      eventList.add(cloneAsSpanningEvent(event,startDate,endDate));
    }
  }
}

Fixed version (ground truth):
private void createFollowingEntries(List<CalendarEvent> eventList,CalendarEvent event){
  int daysCovered=event.daysSpanned();
  for (int j=1; j < daysCovered; j++) {
    DateTime startDate=event.getStartDay().plusDays(j);
    if (isEqualOrAfterStartOfPeriod(startDate)) {
      DateTime endDate;
      if (j < daysCovered - 1) {
        endDate=startDate.plusDays(1);
      }
 else {
        endDate=event.getEndDate();
      }
      eventList.add(cloneAsSpanningEvent(event,startDate,endDate));
    }
  }
}
Program: 186183
Project: 186183
Buggy source:
static Intent createOpenCalendarAtDayIntent(Context context,DateTime goToTime){
  Intent launchIntent=createCalendarIntent(Intent.ACTION_VIEW);
  Uri.Builder builder=CalendarContract.CONTENT_URI.buildUpon();
  builder.appendPath(TIME);
  if (goToTime.getMillis() != 0) {
    launchIntent.putExtra(KEY_DETAIL_VIEW,true);
    ContentUris.appendId(builder,goToTime.getMillis());
  }
  launchIntent.setData(builder.build());
  return launchIntent;
}

Fixed version (ground truth):
static Intent createOpenCalendarAtDayIntent(DateTime goToTime){
  Intent launchIntent=createCalendarIntent();
  Uri.Builder builder=CalendarContract.CONTENT_URI.buildUpon();
  builder.appendPath(TIME);
  if (goToTime.getMillis() != 0) {
    launchIntent.putExtra(KEY_DETAIL_VIEW,true);
    ContentUris.appendId(builder,goToTime.getMillis());
  }
  launchIntent.setData(builder.build());
  return launchIntent;
}
Program: 186184
Project: 186184
Buggy source:
private static Intent createCalendarIntent(String action){
  Intent intent=new Intent(action);
  intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP);
  return intent;
}

Fixed version (ground truth):
private static Intent createCalendarIntent(){
  Intent intent=new Intent(Intent.ACTION_VIEW);
  intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP);
  return intent;
}
Program: 186185
Project: 186185
Buggy source:
public static Intent createOpenCalendarEventIntent(int eventId,DateTime from,DateTime to){
  Intent intent=createCalendarIntent(Intent.ACTION_VIEW);
  intent.setData(ContentUris.withAppendedId(Events.CONTENT_URI,eventId));
  intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME,from.getMillis());
  intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME,to.getMillis());
  return intent;
}

Fixed version (ground truth):
public static Intent createOpenCalendarEventIntent(int eventId,DateTime from,DateTime to){
  Intent intent=createCalendarIntent();
  intent.setData(ContentUris.withAppendedId(Events.CONTENT_URI,eventId));
  intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME,from.getMillis());
  intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME,to.getMillis());
  return intent;
}
Program: 186186
Project: 186186
Buggy source:
static PendingIntent createOpenCalendarEventPendingIntent(Context context){
  Intent intent=createCalendarIntent(Intent.ACTION_VIEW);
  return PendingIntent.getActivity(context,0,intent,PendingIntent.FLAG_UPDATE_CURRENT);
}

Fixed version (ground truth):
static PendingIntent createOpenCalendarEventPendingIntent(Context context){
  Intent intent=createCalendarIntent();
  return PendingIntent.getActivity(context,0,intent,PendingIntent.FLAG_UPDATE_CURRENT);
}
Program: 186187
Project: 186187
Buggy source:
public static boolean isIntentAvailable(Context context,Intent intent){
  PackageManager packageManager=context.getPackageManager();
  List<ResolveInfo> list=packageManager.queryIntentActivities(intent,PackageManager.MATCH_DEFAULT_ONLY);
  return list.size() > 0;
}

Fixed version (ground truth):
private static boolean isIntentAvailable(Context context,Intent intent){
  PackageManager packageManager=context.getPackageManager();
  List<ResolveInfo> list=packageManager.queryIntentActivities(intent,PackageManager.MATCH_DEFAULT_ONLY);
  return list.size() > 0;
}
Program: 186188
Project: 186188
Buggy source:
public void configureActionBar(Context context,RemoteViews rv){
  String formattedDate=DateUtils.formatDateTime(context,System.currentTimeMillis(),DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_WEEKDAY);
  rv.setTextViewText(R.id.calendar_current_date,formattedDate.toUpperCase(Locale.getDefault()));
  setTextColorRes(context,rv,R.id.calendar_current_date,R.attr.header);
  Intent startConfigIntent=new Intent(context,WidgetConfigurationActivity.class);
  PendingIntent menuPendingIntent=PendingIntent.getActivity(context,0,startConfigIntent,PendingIntent.FLAG_UPDATE_CURRENT);
  rv.setOnClickPendingIntent(R.id.overflow_menu,menuPendingIntent);
  Intent intent=CalendarIntentUtil.createNewEventIntent();
  if (isIntentAvailable(context,intent)) {
    PendingIntent pendingIntent=PendingIntent.getActivity(context,0,intent,PendingIntent.FLAG_UPDATE_CURRENT);
    rv.setOnClickPendingIntent(R.id.add_event,pendingIntent);
  }
 else {
    rv.setViewVisibility(R.id.add_event,View.GONE);
  }
}

Fixed version (ground truth):
private void configureActionBar(Context context,RemoteViews rv){
  String formattedDate=DateUtils.formatDateTime(context,System.currentTimeMillis(),DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_WEEKDAY);
  rv.setTextViewText(R.id.calendar_current_date,formattedDate.toUpperCase(Locale.getDefault()));
  setTextColorRes(context,rv,R.id.calendar_current_date,R.attr.header);
  Intent startConfigIntent=new Intent(context,WidgetConfigurationActivity.class);
  PendingIntent menuPendingIntent=PendingIntent.getActivity(context,0,startConfigIntent,PendingIntent.FLAG_UPDATE_CURRENT);
  rv.setOnClickPendingIntent(R.id.overflow_menu,menuPendingIntent);
  Intent intent=CalendarIntentUtil.createNewEventIntent();
  if (isIntentAvailable(context,intent)) {
    PendingIntent pendingIntent=PendingIntent.getActivity(context,0,intent,PendingIntent.FLAG_UPDATE_CURRENT);
    rv.setOnClickPendingIntent(R.id.add_event,pendingIntent);
  }
 else {
    rv.setViewVisibility(R.id.add_event,View.GONE);
  }
}
Program: 186189
Project: 186189
Buggy source:
public void configureBackground(Context context,RemoteViews rv){
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(context);
  if (prefs.getBoolean(PREF_SHOW_HEADER,true)) {
    rv.setViewVisibility(R.id.action_bar,View.VISIBLE);
  }
 else {
    rv.setViewVisibility(R.id.action_bar,View.GONE);
  }
  int color=prefs.getInt(PREF_BACKGROUND_COLOR,PREF_BACKGROUND_COLOR_DEFAULT);
  setColorFilter(rv,R.id.background_image,color);
  setAlpha(rv,R.id.background_image,Color.alpha(color));
}

Fixed version (ground truth):
private void configureBackground(Context context,RemoteViews rv){
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(context);
  if (prefs.getBoolean(PREF_SHOW_HEADER,true)) {
    rv.setViewVisibility(R.id.action_bar,View.VISIBLE);
  }
 else {
    rv.setViewVisibility(R.id.action_bar,View.GONE);
  }
  int color=prefs.getInt(PREF_BACKGROUND_COLOR,PREF_BACKGROUND_COLOR_DEFAULT);
  setColorFilter(rv,R.id.background_image,color);
  setAlpha(rv,R.id.background_image,Color.alpha(color));
}
Program: 186190
Project: 186190
Buggy source:
public void configureList(Context context,int widgetId,RemoteViews rv){
  Intent intent=new Intent(context,EventWidgetService.class);
  intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,widgetId);
  intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
  rv.setRemoteAdapter(R.id.event_list,intent);
  rv.setEmptyView(R.id.event_list,R.id.empty_event_list);
  rv.setPendingIntentTemplate(R.id.event_list,createOpenCalendarEventPendingIntent(context));
  rv.setOnClickFillInIntent(R.id.empty_event_list,createOpenCalendarAtDayIntent(context,new DateTime()));
  setTextColorRes(context,rv,R.id.empty_event_list,R.attr.eventEntryTitle);
}

Fixed version (ground truth):
private void configureList(Context context,int widgetId,RemoteViews rv){
  Intent intent=new Intent(context,EventWidgetService.class);
  intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,widgetId);
  intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
  rv.setRemoteAdapter(R.id.event_list,intent);
  rv.setEmptyView(R.id.event_list,R.id.empty_event_list);
  rv.setPendingIntentTemplate(R.id.event_list,createOpenCalendarEventPendingIntent(context));
  rv.setOnClickFillInIntent(R.id.empty_event_list,createOpenCalendarAtDayIntent(new DateTime()));
  setTextColorRes(context,rv,R.id.empty_event_list,R.attr.eventEntryTitle);
}
Program: 186191
Project: 186191
Buggy source:
public RemoteViews updateDayHeader(DayHeader dayHeader){
  RemoteViews rv=new RemoteViews(context.getPackageName(),R.layout.day_header);
  rv.setTextViewText(R.id.day_header_title,createDayEntryString(dayHeader));
  setTextSize(context,rv,R.id.day_header_title,R.dimen.day_header_title);
  setTextColorRes(context,rv,R.id.day_header_title,R.attr.dayHeaderTitle);
  setBackgroundColorRes(context,rv,R.id.day_header_separator,R.attr.dayHeaderSeparator);
  setPadding(context,rv,R.id.day_header_title,0,R.dimen.day_header_padding_top,R.dimen.day_header_padding_right,R.dimen.day_header_padding_bottom);
  Intent intent=createOpenCalendarAtDayIntent(context,dayHeader.getStartDate());
  rv.setOnClickFillInIntent(R.id.day_header,intent);
  return rv;
}

Fixed version (ground truth):
public RemoteViews updateDayHeader(DayHeader dayHeader){
  RemoteViews rv=new RemoteViews(context.getPackageName(),R.layout.day_header);
  rv.setTextViewText(R.id.day_header_title,createDayEntryString(dayHeader));
  setTextSize(context,rv,R.id.day_header_title,R.dimen.day_header_title);
  setTextColorRes(context,rv,R.id.day_header_title,R.attr.dayHeaderTitle);
  setBackgroundColorRes(context,rv,R.id.day_header_separator,R.attr.dayHeaderSeparator);
  setPadding(context,rv,R.id.day_header_title,0,R.dimen.day_header_padding_top,R.dimen.day_header_padding_right,R.dimen.day_header_padding_bottom);
  Intent intent=createOpenCalendarAtDayIntent(dayHeader.getStartDate());
  rv.setOnClickFillInIntent(R.id.day_header,intent);
  return rv;
}
Program: 186192
Project: 186192
Buggy source:
public String createDayEntryString(DayHeader dayEntry){
  Date date=dayEntry.getStartDate().toDate();
  if (dayEntry.isToday()) {
    return createDateString(date,context.getString(R.string.today));
  }
 else   if (dayEntry.isTomorrow()) {
    return createDateString(date,context.getString(R.string.tomorrow));
  }
  return DateUtils.formatDateTime(context,date.getTime(),DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_WEEKDAY).toUpperCase(Locale.getDefault());
}

Fixed version (ground truth):
private String createDayEntryString(DayHeader dayEntry){
  Date date=dayEntry.getStartDate().toDate();
  if (dayEntry.isToday()) {
    return createDateString(date,context.getString(R.string.today));
  }
 else   if (dayEntry.isTomorrow()) {
    return createDateString(date,context.getString(R.string.tomorrow));
  }
  return DateUtils.formatDateTime(context,date.getTime(),DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_WEEKDAY).toUpperCase(Locale.getDefault());
}
Program: 186193
Project: 186193
Buggy source:
private String createDateString(Date date,String text){
  return text + COMMA_SPACE + DateUtils.formatDateTime(context,date.getTime(),DateUtils.FORMAT_SHOW_DATE).toUpperCase(Locale.getDefault());
}

Fixed version (ground truth):
protected String createDateString(Date date,String text){
  return text + COMMA_SPACE + DateUtils.formatDateTime(context,date.getTime(),DateUtils.FORMAT_SHOW_DATE).toUpperCase(Locale.getDefault());
}
Program: 186194
Project: 186194
Buggy source:
public CalendarEvent cloneAsSpanningEvent(CalendarEvent eventEntry,DateTime startDate,DateTime endDate){
  CalendarEvent clone=eventEntry.clone();
  clone.setStartDate(startDate);
  clone.setEndDate(endDate);
  clone.setSpansMultipleDays(true);
  clone.setOriginalEvent(eventEntry);
  return clone;
}

Fixed version (ground truth):
private CalendarEvent cloneAsSpanningEvent(CalendarEvent eventEntry,DateTime startDate,DateTime endDate){
  CalendarEvent clone=eventEntry.clone();
  clone.setStartDate(startDate);
  clone.setEndDate(endDate);
  clone.setSpansMultipleDays(true);
  clone.setOriginalEvent(eventEntry);
  return clone;
}
Program: 186195
Project: 186195
Buggy source:
public int getEntryColor(Cursor calendarCursor){
  int eventColor=calendarCursor.getInt(6);
  if (eventColor > 0) {
    return eventColor;
  }
  return calendarCursor.getInt(5);
}

Fixed version (ground truth):
private int getEntryColor(Cursor calendarCursor){
  int eventColor=calendarCursor.getInt(6);
  if (eventColor > 0) {
    return eventColor;
  }
  return calendarCursor.getInt(5);
}
Program: 186196
Project: 186196
Buggy source:
public boolean isEqualOrAfterTodayAtMidnight(DateTime startDate){
  DateMidnight midnight=new DateMidnight();
  return startDate.isEqual(midnight) || startDate.isAfter(midnight);
}

Fixed version (ground truth):
private boolean isEqualOrAfterTodayAtMidnight(DateTime startDate){
  DateMidnight midnight=new DateMidnight();
  return startDate.isEqual(midnight) || startDate.isAfter(midnight);
}
Program: 186197
Project: 186197
Buggy source:
public String createTimeSpanString(CalendarEvent event){
  String startStr;
  String endStr;
  String separator=SPACE_DASH_SPACE;
  if (event.isPartOfMultiDayEvent() && DateUtil.isMidnight(event.getStartDate()) && !event.isStartOfMultiDayEvent()) {
    startStr=ARROW_SPACE;
    separator=EMPTY_STRING;
  }
 else {
    startStr=createTimeString(event.getStartDate());
  }
  if (prefs.getBoolean(PREF_SHOW_END_TIME,PREF_SHOW_END_TIME_DEFAULT)) {
    if (event.isPartOfMultiDayEvent() && DateUtil.isMidnight(event.getEndDate()) && !event.isEndOfMultiDayEvent()) {
      endStr=SPACE_ARROW;
      separator=EMPTY_STRING;
    }
 else {
      endStr=createTimeString(event.getEndDate());
    }
  }
 else {
    separator=EMPTY_STRING;
    endStr=EMPTY_STRING;
  }
  return startStr + separator + endStr;
}

Fixed version (ground truth):
private String createTimeSpanString(CalendarEvent event){
  String startStr;
  String endStr;
  String separator=SPACE_DASH_SPACE;
  if (event.isPartOfMultiDayEvent() && DateUtil.isMidnight(event.getStartDate()) && !event.isStartOfMultiDayEvent()) {
    startStr=ARROW_SPACE;
    separator=EMPTY_STRING;
  }
 else {
    startStr=createTimeString(event.getStartDate());
  }
  if (prefs.getBoolean(PREF_SHOW_END_TIME,PREF_SHOW_END_TIME_DEFAULT)) {
    if (event.isPartOfMultiDayEvent() && DateUtil.isMidnight(event.getEndDate()) && !event.isEndOfMultiDayEvent()) {
      endStr=SPACE_ARROW;
      separator=EMPTY_STRING;
    }
 else {
      endStr=createTimeString(event.getEndDate());
    }
  }
 else {
    separator=EMPTY_STRING;
    endStr=EMPTY_STRING;
  }
  return startStr + separator + endStr;
}
Program: 186198
Project: 186198
Buggy source:
public Intent createOnItemClickIntent(CalendarEvent event){
  CalendarEvent originalEvent=event.getOriginalEvent();
  if (originalEvent != null) {
    event=originalEvent;
  }
  return CalendarIntentUtil.createOpenCalendarEventIntent(event.getEventId(),event.getStartDate(),event.getEndDate());
}

Fixed version (ground truth):
private Intent createOnItemClickIntent(CalendarEvent event){
  CalendarEvent originalEvent=event.getOriginalEvent();
  if (originalEvent != null) {
    event=originalEvent;
  }
  return CalendarIntentUtil.createOpenCalendarEventIntent(event.getEventId(),event.getStartDate(),event.getEndDate());
}
Program: 186199
Project: 186199
Buggy source:
public String createTimeString(DateTime time){
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(context);
  String dateFormat=prefs.getString(PREF_DATE_FORMAT,PREF_DATE_FORMAT_DEFAULT);
  if (DateUtil.hasAmPmClock(Locale.getDefault()) && dateFormat.equals(AUTO) || dateFormat.equals(TWELVE)) {
    return DateUtils.formatDateTime(context,time.toDate().getTime(),DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_12HOUR);
  }
  return DateUtils.formatDateTime(context,time.toDate().getTime(),DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_24HOUR);
}

Fixed version (ground truth):
private String createTimeString(DateTime time){
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(context);
  String dateFormat=prefs.getString(PREF_DATE_FORMAT,PREF_DATE_FORMAT_DEFAULT);
  if (DateUtil.hasAmPmClock(Locale.getDefault()) && dateFormat.equals(AUTO) || dateFormat.equals(TWELVE)) {
    return DateUtils.formatDateTime(context,time.toDate().getTime(),DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_12HOUR);
  }
  return DateUtils.formatDateTime(context,time.toDate().getTime(),DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_24HOUR);
}
Program: 186200
Project: 186200
Buggy source:
public Dialog createDialog(View layout){
  AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
  builder.setTitle(R.string.appearance_background_color_title);
  builder.setView(layout);
  builder.setPositiveButton(android.R.string.ok,new OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(getActivity());
      Editor editor=prefs.edit();
      editor.putInt(PREF_BACKGROUND_COLOR,picker.getColor());
      editor.commit();
    }
  }
);
  return builder.create();
}

Fixed version (ground truth):
private Dialog createDialog(View layout){
  AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
  builder.setTitle(R.string.appearance_background_color_title);
  builder.setView(layout);
  builder.setPositiveButton(android.R.string.ok,new OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(getActivity());
      Editor editor=prefs.edit();
      editor.putInt(PREF_BACKGROUND_COLOR,picker.getColor());
      editor.commit();
    }
  }
);
  return builder.create();
}
Program: 186201
Project: 186201
Buggy source:
public void populatePreferenceScreen(Set<String> activeCalendars){
  Cursor cursor=createLoadedCursor();
  if (cursor == null) {
    return;
  }
  for (int i=0; i < cursor.getCount(); i++) {
    cursor.moveToPosition(i);
    CheckBoxPreference checkboxPref=new CheckBoxPreference(getActivity());
    checkboxPref.setTitle(cursor.getString(1));
    checkboxPref.setIcon(createDrawable(cursor.getInt(2)));
    int calendarId=cursor.getInt(0);
    checkboxPref.getExtras().putInt(CALENDAR_ID,calendarId);
    checkboxPref.setChecked(activeCalendars == null || activeCalendars.contains(String.valueOf(calendarId)));
    getPreferenceScreen().addPreference(checkboxPref);
  }
}

Fixed version (ground truth):
private void populatePreferenceScreen(Set<String> activeCalendars){
  Cursor cursor=createLoadedCursor();
  if (cursor == null) {
    return;
  }
  for (int i=0; i < cursor.getCount(); i++) {
    cursor.moveToPosition(i);
    CheckBoxPreference checkboxPref=new CheckBoxPreference(getActivity());
    checkboxPref.setTitle(cursor.getString(1));
    checkboxPref.setIcon(createDrawable(cursor.getInt(2)));
    int calendarId=cursor.getInt(0);
    checkboxPref.getExtras().putInt(CALENDAR_ID,calendarId);
    checkboxPref.setChecked(activeCalendars == null || activeCalendars.contains(String.valueOf(calendarId)));
    getPreferenceScreen().addPreference(checkboxPref);
  }
}
Program: 186202
Project: 186202
Buggy source:
public HashSet<String> getSelectedCalenders(){
  PreferenceScreen preferenceScreen=getPreferenceScreen();
  int prefCount=preferenceScreen.getPreferenceCount();
  HashSet<String> prefValues=new HashSet<String>();
  for (int i=0; i < prefCount; i++) {
    Preference pref=preferenceScreen.getPreference(i);
    if (pref instanceof CheckBoxPreference) {
      CheckBoxPreference checkPref=(CheckBoxPreference)pref;
      if (checkPref.isChecked()) {
        prefValues.add(String.valueOf(checkPref.getExtras().getInt(CALENDAR_ID)));
      }
    }
  }
  return prefValues;
}

Fixed version (ground truth):
private HashSet<String> getSelectedCalenders(){
  PreferenceScreen preferenceScreen=getPreferenceScreen();
  int prefCount=preferenceScreen.getPreferenceCount();
  HashSet<String> prefValues=new HashSet<>();
  for (int i=0; i < prefCount; i++) {
    Preference pref=preferenceScreen.getPreference(i);
    if (pref instanceof CheckBoxPreference) {
      CheckBoxPreference checkPref=(CheckBoxPreference)pref;
      if (checkPref.isChecked()) {
        prefValues.add(String.valueOf(checkPref.getExtras().getInt(CALENDAR_ID)));
      }
    }
  }
  return prefValues;
}
Program: 186203
Project: 186203
Buggy source:
public BitmapDrawable createDrawable(int color){
  Bitmap bitmap=BitmapFactory.decodeResource(getResources(),R.drawable.prefs_calendar_color);
  BitmapDrawable drawable=new BitmapDrawable(getResources(),bitmap);
  drawable.setColorFilter(new LightingColorFilter(0x0,color));
  return drawable;
}

Fixed version (ground truth):
private Drawable createDrawable(int color){
  Drawable drawable=getResources().getDrawable(R.drawable.prefs_calendar_entry);
  drawable.setColorFilter(new LightingColorFilter(0x0,color));
  return drawable;
}
Program: 186204
Project: 186204
Buggy source:
public void persistSelectedCalendars(HashSet<String> prefValues){
  SharedPreferences prefs=getPreferenceManager().getSharedPreferences();
  Editor editor=prefs.edit();
  editor.putStringSet(PREF_ACTIVE_CALENDARS,prefValues);
  editor.commit();
}

Fixed version (ground truth):
private void persistSelectedCalendars(HashSet<String> prefValues){
  SharedPreferences prefs=getPreferenceManager().getSharedPreferences();
  Editor editor=prefs.edit();
  editor.putStringSet(PREF_ACTIVE_CALENDARS,prefValues);
  editor.commit();
}
Program: 186205
Project: 186205
Buggy source:
public int getViewTypeCount(){
  int result=0;
  for (int i=0; i < eventProviders.size(); i++) {
    IEventProvider<?> eventProvider=eventProviders.get(i);
    result+=eventProvider.getViewTypeCount();
  }
  return result;
}

Fixed version (ground truth):
public int getViewTypeCount(){
  int result=0;
  for (int i=0; i < eventProviders.size(); i++) {
    IEventVisualizer<?> eventProvider=eventProviders.get(i);
    result+=eventProvider.getViewTypeCount();
  }
  return result;
}
Program: 186206
Project: 186206
Buggy source:
public void onDataSetChanged(){
  eventEntries.clear();
  ArrayList<EventEntry> eventEntries=new ArrayList<EventEntry>();
  for (int i=0; i < eventProviders.size(); i++) {
    eventEntries.addAll(eventProviders.get(i).getEventEntries());
  }
  updateEntryList(eventEntries);
}

Fixed version (ground truth):
public void onDataSetChanged(){
  eventEntries.clear();
  ArrayList<EventEntry> events=new ArrayList<EventEntry>();
  for (int i=0; i < eventProviders.size(); i++) {
    events.addAll(eventProviders.get(i).getEventEntries());
  }
  updateEntryList(events);
}
Program: 186207
Project: 186207
Buggy source:
public void updateEntryList(ArrayList<EventEntry> eventList){
  if (!eventList.isEmpty()) {
    DayHeader curDayBucket=new DayHeader(eventList.get(0).getStartDate());
    eventEntries.add(curDayBucket);
    for (    EventEntry event : eventList) {
      if (!event.isSameDay(curDayBucket.getStartDate())) {
        curDayBucket=new DayHeader(event.getStartDate());
        eventEntries.add(curDayBucket);
      }
      eventEntries.add(event);
    }
  }
}

Fixed version (ground truth):
public void updateEntryList(ArrayList<EventEntry> eventList){
  if (!eventList.isEmpty()) {
    EventEntry entry=eventList.get(0);
    DayHeader curDayBucket=new DayHeader(DateUtil.getStartDateInUTC(entry));
    eventEntries.add(curDayBucket);
    for (    EventEntry event : eventList) {
      long startDateInUTC=DateUtil.getStartDateInUTC(event);
      if (!DateUtil.isSameDay(startDateInUTC,curDayBucket.getStartDate())) {
        curDayBucket=new DayHeader(startDateInUTC);
        eventEntries.add(curDayBucket);
      }
      eventEntries.add(event);
    }
  }
}
Program: 186208
Project: 186208
Buggy source:
public RemoteViews getViewAt(int position){
  EventEntry entry=eventEntries.get(position);
  if (entry instanceof DayHeader) {
    return updateDayHeader((DayHeader)entry);
  }
  for (int i=0; i < eventProviders.size(); i++) {
    IEventProvider<?> eventProvider=eventProviders.get(i);
    if (entry.getClass().isAssignableFrom(eventProvider.getSupportedEventEntryType())) {
      return eventProvider.getRemoteView(entry);
    }
  }
  return null;
}

Fixed version (ground truth):
public RemoteViews getViewAt(int position){
  EventEntry entry=eventEntries.get(position);
  if (entry instanceof DayHeader) {
    return updateDayHeader((DayHeader)entry);
  }
  for (int i=0; i < eventProviders.size(); i++) {
    IEventVisualizer<?> eventProvider=eventProviders.get(i);
    if (entry.getClass().isAssignableFrom(eventProvider.getSupportedEventEntryType())) {
      return eventProvider.getRemoteView(entry);
    }
  }
  return null;
}
Program: 186209
Project: 186209
Buggy source:
public EventRemoteViewsFactory(Context context){
  this.context=context;
  eventProviders=new ArrayList<IEventProvider<?>>();
  eventProviders.add(new CalendarEventProvider(context));
  eventEntries=new ArrayList<EventEntry>();
  prefs=PreferenceManager.getDefaultSharedPreferences(context);
}

Fixed version (ground truth):
public EventRemoteViewsFactory(Context context){
  this.context=context;
  eventProviders=new ArrayList<IEventVisualizer<?>>();
  eventProviders.add(new CalendarEventVisualizer(context));
  eventEntries=new ArrayList<EventEntry>();
  prefs=PreferenceManager.getDefaultSharedPreferences(context);
}
Program: 186210
Project: 186210
Buggy source:
public void createFollowingEntries(ArrayList<CalendarEntry> eventList,CalendarEntry eventEntry){
  int daysCovered=eventEntry.daysCovered();
  for (int j=1; j < daysCovered; j++) {
    long startDate=DateUtil.toMidnight(eventEntry.getStartDate() + DateUtils.DAY_IN_MILLIS * j);
    if (startDate >= DateUtil.toMidnight(System.currentTimeMillis())) {
      long endDate;
      if (j == daysCovered - 1) {
        endDate=eventEntry.getEndDate();
      }
 else {
        endDate=startDate + DateUtils.DAY_IN_MILLIS;
      }
      eventList.add(cloneAsSpanningEvent(eventEntry,startDate,endDate));
    }
  }
}

Fixed version (ground truth):
public void createFollowingEntries(ArrayList<CalendarEntry> eventList,CalendarEntry eventEntry){
  int daysCovered=eventEntry.daysSpanned();
  for (int j=1; j < daysCovered; j++) {
    long startDate=DateUtil.toMidnight(eventEntry.getStartDate() + DateUtils.DAY_IN_MILLIS * j);
    if (startDate >= DateUtil.toMidnight(System.currentTimeMillis())) {
      long endDate;
      if (j == daysCovered - 1) {
        endDate=eventEntry.getEndDate();
      }
 else {
        endDate=startDate + DateUtils.DAY_IN_MILLIS;
      }
      eventList.add(cloneAsSpanningEvent(eventEntry,startDate,endDate));
    }
  }
}
Program: 186211
Project: 186211
Buggy source:
public void setupDayOneEntry(ArrayList<CalendarEntry> eventList,CalendarEntry eventEntry){
  long today=DateUtil.toMidnight(System.currentTimeMillis());
  int daysCovered=eventEntry.daysCovered();
  if (eventEntry.getStartDate() >= today) {
    if (daysCovered > 1) {
      CalendarEntry clone=eventEntry.clone();
      clone.setEndDate(today + DateUtils.DAY_IN_MILLIS);
      clone.setSpansMultipleDays(true);
      clone.setOriginalEvent(eventEntry);
      eventList.add(clone);
    }
 else {
      eventList.add(eventEntry);
    }
  }
}

Fixed version (ground truth):
public void setupDayOneEntry(ArrayList<CalendarEntry> eventList,CalendarEntry eventEntry){
  long today=DateUtil.toMidnight(System.currentTimeMillis());
  int daysSpanned=eventEntry.daysSpanned();
  if (eventEntry.getStartDate() >= today) {
    if (daysSpanned > 1) {
      CalendarEntry clone=eventEntry.clone();
      clone.setEndDate(DateUtil.toMidnight(eventEntry.getStartDate()) + DateUtils.DAY_IN_MILLIS);
      clone.setSpansMultipleDays(true);
      clone.setOriginalEvent(eventEntry);
      eventList.add(clone);
    }
 else {
      eventList.add(eventEntry);
    }
  }
}
Program: 186212
Project: 186212
Buggy source:
public void createFollowingEntries(ArrayList<CalendarEntry> eventList,CalendarEntry eventEntry){
  int daysCovered=eventEntry.daysSpanned();
  for (int j=1; j < daysCovered; j++) {
    long startDate=DateUtil.toMidnight(eventEntry.getStartDate() + DateUtils.DAY_IN_MILLIS * j);
    if (startDate >= DateUtil.toMidnight(System.currentTimeMillis())) {
      long endDate;
      if (j == daysCovered - 1) {
        endDate=eventEntry.getEndDate();
      }
 else {
        endDate=startDate + DateUtils.DAY_IN_MILLIS;
      }
      eventList.add(cloneAsSpanningEvent(eventEntry,startDate,endDate));
    }
  }
}

Fixed version (ground truth):
public void createFollowingEntries(ArrayList<CalendarEntry> eventList,CalendarEntry eventEntry){
  int daysCovered=eventEntry.daysSpanned();
  for (int j=1; j < daysCovered; j++) {
    long startDate=DateUtil.toUtcMidnight(eventEntry.getStartDate()) + DateUtils.DAY_IN_MILLIS * j;
    if (startDate >= DateUtil.toUtcMidnight(System.currentTimeMillis())) {
      long endDate;
      if (j == daysCovered - 1) {
        endDate=eventEntry.getEndDate();
      }
 else {
        endDate=startDate + DateUtils.DAY_IN_MILLIS;
      }
      eventList.add(cloneAsSpanningEvent(eventEntry,startDate,endDate));
    }
  }
}
Program: 186213
Project: 186213
Buggy source:
public void setupDayOneEntry(ArrayList<CalendarEntry> eventList,CalendarEntry eventEntry){
  long today=DateUtil.toMidnight(System.currentTimeMillis());
  int daysSpanned=eventEntry.daysSpanned();
  long startInUTC=DateUtil.getStartDateInUTC(eventEntry);
  if (startInUTC >= today) {
    if (daysSpanned > 1) {
      CalendarEntry clone=eventEntry.clone();
      clone.setEndDate(DateUtil.toMidnight(eventEntry.getStartDate()) + DateUtils.DAY_IN_MILLIS);
      clone.setSpansMultipleDays(true);
      clone.setOriginalEvent(eventEntry);
      eventList.add(clone);
    }
 else {
      eventList.add(eventEntry);
    }
  }
}

Fixed version (ground truth):
public void setupDayOneEntry(ArrayList<CalendarEntry> eventList,CalendarEntry eventEntry){
  long today=DateUtil.toMidnight(System.currentTimeMillis());
  int daysSpanned=eventEntry.daysSpanned();
  if (DateUtil.getStartDateInUTC(eventEntry) >= today) {
    if (daysSpanned > 1) {
      CalendarEntry clone=eventEntry.clone();
      clone.setEndDate(DateUtil.toMidnight(eventEntry.getStartDate()) + DateUtils.DAY_IN_MILLIS);
      clone.setSpansMultipleDays(true);
      clone.setOriginalEvent(eventEntry);
      eventList.add(clone);
    }
 else {
      eventList.add(eventEntry);
    }
  }
}
Program: 186214
Project: 186214
Buggy source:
public boolean isTomorrow(){
  return startDate.toDateMidnight().isEqual(new DateTime().plusDays(1));
}

Fixed version (ground truth):
public boolean isTomorrow(){
  return isSameDay(new DateTime().plusDays(1));
}
Program: 186215
Project: 186215
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.preferences_calendars);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.preferences_calendars);
  SharedPreferences prefs=getPreferenceManager().getSharedPreferences();
  initialActiveCalendars=prefs.getStringSet(ICalendarPreferences.PREF_ACTIVE_CALENDARS,null);
  populatePreferenceScreen(initialActiveCalendars);
}
Program: 186216
Project: 186216
Buggy source:
static Intent createOpenCalendarAtDayIntent(Context context,long goToTime){
  Intent launchIntent=createOpenCalendarIntent();
  Uri.Builder builder=CalendarContract.CONTENT_URI.buildUpon();
  builder.appendPath("String_Node_Str");
  if (goToTime != 0) {
    launchIntent.putExtra(KEY_DETAIL_VIEW,true);
    ContentUris.appendId(builder,goToTime);
  }
  launchIntent.setData(builder.build());
  return launchIntent;
}

Fixed version (ground truth):
static Intent createOpenCalendarAtDayIntent(Context context,long goToTime){
  Intent launchIntent=createOpenCalendarIntent();
  Uri.Builder builder=CalendarContract.CONTENT_URI.buildUpon();
  builder.appendPath(TIME);
  if (goToTime != 0) {
    launchIntent.putExtra(KEY_DETAIL_VIEW,true);
    ContentUris.appendId(builder,goToTime);
  }
  launchIntent.setData(builder.build());
  return launchIntent;
}
Program: 186217
Project: 186217
Buggy source:
static Intent createOpenCalendarEventIntent(int eventId){
  Intent intent=createOpenCalendarIntent();
  intent.setData(ContentUris.withAppendedId(Events.CONTENT_URI,eventId));
  return intent;
}

Fixed version (ground truth):
static Intent createOpenCalendarEventIntent(int eventId,long from,long to){
  Intent intent=createOpenCalendarIntent();
  intent.setData(ContentUris.withAppendedId(Events.CONTENT_URI,eventId));
  intent.putExtra(BEGIN_TIME,from);
  intent.putExtra(END_TIME,to);
  return intent;
}
Program: 186218
Project: 186218
Buggy source:
public static void initiDateFormatter(){
  dayDateFormatter=new SimpleDateFormat("String_Node_Str");
  dayStringFormatter=new SimpleDateFormat("String_Node_Str");
  timeFormatter=new SimpleDateFormat("String_Node_Str");
}

Fixed version (ground truth):
public static void initiDateFormatter(){
  dayDateFormatter=new SimpleDateFormat(DAY_DATE_FORMAT);
  dayStringFormatter=new SimpleDateFormat(DAY_STRING_FORMAT);
  timeFormatter=new SimpleDateFormat(TIME_FORMAT);
}