nus-yam/ex-repair huggingface dataset:
Program: 24626
Project: 24626
Buggy source:
@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  Log.d(TAG,"String_Node_Str" + requestCode);
  Log.d(TAG,"String_Node_Str" + resultCode);
  Log.d(TAG,"String_Node_Str" + getSupportActionBar().getSelectedNavigationIndex());
  if (requestCode == FROM_CLOCK_ACTIVITY) {
    Chronos chronos=new Chronos(this);
    localPunchTable=chronos.getAllPunchesForThisPayPeriodByJob(chronos.getJobs().get(0));
    chronos.close();
  }
 else   if (requestCode == NewPunchActivity.NEW_PUNCH) {
    Log.d(TAG,"String_Node_Str");
    if (resultCode == RESULT_OK) {
      Chronos chronos=new Chronos(this);
      localPunchTable=chronos.getAllPunchesForThisPayPeriodByJob(chronos.getJobs().get(0));
      chronos.close();
    }
  }
  if (getSupportActionBar().getSelectedNavigationIndex() == 0) {
    setContentView(new DatePairView(this,localPunchTable.getPunchesByDay(new DateTime())));
  }
 else   if (getSupportActionBar().getSelectedNavigationIndex() == 1) {
    setContentView(new PayPeriodSummaryView(this,getPunchesByDate()));
  }
}

Fixed version (ground truth):
@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  if (enableLog)   Log.d(TAG,"String_Node_Str" + requestCode);
  if (enableLog)   Log.d(TAG,"String_Node_Str" + resultCode);
  if (enableLog)   Log.d(TAG,"String_Node_Str" + getSupportActionBar().getSelectedNavigationIndex());
  if (requestCode == FROM_CLOCK_ACTIVITY) {
    Chronos chronos=new Chronos(this);
    localPunchTable=chronos.getAllPunchesForThisPayPeriodByJob(chronos.getJobs().get(0));
    chronos.close();
  }
 else   if (requestCode == NewPunchActivity.NEW_PUNCH) {
    if (enableLog)     Log.d(TAG,"String_Node_Str");
    Chronos chronos=new Chronos(this);
    localPunchTable=chronos.getAllPunchesForThisPayPeriodByJob(chronos.getJobs().get(0));
    chronos.close();
  }
  if (getSupportActionBar().getSelectedNavigationIndex() == 0) {
    setContentView(new DatePairView(this,localPunchTable.getPunchesByDay(new DateTime())));
  }
 else   if (getSupportActionBar().getSelectedNavigationIndex() == 1) {
    setContentView(new PayPeriodSummaryView(this,getPunchesByDate()));
  }
}
Program: 24627
Project: 24627
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  Log.d(TAG,"String_Node_Str" + item);
  Log.d(TAG,"String_Node_Str" + item.getItemId());
switch (item.getItemId()) {
case R.id.menu_insert:
    Intent newIntent=new Intent().setClass(this,NewPunchActivity.class);
  newIntent.putExtra("String_Node_Str",jobId.getID());
newIntent.putExtra("String_Node_Str",DateTime.now().getMillis());
startActivityForResult(newIntent,NewPunchActivity.NEW_PUNCH);
return true;
case R.id.menu_navigate_today:
payHolder.generate();
setContentView(new PayPeriodSummaryView(this,getPunchesByDate()));
return true;
case R.id.menu_navigate_back:
payHolder.moveBackwards();
setContentView(new PayPeriodSummaryView(this,getPunchesByDate()));
return true;
case R.id.menu_navigate_forward:
payHolder.moveForwards();
setContentView(new PayPeriodSummaryView(this,getPunchesByDate()));
return true;
case android.R.id.home:
default :
return super.onOptionsItemSelected(item);
}
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  if (enableLog)   Log.d(TAG,"String_Node_Str" + item);
  if (enableLog)   Log.d(TAG,"String_Node_Str" + item.getItemId());
switch (item.getItemId()) {
case R.id.menu_insert:
    Intent newIntent=new Intent().setClass(this,NewPunchActivity.class);
  newIntent.putExtra("String_Node_Str",(long)jobId.getID());
newIntent.putExtra("String_Node_Str",DateTime.now().getMillis());
startActivityForResult(newIntent,NewPunchActivity.NEW_PUNCH);
return true;
case R.id.menu_navigate_today:
payHolder.generate();
setContentView(new PayPeriodSummaryView(this,getPunchesByDate()));
return true;
case R.id.menu_navigate_back:
payHolder.moveBackwards();
setContentView(new PayPeriodSummaryView(this,getPunchesByDate()));
return true;
case R.id.menu_navigate_forward:
payHolder.moveForwards();
setContentView(new PayPeriodSummaryView(this,getPunchesByDate()));
return true;
case android.R.id.home:
default :
return super.onOptionsItemSelected(item);
}
}
Program: 24629
Project: 24629
Buggy source:
private void updateDatabase(){
  int hour, min;
  TimePicker inTime=(TimePicker)findViewById(R.id.TimePicker1);
  Spinner taskSpinnerIn=(Spinner)findViewById(R.id.taskSpinnerIn);
  inTime.clearFocus();
  hour=inTime.getCurrentHour();
  min=inTime.getCurrentMinute();
  Task inTask=tasks.get(taskSpinnerIn.getSelectedItemPosition());
  DateTime date1=new DateTime(date.getYear(),date.getMonthOfYear(),date.getDayOfMonth(),hour,min);
  Chronos chrono=new Chronos(this);
  Job thisJob=null;
  List<Job> jobs=chrono.getJobs();
  for (  Job job : jobs) {
    if (job.getID() == jobID)     thisJob=job;
  }
  Punch newPunch=new Punch(thisJob,inTask,date1);
  Log.d(TAG,"String_Node_Str" + newPunch.getTime().getMillis());
  chrono.insertPunch(newPunch);
  chrono.close();
}

Fixed version (ground truth):
private void updateDatabase(){
  int hour, min;
  TimePicker inTime=(TimePicker)findViewById(R.id.TimePicker1);
  Spinner taskSpinnerIn=(Spinner)findViewById(R.id.taskSpinnerIn);
  inTime.clearFocus();
  hour=inTime.getCurrentHour();
  min=inTime.getCurrentMinute();
  Task inTask=tasks.get(taskSpinnerIn.getSelectedItemPosition());
  DateTime date1=new DateTime(date.getYear(),date.getMonthOfYear(),date.getDayOfMonth(),hour,min);
  Chronos chrono=new Chronos(this);
  Job thisJob=null;
  List<Job> jobs=chrono.getJobs();
  for (  Job job : jobs) {
    if (job.getID() == jobID)     thisJob=job;
  }
  Punch newPunch=new Punch(thisJob,inTask,date1);
  if (enableLog)   Log.d(TAG,"String_Node_Str" + newPunch.getTime().getMillis());
  chrono.insertPunch(newPunch);
  chrono.close();
}
Program: 24630
Project: 24630
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  Log.d(TAG,"String_Node_Str" + item);
  Log.d(TAG,"String_Node_Str" + item.getItemId());
switch (item.getItemId()) {
case R.id.menuSave:
    updateDatabase();
  setResult(RESULT_OK);
finish();
return true;
case android.R.id.home:
case R.id.menuCancel:
setResult(RESULT_CANCELED);
finish();
return true;
default :
return super.onOptionsItemSelected(item);
}
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  if (enableLog)   Log.d(TAG,"String_Node_Str" + item);
  if (enableLog)   Log.d(TAG,"String_Node_Str" + item.getItemId());
switch (item.getItemId()) {
case R.id.menuSave:
    updateDatabase();
  setResult(RESULT_OK);
finish();
return true;
case android.R.id.home:
case R.id.menuCancel:
setResult(RESULT_CANCELED);
finish();
return true;
default :
return super.onOptionsItemSelected(item);
}
}
Program: 24631
Project: 24631
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  Log.d(TAG,"String_Node_Str");
  super.onCreate(savedInstanceState);
  setContentView(R.layout.punch_pair_editor);
  int punch1;
  int punch2;
  if (savedInstanceState != null) {
    punch1=savedInstanceState.getInt("String_Node_Str");
    punch2=savedInstanceState.getInt("String_Node_Str");
  }
 else {
    punch1=getIntent().getExtras().getInt("String_Node_Str");
    punch2=getIntent().getExtras().getInt("String_Node_Str");
  }
  Log.d(TAG,"String_Node_Str" + punch1);
  Log.d(TAG,"String_Node_Str" + punch2);
  updateUi(punch1,punch2);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    BitmapDrawable bg=(BitmapDrawable)getResources().getDrawable(R.drawable.bg_striped);
    bg.setTileModeXY(Shader.TileMode.REPEAT,Shader.TileMode.REPEAT);
    getSupportActionBar().setBackgroundDrawable(bg);
    BitmapDrawable bgSplit=(BitmapDrawable)getResources().getDrawable(R.drawable.bg_striped_split_img);
    bgSplit.setTileModeXY(Shader.TileMode.REPEAT,Shader.TileMode.REPEAT);
    getSupportActionBar().setSplitBackgroundDrawable(bgSplit);
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  if (enableLog)   Log.d(TAG,"String_Node_Str");
  super.onCreate(savedInstanceState);
  setContentView(R.layout.punch_pair_editor);
  int punch1;
  int punch2;
  if (savedInstanceState != null) {
    punch1=savedInstanceState.getInt("String_Node_Str");
    punch2=savedInstanceState.getInt("String_Node_Str");
  }
 else {
    punch1=getIntent().getExtras().getInt("String_Node_Str");
    punch2=getIntent().getExtras().getInt("String_Node_Str");
  }
  if (enableLog)   Log.d(TAG,"String_Node_Str" + punch1);
  if (enableLog)   Log.d(TAG,"String_Node_Str" + punch2);
  updateUi(punch1,punch2);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    BitmapDrawable bg=(BitmapDrawable)getResources().getDrawable(R.drawable.bg_striped);
    bg.setTileModeXY(Shader.TileMode.REPEAT,Shader.TileMode.REPEAT);
    getSupportActionBar().setBackgroundDrawable(bg);
    BitmapDrawable bgSplit=(BitmapDrawable)getResources().getDrawable(R.drawable.bg_striped_split_img);
    bgSplit.setTileModeXY(Shader.TileMode.REPEAT,Shader.TileMode.REPEAT);
    getSupportActionBar().setSplitBackgroundDrawable(bgSplit);
  }
}
Program: 24633
Project: 24633
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  Log.d(TAG,"String_Node_Str" + item);
  Log.d(TAG,"String_Node_Str" + item.getItemId());
switch (item.getItemId()) {
case R.id.menuSave:
    updateDatabase();
  setResult(RESULT_OK);
finish();
return true;
case android.R.id.home:
case R.id.menuCancel:
setResult(RESULT_CANCELED);
finish();
return true;
case R.id.remove_in:
removePunches(RemoveOption.IN_TIME);
setResult(RESULT_OK);
finish();
return true;
case R.id.remove_both:
removePunches(RemoveOption.BOTH);
setResult(RESULT_OK);
finish();
return true;
case R.id.remove_out:
removePunches(RemoveOption.OUT_TIME);
setResult(RESULT_OK);
finish();
return true;
case R.id.RemoveMenu:
return false;
default :
return super.onOptionsItemSelected(item);
}
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  if (enableLog)   Log.d(TAG,"String_Node_Str" + item);
  if (enableLog)   Log.d(TAG,"String_Node_Str" + item.getItemId());
switch (item.getItemId()) {
case R.id.menuSave:
    updateDatabase();
  setResult(RESULT_OK);
finish();
return true;
case android.R.id.home:
case R.id.menuCancel:
setResult(RESULT_CANCELED);
finish();
return true;
case R.id.remove_in:
removePunches(RemoveOption.IN_TIME);
setResult(RESULT_OK);
finish();
return true;
case R.id.remove_both:
removePunches(RemoveOption.BOTH);
setResult(RESULT_OK);
finish();
return true;
case R.id.remove_out:
removePunches(RemoveOption.OUT_TIME);
setResult(RESULT_OK);
finish();
return true;
case R.id.RemoveMenu:
return false;
default :
return super.onOptionsItemSelected(item);
}
}
Program: 24634
Project: 24634
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  Log.d(TAG,"String_Node_Str" + item);
  Log.d(TAG,"String_Node_Str" + item.getItemId());
switch (item.getItemId()) {
case R.id.menu_insert:
    Intent newIntent=new Intent().setClass(this,NewPunchActivity.class);
  newIntent.putExtra("String_Node_Str",jobId);
newIntent.putExtra("String_Node_Str",date);
startActivityForResult(newIntent,NewPunchActivity.NEW_PUNCH);
return true;
case android.R.id.home:
setResult(RESULT_OK);
finish();
return true;
default :
return super.onOptionsItemSelected(item);
}
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  if (enableLog)   Log.d(TAG,"String_Node_Str" + item);
  if (enableLog)   Log.d(TAG,"String_Node_Str" + item.getItemId());
switch (item.getItemId()) {
case R.id.menu_insert:
    Intent newIntent=new Intent().setClass(this,NewPunchActivity.class);
  newIntent.putExtra("String_Node_Str",jobId);
newIntent.putExtra("String_Node_Str",date);
startActivityForResult(newIntent,NewPunchActivity.NEW_PUNCH);
return true;
case android.R.id.home:
setResult(RESULT_OK);
finish();
return true;
default :
return super.onOptionsItemSelected(item);
}
}
Program: 24635
Project: 24635
Buggy source:
public Duration getTime(){
  Duration dur=new Duration(0);
  for (  PunchPair pp : listOfPunchPairs) {
    dur=dur.plus(pp.getInterval().toDuration());
  }
  return dur;
}

Fixed version (ground truth):
public Duration getTime(){
  Duration dur=new Duration(0);
  for (  PunchPair pp : listOfPunchPairs) {
    if (enableLog)     Log.d(TAG,"String_Node_Str" + pp.getInterval().toDurationMillis());
    dur=dur.plus(pp.getInterval().toDuration());
  }
  return dur;
}
Program: 24636
Project: 24636
Buggy source:
public void generatePunchPair(){
  listOfPunchPairs.clear();
  List<Punch> punches;
  List<Integer> tasks=gTaskTable.getTasks();
  Log.d(TAG,"String_Node_Str" + tasks.size());
  for (  Integer curTask : tasks) {
    punches=gTaskTable.getPunchesForKey(curTask);
    Collections.sort(punches);
    Log.d(TAG,"String_Node_Str" + curTask);
    for (int i=0; i < punches.size(); i+=2) {
      Punch inTime=punches.get(i);
      if (i < punches.size() - 1) {
        Punch outTime=punches.get(i + 1);
        listOfPunchPairs.add(new PunchPair(inTime,outTime));
      }
 else {
        listOfPunchPairs.add(new PunchPair(inTime,null));
      }
    }
  }
  sort();
  notifyDataSetChanged();
}

Fixed version (ground truth):
public void generatePunchPair(){
  listOfPunchPairs.clear();
  List<Punch> punches;
  List<Integer> tasks=gTaskTable.getTasks();
  if (enableLog)   Log.d(TAG,"String_Node_Str" + tasks.size());
  for (  Integer curTask : tasks) {
    punches=gTaskTable.getPunchesForKey(curTask);
    Collections.sort(punches);
    if (enableLog)     Log.d(TAG,"String_Node_Str" + curTask);
    for (int i=0; i < punches.size(); i+=2) {
      Punch inTime=punches.get(i);
      if (i < punches.size() - 1) {
        Punch outTime=punches.get(i + 1);
        listOfPunchPairs.add(new PunchPair(inTime,outTime));
      }
 else {
        listOfPunchPairs.add(new PunchPair(inTime,null));
      }
    }
  }
  sort();
  notifyDataSetChanged();
}
Program: 24637
Project: 24637
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  Log.d(TAG,"String_Node_Str" + item);
  Log.d(TAG,"String_Node_Str" + item.getItemId());
switch (item.getItemId()) {
case R.id.menu_insert:
    Intent newIntent=new Intent().setClass(this,NewPunchActivity.class);
  newIntent.putExtra("String_Node_Str",jobId.getID());
startActivityForResult(newIntent,NewPunchActivity.NEW_PUNCH);
return true;
case R.id.menu_navigate_today:
payHolder.generate();
setContentView(new PayPeriodSummaryView(this,getPunchesByDate()));
return true;
case R.id.menu_navigate_back:
payHolder.moveBackwards();
setContentView(new PayPeriodSummaryView(this,getPunchesByDate()));
return true;
case R.id.menu_navigate_forward:
payHolder.moveForwards();
setContentView(new PayPeriodSummaryView(this,getPunchesByDate()));
return true;
case android.R.id.home:
default :
return super.onOptionsItemSelected(item);
}
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  Log.d(TAG,"String_Node_Str" + item);
  Log.d(TAG,"String_Node_Str" + item.getItemId());
switch (item.getItemId()) {
case R.id.menu_insert:
    Intent newIntent=new Intent().setClass(this,NewPunchActivity.class);
  newIntent.putExtra("String_Node_Str",jobId.getID());
newIntent.putExtra("String_Node_Str",DateTime.now().getMillis());
startActivityForResult(newIntent,NewPunchActivity.NEW_PUNCH);
return true;
case R.id.menu_navigate_today:
payHolder.generate();
setContentView(new PayPeriodSummaryView(this,getPunchesByDate()));
return true;
case R.id.menu_navigate_back:
payHolder.moveBackwards();
setContentView(new PayPeriodSummaryView(this,getPunchesByDate()));
return true;
case R.id.menu_navigate_forward:
payHolder.moveForwards();
setContentView(new PayPeriodSummaryView(this,getPunchesByDate()));
return true;
case android.R.id.home:
default :
return super.onOptionsItemSelected(item);
}
}
Program: 24639
Project: 24639
Buggy source:
private void updateDatabase(){
  int hour, min;
  TimePicker inTime=(TimePicker)findViewById(R.id.TimePicker1);
  Spinner taskSpinnerIn=(Spinner)findViewById(R.id.taskSpinnerIn);
  inTime.clearFocus();
  hour=inTime.getCurrentHour();
  min=inTime.getCurrentMinute();
  Task inTask=tasks.get(taskSpinnerIn.getSelectedItemPosition());
  DateTime now=new DateTime();
  DateTime date1=new DateTime(now.getYear(),now.getMonthOfYear(),now.getDayOfMonth(),hour,min);
  Chronos chrono=new Chronos(this);
  Job thisJob=null;
  List<Job> jobs=chrono.getJobs();
  for (  Job job : jobs) {
    if (job.getID() == jobID)     thisJob=job;
  }
  Punch newPunch=new Punch(thisJob,inTask,date1);
  chrono.insertPunch(newPunch);
  chrono.close();
}

Fixed version (ground truth):
private void updateDatabase(){
  int hour, min;
  TimePicker inTime=(TimePicker)findViewById(R.id.TimePicker1);
  Spinner taskSpinnerIn=(Spinner)findViewById(R.id.taskSpinnerIn);
  inTime.clearFocus();
  hour=inTime.getCurrentHour();
  min=inTime.getCurrentMinute();
  Task inTask=tasks.get(taskSpinnerIn.getSelectedItemPosition());
  DateTime date1=new DateTime(date.getYear(),date.getMonthOfYear(),date.getDayOfMonth(),hour,min);
  Chronos chrono=new Chronos(this);
  Job thisJob=null;
  List<Job> jobs=chrono.getJobs();
  for (  Job job : jobs) {
    if (job.getID() == jobID)     thisJob=job;
  }
  Punch newPunch=new Punch(thisJob,inTask,date1);
  Log.d(TAG,"String_Node_Str" + newPunch.getTime().getMillis());
  chrono.insertPunch(newPunch);
  chrono.close();
}
Program: 24640
Project: 24640
Buggy source:
protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (requestCode == ClockActivity.FROM_CLOCK_ACTIVITY) {
    if (resultCode == RESULT_OK) {
      setContentView(new DatePairView(this,new DateTime(date)));
    }
  }
 else   if (requestCode == NewPunchActivity.NEW_PUNCH) {
    if (resultCode == RESULT_OK) {
      setContentView(new DatePairView(this,new DateTime(date)));
    }
  }
}

Fixed version (ground truth):
protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (requestCode == ClockActivity.FROM_CLOCK_ACTIVITY) {
    setContentView(new DatePairView(this,new DateTime(date)));
  }
 else   if (requestCode == NewPunchActivity.NEW_PUNCH) {
    setContentView(new DatePairView(this,new DateTime(date)));
  }
}
Program: 24641
Project: 24641
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  Log.d(TAG,"String_Node_Str" + item);
  Log.d(TAG,"String_Node_Str" + item.getItemId());
switch (item.getItemId()) {
case R.id.menu_insert:
    Intent newIntent=new Intent().setClass(this,NewPunchActivity.class);
  newIntent.putExtra("String_Node_Str",jobId);
startActivityForResult(newIntent,NewPunchActivity.NEW_PUNCH);
return true;
case android.R.id.home:
setResult(RESULT_OK);
finish();
return true;
default :
return super.onOptionsItemSelected(item);
}
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  Log.d(TAG,"String_Node_Str" + item);
  Log.d(TAG,"String_Node_Str" + item.getItemId());
switch (item.getItemId()) {
case R.id.menu_insert:
    Intent newIntent=new Intent().setClass(this,NewPunchActivity.class);
  newIntent.putExtra("String_Node_Str",jobId);
newIntent.putExtra("String_Node_Str",date);
startActivityForResult(newIntent,NewPunchActivity.NEW_PUNCH);
return true;
case android.R.id.home:
setResult(RESULT_OK);
finish();
return true;
default :
return super.onOptionsItemSelected(item);
}
}
Program: 24642
Project: 24642
Buggy source:
public List<Punch> getPunchesByJobAndDate(Job jobId,DateTime date){
  List<Punch> punches=new LinkedList<Punch>();
  try {
    Dao<Punch,String> punchDao=getPunchDao();
    Dao<Task,String> taskDAO=getTaskDao();
    Dao<Job,String> jobDAO=getJobDao();
    DateTime startOfPP=jobId.getStartOfPayPeriod();
    int days=(int)(date.getMillis() - startOfPP.getMillis()) / 1000 / 60/ 60/ 24;
    DateTime startOfDay=startOfPP.plusDays(days);
    DateTime endOfDay=startOfDay.plusDays(1);
    Log.d(TAG,"String_Node_Str" + days);
    Log.d(TAG,"String_Node_Str" + startOfDay.getMillis());
    Log.d(TAG,"String_Node_Str" + endOfDay.getMillis());
    QueryBuilder<Punch,String> queryBuilder=punchDao.queryBuilder();
    queryBuilder.where().eq(Job.JOB_FIELD_NAME,jobId.getID()).and().gt(Punch.TIME_OF_PUNCH,startOfDay.getMillis()).and().le(Punch.TIME_OF_PUNCH,endOfDay.getMillis());
    PreparedQuery<Punch> preparedQuery=queryBuilder.prepare();
    punches=punchDao.query(preparedQuery);
    Log.d(TAG,"String_Node_Str" + punches.size());
    for (    Punch work : punches) {
      taskDAO.refresh(work.getTask());
      jobDAO.refresh(work.getJobNumber());
    }
  }
 catch (  SQLException e) {
    e.printStackTrace();
    Log.e(TAG,e.getMessage());
  }
  return punches;
}

Fixed version (ground truth):
public List<Punch> getPunchesByJobAndDate(Job jobId,DateTime date){
  List<Punch> punches=new LinkedList<Punch>();
  try {
    Dao<Punch,String> punchDao=getPunchDao();
    Dao<Task,String> taskDAO=getTaskDao();
    Dao<Job,String> jobDAO=getJobDao();
    DateTime startOfPP=jobId.getStartOfPayPeriod();
    DateTime startOfDay=new DateTime(date.getYear(),date.getMonthOfYear(),date.getDayOfMonth(),startOfPP.getHourOfDay(),startOfPP.getMinuteOfHour());
    DateTime endOfDay=startOfDay.plusDays(1);
    Log.d(TAG,"String_Node_Str" + startOfDay.getMillis());
    Log.d(TAG,"String_Node_Str" + endOfDay.getMillis());
    QueryBuilder<Punch,String> queryBuilder=punchDao.queryBuilder();
    queryBuilder.where().eq(Job.JOB_FIELD_NAME,jobId.getID()).and().between(Punch.TIME_OF_PUNCH,startOfDay.getMillis(),endOfDay.getMillis());
    PreparedQuery<Punch> preparedQuery=queryBuilder.prepare();
    punches=punchDao.query(preparedQuery);
    Log.d(TAG,"String_Node_Str" + punches.size());
    for (    Punch work : punches) {
      taskDAO.refresh(work.getTask());
      jobDAO.refresh(work.getJobNumber());
    }
  }
 catch (  SQLException e) {
    e.printStackTrace();
    Log.e(TAG,e.getMessage());
  }
  return punches;
}
Program: 24643
Project: 24643
Buggy source:
public void dropAndTest(){
  try {
    final int numberOfTasks=3;
    final int jobNumber=3;
    Dao<Punch,String> punchDao=getPunchDao();
    Dao<Task,String> taskDAO=getTaskDao();
    Dao<Job,String> jobDAO=getJobDao();
    Dao<Note,String> noteDAO=getNoteDao();
    DateTime jobMidnight=DateTime.now().withDayOfWeek(1).minusWeeks(2);
    Job currentJob=new Job("String_Node_Str",10,jobMidnight.toDateTime(),PayPeriodDuration.TWO_WEEKS);
    currentJob.setDoubletimeThreshold(60);
    currentJob.setOvertimeThreshold(40);
    currentJob.setOvertimeEnabled(true);
    jobDAO.create(currentJob);
    LinkedList<Task> tasks=new LinkedList<Task>();
    for (int i=0; i < numberOfTasks; i++) {
      Task newTask=new Task(currentJob,i,"String_Node_Str" + (i + 1));
      tasks.add(newTask);
      taskDAO.create(newTask);
    }
    DateTime iTime=new DateTime();
    Random rand=new Random();
    for (int i=0; i < 3; i++) {
      for (int j=0; j < 15; j++) {
        DateTime tempTime=iTime.minusHours(j);
        tempTime=tempTime.minusMinutes(rand.nextInt() % 60);
        Punch temp=new Punch(currentJob,tasks.get(j % numberOfTasks),tempTime);
        Note newNote=new Note(tempTime,currentJob,"String_Node_Str" + String.valueOf(j + 1));
        newNote.setTask(tasks.get(j % numberOfTasks));
        noteDAO.create(newNote);
        punchDao.create(temp);
      }
      iTime=iTime.plusDays(1);
    }
  }
 catch (  SQLException e) {
    Log.e(TAG,e.getMessage());
  }
catch (  Exception e) {
    Log.e(TAG,e.getMessage());
  }
}

Fixed version (ground truth):
public void dropAndTest(){
  try {
    final int numberOfTasks=3;
    final int jobNumber=3;
    Dao<Punch,String> punchDao=getPunchDao();
    Dao<Task,String> taskDAO=getTaskDao();
    Dao<Job,String> jobDAO=getJobDao();
    Dao<Note,String> noteDAO=getNoteDao();
    DateTime jobMidnight=DateTime.now().withDayOfWeek(1).minusWeeks(2);
    Job currentJob=new Job("String_Node_Str",10,jobMidnight.toDateTime(),PayPeriodDuration.TWO_WEEKS);
    currentJob.setDoubletimeThreshold(60);
    currentJob.setOvertimeThreshold(40);
    currentJob.setOvertimeEnabled(true);
    jobDAO.create(currentJob);
    LinkedList<Task> tasks=new LinkedList<Task>();
    for (int i=0; i < numberOfTasks; i++) {
      Task newTask=new Task(currentJob,i,"String_Node_Str" + (i + 1));
      tasks.add(newTask);
      taskDAO.create(newTask);
    }
    DateTime iTime=new DateTime();
    Random rand=new Random();
    for (int i=0; i < 3; i++) {
      for (int j=0; j < 5; j++) {
        DateTime tempTime=iTime.minusHours(j);
        tempTime=tempTime.minusMinutes(rand.nextInt() % 60);
        Punch temp=new Punch(currentJob,tasks.get(j % numberOfTasks),tempTime);
        Note newNote=new Note(tempTime,currentJob,"String_Node_Str" + String.valueOf(j + 1));
        newNote.setTask(tasks.get(j % numberOfTasks));
        noteDAO.create(newNote);
        punchDao.create(temp);
      }
      iTime=iTime.plusDays(1);
    }
  }
 catch (  SQLException e) {
    Log.e(TAG,e.getMessage());
  }
catch (  Exception e) {
    Log.e(TAG,e.getMessage());
  }
}
Program: 24644
Project: 24644
Buggy source:
private void createTable(Job inJob,int days,DateTime start){
  listOfDays=new LinkedList<DateTime>();
  gMap=new HashMap<DateTime,List<Punch>>();
  gPayPeriod=new PayPeriodHolder(inJob);
  for (int i=0; i < days; i++) {
    DateTime key=start.plusDays(i);
    LinkedList<Punch> list=new LinkedList<Punch>();
    gMap.put(key,list);
    listOfDays.add(key);
    System.out.println("String_Node_Str" + key);
  }
}

Fixed version (ground truth):
private void createTable(Job inJob,int days,DateTime start){
  listOfDays=new LinkedList<DateTime>();
  gMap=new HashMap<DateTime,List<Punch>>();
  gPayPeriod=new PayPeriodHolder(inJob);
  for (int i=0; i < days; i++) {
    DateTime key=start.plusDays(i);
    LinkedList<Punch> list=new LinkedList<Punch>();
    gMap.put(key,list);
    listOfDays.add(key);
  }
}
Program: 24645
Project: 24645
Buggy source:
public List<Punch> getPunchesByDay(DateTime key){
  Duration dur=new Duration(startOfTable,key);
  if (key.getSecondOfDay() >= startOfTable.getSecondOfDay()) {
    key=startOfTable.plusDays((int)dur.getStandardDays());
  }
 else {
    key=startOfTable.plusDays((int)dur.getStandardDays() - 1);
  }
  return ((List)gMap.get(key));
}

Fixed version (ground truth):
public List<Punch> getPunchesByDay(DateTime key){
  Duration dur=new Duration(startOfTable,key);
  key=startOfTable.plusDays((int)dur.getStandardDays());
  return ((List)gMap.get(key));
}
Program: 24646
Project: 24646
Buggy source:
public PunchTable(DateTime start,PayPeriodDuration dur,Job inJob){
  startOfTable=start;
  int days;
switch (dur) {
case ONE_WEEK:
    days=7;
  break;
case TWO_WEEKS:
days=14;
break;
case THREE_WEEKS:
days=3 * 7;
break;
case FOUR_WEEKS:
days=4 * 7;
break;
default :
days=14;
break;
}
try {
Log.d(TAG,"String_Node_Str" + days);
}
 catch (Exception e) {
System.out.println("String_Node_Str" + days);
}
createTable(inJob,days,start);
}

Fixed version (ground truth):
public PunchTable(DateTime start,PayPeriodDuration dur,Job inJob){
  startOfTable=start;
  int days;
switch (dur) {
case ONE_WEEK:
    days=7;
  break;
case TWO_WEEKS:
days=14;
break;
case THREE_WEEKS:
days=3 * 7;
break;
case FOUR_WEEKS:
days=4 * 7;
break;
default :
days=14;
break;
}
try {
Log.d(TAG,"String_Node_Str" + days);
}
 catch (Exception e) {
try {
Log.d(TAG,"String_Node_Str" + days);
Log.d(TAG,e.getMessage());
}
 catch (Exception e2) {
System.out.println("String_Node_Str" + days);
System.out.println(e.getMessage());
}
}
createTable(inJob,days,start);
}
Program: 24647
Project: 24647
Buggy source:
public void insert(Punch value){
  DateTime key=value.getTime();
  Duration dur=new Duration(startOfTable,key);
  key=startOfTable.plusDays((int)dur.getStandardDays());
  System.out.println("String_Node_Str" + key.getMillis());
  LinkedList<Punch> list=(LinkedList)gMap.get(key);
  list.add(value);
  Collections.sort(list);
}

Fixed version (ground truth):
public void insert(Punch value){
  DateTime key=value.getTime();
  Duration dur=new Duration(startOfTable,key);
  key=startOfTable.plusDays((int)dur.getStandardDays());
  LinkedList<Punch> list=(LinkedList)gMap.get(key);
  list.add(value);
  Collections.sort(list);
}
Program: 24648
Project: 24648
Buggy source:
@Override public void onItemClick(AdapterView<?> adapterView,View view,int position,long id){
  Log.d(TAG,"String_Node_Str" + position);
  Intent newIntent=new Intent().setClass(parent,DateViewerActivity.class);
  newIntent.putExtra("String_Node_Str",adapter.getDate(position).getMillis());
  parent.startActivityForResult(newIntent,ClockActivity.FROM_CLOCK_ACTIVITY);
}

Fixed version (ground truth):
@Override public void onItemClick(AdapterView<?> adapterView,View view,int position,long id){
  Log.d(TAG,"String_Node_Str" + position);
  Intent newIntent=new Intent().setClass(parent,DateViewerActivity.class);
  newIntent.putExtra("String_Node_Str",adapter.getDate(position).getMillis());
  parent.startActivityForResult(newIntent,ClockActivity.FROM_CLOCK_ACTIVITY);
  Log.d(TAG,"String_Node_Str" + adapter.getDate(position).getMillis());
}
Program: 24649
Project: 24649
Buggy source:
@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  if (enableLog)   Log.d(TAG,"String_Node_Str" + requestCode);
  if (enableLog)   Log.d(TAG,"String_Node_Str" + resultCode);
  if (enableLog)   Log.d(TAG,"String_Node_Str" + getSupportActionBar().getSelectedNavigationIndex());
  if (requestCode == FROM_CLOCK_ACTIVITY) {
    Chronos chronos=new Chronos(this);
    localPunchTable=chronos.getAllPunchesForThisPayPeriodByJob(chronos.getJobs().get(0));
    chronos.close();
  }
 else   if (requestCode == NewPunchActivity.NEW_PUNCH) {
    if (enableLog)     Log.d(TAG,"String_Node_Str");
    Chronos chronos=new Chronos(this);
    localPunchTable=chronos.getAllPunchesForThisPayPeriodByJob(chronos.getJobs().get(0));
    chronos.close();
  }
  if (getSupportActionBar().getSelectedNavigationIndex() == 0) {
    setContentView(new DatePairView(this,localPunchTable.getPunchesByDay(new DateTime())));
  }
 else   if (getSupportActionBar().getSelectedNavigationIndex() == 1) {
    setContentView(new PayPeriodSummaryView(this,getPunchesByDate()));
  }
}

Fixed version (ground truth):
@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  if (enableLog)   Log.d(TAG,"String_Node_Str" + requestCode);
  if (enableLog)   Log.d(TAG,"String_Node_Str" + resultCode);
  if (enableLog)   Log.d(TAG,"String_Node_Str" + getSupportActionBar().getSelectedNavigationIndex());
  if (requestCode == FROM_CLOCK_ACTIVITY) {
    Chronos chronos=new Chronos(this);
    localPunchTable=chronos.getAllPunchesForThisPayPeriodByJob(chronos.getJobs().get(0));
    chronos.close();
  }
 else   if (requestCode == NewPunchActivity.NEW_PUNCH) {
    if (enableLog)     Log.d(TAG,"String_Node_Str");
    Chronos chronos=new Chronos(this);
    localPunchTable=chronos.getAllPunchesForThisPayPeriodByJob(chronos.getJobs().get(0));
    chronos.close();
  }
  if (getSupportActionBar().getSelectedNavigationIndex() == 0) {
    setContentView(new DatePairView(this,new DateTime()));
  }
 else   if (getSupportActionBar().getSelectedNavigationIndex() == 1) {
    setContentView(new PayPeriodSummaryView(this,getPunchesByDate()));
  }
}
Program: 24650
Project: 24650
Buggy source:
public TodayAdapterPair(Context context,List<Punch> listOfPunches){
  gContext=context;
  if (listOfPunches != null)   for (  Punch temp : listOfPunches) {
    Task tempTask=temp.getTask();
    gTaskTable.insert(tempTask,temp);
  }
  generatePunchPair();
}

Fixed version (ground truth):
public TodayAdapterPair(Context context,List<Punch> listOfPunches){
  gContext=context;
  for (  Punch p : listOfPunches) {
    Log.d(TAG,"String_Node_Str" + p.getTime());
  }
  if (listOfPunches != null)   for (  Punch temp : listOfPunches) {
    Task tempTask=temp.getTask();
    gTaskTable.insert(tempTask,temp);
  }
  generatePunchPair();
}
Program: 24651
Project: 24651
Buggy source:
public void insertPunch(Punch punch){
  try {
    Dao<Punch,String> punchDao=getPunchDao();
    punchDao.update(punch);
  }
 catch (  SQLException e) {
    if (enableLog)     Log.e(TAG,"String_Node_Str" + e.getMessage());
    e.getCause();
  }
}

Fixed version (ground truth):
public void insertPunch(Punch punch){
  try {
    Dao<Punch,String> punchDao=getPunchDao();
    punchDao.createOrUpdate(punch);
  }
 catch (  SQLException e) {
    if (enableLog)     Log.e(TAG,"String_Node_Str" + e.getMessage());
    e.getCause();
  }
}
Program: 24652
Project: 24652
Buggy source:
public PunchTable getAllPunchesForThisPayPeriodByJob(Job jobId){
  PayPeriodHolder pph=new PayPeriodHolder(jobId);
  DateTime startOfPP=pph.getStartOfPayPeriod().toDateTime();
  DateTime endOfPP=pph.getEndOfPayPeriod().toDateTime();
  return getAllPunchesForPayPeriodByJob(jobId,startOfPP,endOfPP);
}

Fixed version (ground truth):
public PunchTable getAllPunchesForThisPayPeriodByJob(Job jobId){
  PayPeriodHolder pph=new PayPeriodHolder(jobId);
  DateTime startOfPP=pph.getStartOfPayPeriod().toDateTime();
  DateTime endOfPP=pph.getEndOfPayPeriod().toDateTime();
  Log.d(TAG,"String_Node_Str" + startOfPP);
  Log.d(TAG,"String_Node_Str" + endOfPP);
  return getAllPunchesForPayPeriodByJob(jobId,startOfPP,endOfPP);
}
Program: 24653
Project: 24653
Buggy source:
public DatePairView(SherlockActivity prnt,List<Punch> punches){
  super(prnt.getApplicationContext());
  parent=prnt;
  if (enableLog)   Log.d(TAG,"String_Node_Str");
  Chronos chrono=new Chronos(parent);
  if (enableLog)   Log.d(TAG,"String_Node_Str" + chrono.getJobs().size());
  Job thisJob=chrono.getJobs().get(0);
  chrono.close();
  adapter=new TodayAdapterPair(parent,punches);
  createUI(adapter,thisJob);
}

Fixed version (ground truth):
public DatePairView(SherlockActivity prnt,List<Punch> punches){
  super(prnt.getApplicationContext());
  parent=prnt;
  if (enableLog)   Log.d(TAG,"String_Node_Str");
  Chronos chrono=new Chronos(parent);
  Job thisJob=chrono.getJobs().get(0);
  chrono.close();
  adapter=new TodayAdapterPair(parent,punches);
  createUI(adapter,thisJob);
}
Program: 24655
Project: 24655
Buggy source:
public void onResume(){
  super.onResume();
}

Fixed version (ground truth):
public void onResume(){
  StaticFunctions.fixMidnight(prefs.getStartOfThisPP(getApplicationContext()),prefs.getWeeksInPP(getApplicationContext()),getApplicationContext());
  super.onResume();
}
Program: 24656
Project: 24656
Buggy source:
public void fixMidights(){
  boolean prevNeedFix=false;
  for (int i=0; i < _days.size(); i++) {
    boolean[] needFix=_days.get(i).checkForMidnight();
    if (needFix[Defines.REGULAR_TIME] == true) {
      if (prevNeedFix == false) {
        Day temp=_days.get(i);
        int[] dayInfo=temp.getDay();
        GregorianCalendar cal=new GregorianCalendar(dayInfo[0],dayInfo[1],dayInfo[2]);
        cal.add(GregorianCalendar.DAY_OF_YEAR,1);
        Punch quickFix=new Punch(cal.getTimeInMillis() - 1000,Defines.OUT,-1,Defines.REGULAR_TIME);
        quickFix.setNeedToUpdate(true);
        temp.add(quickFix);
        _days.get(i).updateDay();
        quickFix=new Punch(cal.getTimeInMillis() + 1000,Defines.IN,-1,Defines.REGULAR_TIME);
        quickFix.setNeedToUpdate(true);
        if (i + 1 < _days.size()) {
          _days.get(i + 1).add(quickFix);
          _days.get(i + 1).updateDay();
        }
      }
 else {
        Day temp=_days.get(i);
        int[] dayInfo=temp.getDay();
        GregorianCalendar cal=new GregorianCalendar(dayInfo[0],dayInfo[1],dayInfo[2]);
        cal.add(GregorianCalendar.DAY_OF_YEAR,1);
        Punch quickFix=new Punch(cal.getTimeInMillis() - 1000,Defines.OUT,-1,Defines.REGULAR_TIME);
        quickFix.setNeedToUpdate(true);
        temp.add(quickFix);
        _days.get(i).updateDay();
      }
    }
    prevNeedFix=needFix[Defines.REGULAR_TIME];
    for (int j=1; j < Defines.MAX_CLOCK_OPT; j++) {
      if (needFix[j] == true) {
        Day temp=_days.get(i);
        int[] dayInfo=temp.getDay();
        GregorianCalendar cal=new GregorianCalendar(dayInfo[0],dayInfo[1],dayInfo[2]);
        cal.add(GregorianCalendar.DAY_OF_YEAR,1);
        Punch quickFix=new Punch(cal.getTimeInMillis() - 1000,Defines.OUT,-1,j);
        quickFix.setNeedToUpdate(true);
        temp.add(quickFix);
        _days.get(i).updateDay();
      }
    }
  }
}

Fixed version (ground truth):
public void fixMidights(){
  long dayOfWeek=(_start.getTimeInMillis() - GregorianCalendar.getInstance().getTimeInMillis()) / Defines.MS_TO_SECOND / 60/ 60/ 24;
  for (int i=0; i < dayOfWeek; i++) {
    long[] times=_days.get(i).getArrayOfTime();
    if (times[Defines.REGULAR_TIME] < 0) {
      Day temp=_days.get(i);
      int[] dayInfo=temp.getDay();
      GregorianCalendar cal=new GregorianCalendar(dayInfo[0],dayInfo[1],dayInfo[2]);
      cal.add(GregorianCalendar.DAY_OF_YEAR,1);
      Punch quickFix=new Punch(cal.getTimeInMillis() - 1000,Defines.OUT,-1,Defines.REGULAR_TIME);
      quickFix.setNeedToUpdate(true);
      temp.add(quickFix);
      _days.get(i).updateDay();
    }
  }
}
Program: 24657
Project: 24657
Buggy source:
public static void fixMidnight(int[] startOfThisPP,int weeksInPP,Context context){
  startOfThisPP=Chronos.getPP(startOfThisPP,weeksInPP);
  GregorianCalendar cal=new GregorianCalendar(startOfThisPP[0],startOfThisPP[1],startOfThisPP[2]);
  cal.add(GregorianCalendar.DAY_OF_YEAR,7 * weeksInPP);
  int[] endOfPP={cal.get(GregorianCalendar.YEAR),cal.get(GregorianCalendar.MONTH),cal.get(GregorianCalendar.DAY_OF_MONTH)};
  PayPeriod thisPP=new PayPeriod(startOfThisPP,endOfPP,context);
  thisPP.fixMidights();
}

Fixed version (ground truth):
public static void fixMidnight(int[] startOfThisPP,int weeksInPP,Context context){
  startOfThisPP=Chronos.getPP(startOfThisPP,weeksInPP);
  GregorianCalendar cal=new GregorianCalendar(startOfThisPP[0],startOfThisPP[1],startOfThisPP[2]);
  cal.add(GregorianCalendar.DAY_OF_YEAR,7 * weeksInPP);
  int[] endOfPP={cal.get(GregorianCalendar.YEAR),cal.get(GregorianCalendar.MONTH),cal.get(GregorianCalendar.DAY_OF_MONTH)};
  PayPeriod thisPP=new PayPeriod(startOfThisPP,endOfPP,context);
  thisPP.fixMidnights();
}
Program: 24658
Project: 24658
Buggy source:
public void callBack(View v){
  TimePicker timePick=(TimePicker)findViewById(R.id.TimePicker01);
  Spinner spinner=(Spinner)findViewById(R.id.spinnerType);
  int hour=timePick.getCurrentHour();
  int min=timePick.getCurrentMinute();
  cal.set(GregorianCalendar.HOUR_OF_DAY,hour);
  cal.set(GregorianCalendar.MINUTE,min);
  cal.set(GregorianCalendar.SECOND,0);
  long time=cal.getTimeInMillis();
  if (DEBUG_PRINT)   Log.d(TAG,"String_Node_Str" + cal.getTimeInMillis() + "String_Node_Str"+ hour+ "String_Node_Str"+ min);
  int actionReason=0;
  if (spinner.getSelectedItemPosition() != Spinner.INVALID_POSITION)   actionReason=(spinner.getSelectedItemPosition());
  if (DEBUG_PRINT)   Log.d(TAG,"String_Node_Str" + id);
  if (v.getId() == R.id.OkButton) {
    Intent returnIntent=new Intent();
    returnIntent.putExtra("String_Node_Str",id);
    returnIntent.putExtra("String_Node_Str",time);
    returnIntent.putExtra("String_Node_Str",actionReason);
    returnIntent.putExtra("String_Node_Str",position);
    setResult(Activity.RESULT_OK,returnIntent);
    finish();
  }
 else   if (v.getId() == R.id.CancelButton) {
    Intent returnIntent=new Intent();
    returnIntent.putExtra("String_Node_Str",id);
    setResult(Activity.RESULT_CANCELED,returnIntent);
    finish();
  }
}

Fixed version (ground truth):
public void callBack(View v){
  TimePicker timePick=(TimePicker)findViewById(R.id.TimePicker01);
  timePick.clearFocus();
  Spinner spinner=(Spinner)findViewById(R.id.spinnerType);
  int hour=timePick.getCurrentHour();
  int min=timePick.getCurrentMinute();
  cal.set(GregorianCalendar.HOUR_OF_DAY,hour);
  cal.set(GregorianCalendar.MINUTE,min);
  cal.set(GregorianCalendar.SECOND,0);
  long time=cal.getTimeInMillis();
  if (DEBUG_PRINT)   Log.d(TAG,"String_Node_Str" + cal.getTimeInMillis() + "String_Node_Str"+ hour+ "String_Node_Str"+ min);
  int actionReason=0;
  if (spinner.getSelectedItemPosition() != Spinner.INVALID_POSITION)   actionReason=(spinner.getSelectedItemPosition());
  if (DEBUG_PRINT)   Log.d(TAG,"String_Node_Str" + id);
  if (v.getId() == R.id.OkButton) {
    Intent returnIntent=new Intent();
    returnIntent.putExtra("String_Node_Str",id);
    returnIntent.putExtra("String_Node_Str",time);
    returnIntent.putExtra("String_Node_Str",actionReason);
    returnIntent.putExtra("String_Node_Str",position);
    setResult(Activity.RESULT_OK,returnIntent);
    finish();
  }
 else   if (v.getId() == R.id.CancelButton) {
    Intent returnIntent=new Intent();
    returnIntent.putExtra("String_Node_Str",id);
    setResult(Activity.RESULT_CANCELED,returnIntent);
    finish();
  }
}
Program: 24661
Project: 24661
Buggy source:
/** 
 * Sets up the controls in the dialog
 * @param SoftwarePackage The category to be updated in this dialog.
 */
private void initializeDialogReadWrite(GwtTradeoffReason tradeoffReason){
  VerticalPanel baseLayout=new VerticalPanel();
  VerticalPanel nameLayout=new VerticalPanel();
  VerticalPanel descriptionLayout=new VerticalPanel();
  HorizontalPanel buttonsLayout=new HorizontalPanel();
  this.setText(messages.editTradeoffReasonDialogBoxTitle());
  nameLayout.add(new Label(messages.editTradeoffReasonDialogBoxName()));
  nameLayout.add(this.tradeoffReasonTextBox);
  this.tradeoffReasonTextBox.setWidth("String_Node_Str");
  this.tradeoffReasonTextBox.setSize("String_Node_Str","String_Node_Str");
  this.tradeoffReasonTextBox.setText(tradeoffReason.getTradeoffreason());
  saveButton=new Button(messages.editTradeoffReasonDialogBoxOkay(),new SaveHandler(this,tradeoffReason));
  Button cancelButton=new Button(messages.editTradeoffReasonDialogBoxCancel(),new CancelHandler(this));
  saveButton.setWidth("String_Node_Str");
  cancelButton.setWidth("String_Node_Str");
  buttonsLayout.setSpacing(10);
  buttonsLayout.add(saveButton);
  buttonsLayout.add(cancelButton);
  baseLayout.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
  baseLayout.add(nameLayout);
  baseLayout.add(descriptionLayout);
  baseLayout.add(buttonsLayout);
  baseLayout.setSpacing(5);
  this.setWidget(baseLayout);
}

Fixed version (ground truth):
/** 
 * Sets up the controls in the dialog
 * @param SoftwarePackage The category to be updated in this dialog.
 */
private void initializeDialogReadWrite(GwtTradeoffReason tradeoffReason){
  VerticalPanel baseLayout=new VerticalPanel();
  VerticalPanel nameLayout=new VerticalPanel();
  VerticalPanel descriptionLayout=new VerticalPanel();
  HorizontalPanel buttonsLayout=new HorizontalPanel();
  this.setText(messages.editTradeoffReasonDialogBoxTitleReadOnly());
  nameLayout.add(this.tradeoffReasonTextBox);
  this.tradeoffReasonTextBox.setWidth("String_Node_Str");
  this.tradeoffReasonTextBox.setSize("String_Node_Str","String_Node_Str");
  this.tradeoffReasonTextBox.setText(tradeoffReason.getTradeoffreason());
  saveButton=new Button(messages.editTradeoffReasonDialogBoxOkay(),new SaveHandler(this,tradeoffReason));
  Button cancelButton=new Button(messages.editTradeoffReasonDialogBoxCancel(),new CancelHandler(this));
  saveButton.setWidth("String_Node_Str");
  cancelButton.setWidth("String_Node_Str");
  buttonsLayout.setSpacing(10);
  buttonsLayout.add(saveButton);
  buttonsLayout.add(cancelButton);
  baseLayout.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
  baseLayout.add(nameLayout);
  baseLayout.add(descriptionLayout);
  baseLayout.add(buttonsLayout);
  baseLayout.setSpacing(5);
  this.setWidget(baseLayout);
}
Program: 24662
Project: 24662
Buggy source:
/** 
 * Sets up the controls in the dialog
 * @param SoftwarePackage The category to be updated in this dialog.
 */
private void initializeDialogReadOnly(GwtTradeoffReason tradeoffReason){
  VerticalPanel baseLayout=new VerticalPanel();
  VerticalPanel nameLayout=new VerticalPanel();
  VerticalPanel descriptionLayout=new VerticalPanel();
  HorizontalPanel buttonsLayout=new HorizontalPanel();
  this.setText(messages.editTradeoffReasonDialogBoxTitleReadOnly());
  nameLayout.add(new Label(messages.editTradeoffReasonDialogBoxName()));
  nameLayout.add(this.tradeoffReasonTextBox);
  this.tradeoffReasonTextBox.setWidth("String_Node_Str");
  this.tradeoffReasonTextBox.setSize("String_Node_Str","String_Node_Str");
  this.tradeoffReasonTextBox.setText(tradeoffReason.getTradeoffreason());
  Button okayButton=new Button(messages.editTradeoffReasonDialogBoxOkay(),new CancelHandler(this));
  okayButton.setWidth("String_Node_Str");
  buttonsLayout.setSpacing(10);
  buttonsLayout.add(okayButton);
  baseLayout.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
  baseLayout.add(nameLayout);
  baseLayout.add(descriptionLayout);
  baseLayout.add(buttonsLayout);
  baseLayout.setSpacing(5);
  this.setWidget(baseLayout);
}

Fixed version (ground truth):
/** 
 * Sets up the controls in the dialog
 * @param SoftwarePackage The category to be updated in this dialog.
 */
private void initializeDialogReadOnly(GwtTradeoffReason tradeoffReason){
  VerticalPanel baseLayout=new VerticalPanel();
  VerticalPanel nameLayout=new VerticalPanel();
  VerticalPanel descriptionLayout=new VerticalPanel();
  HorizontalPanel buttonsLayout=new HorizontalPanel();
  this.setText(messages.editTradeoffReasonDialogBoxTitleReadOnly());
  nameLayout.add(this.tradeoffReasonTextBox);
  this.tradeoffReasonTextBox.setWidth("String_Node_Str");
  this.tradeoffReasonTextBox.setSize("String_Node_Str","String_Node_Str");
  this.tradeoffReasonTextBox.setText(tradeoffReason.getTradeoffreason());
  Button okayButton=new Button(messages.editTradeoffReasonDialogBoxOkay(),new CancelHandler(this));
  okayButton.setWidth("String_Node_Str");
  buttonsLayout.setSpacing(10);
  buttonsLayout.add(okayButton);
  baseLayout.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
  baseLayout.add(nameLayout);
  baseLayout.add(descriptionLayout);
  baseLayout.add(buttonsLayout);
  baseLayout.setSpacing(5);
  this.setWidget(baseLayout);
}
Program: 24663
Project: 24663
Buggy source:
public CreateProjectDialog(int projectId,String projectName,int leadRequirementId,List<GwtProject> projects,List<GwtUser> users,ProjectGrid caller,int casesId){
  super();
  this.listOfProjects=projects;
  this.listOfUsers=users;
  this.caller=caller;
  this.initializeDialog(new GwtProject(projectId,projectName,leadRequirementId,casesId));
}

Fixed version (ground truth):
public CreateProjectDialog(int projectId,String projectName,int leadRequirementId,List<GwtProject> projects,List<GwtUser> users,ProjectGrid caller,int casesId){
  super();
  this.listOfProjects=projects;
  this.listOfUsers=users;
  this.caller=caller;
  edit=true;
  this.initializeDialog(new GwtProject(projectId,projectName,leadRequirementId,casesId));
}