nus-yam/ex-repair huggingface dataset:
Program: 33711
Project: 33711
Buggy source:
public static ArrayList<District> buildVersionedDistrictList(JsonArray districtList,String url,int version){
  ArrayList<District> districts=new ArrayList<>();
  for (  JsonElement d : districtList) {
    if (version > 1) {
      JsonObject data=d.getAsJsonObject();
      District district=DistrictHelper.buildDistrictFromUrl(data.get("String_Node_Str").getAsString(),url);
      district.setName(data.get("String_Node_Str").getAsString());
      districts.add(district);
    }
 else {
      districts.add(DistrictHelper.buildDistrictFromUrl(d.getAsString(),url));
    }
  }
  return districts;
}

Fixed version (ground truth):
public static ArrayList<District> buildVersionedDistrictList(JsonArray districtList,String url,int version){
  ArrayList<District> districts=new ArrayList<>();
  for (  JsonElement d : districtList) {
    if (!d.isJsonNull()) {
      if (version > 1) {
        JsonObject data=d.getAsJsonObject();
        District district=DistrictHelper.buildDistrictFromUrl(data.get("String_Node_Str").getAsString(),url);
        district.setName(data.get("String_Node_Str").getAsString());
        districts.add(district);
      }
 else {
        districts.add(DistrictHelper.buildDistrictFromUrl(d.getAsString(),url));
      }
    }
  }
  return districts;
}
Program: 33712
Project: 33712
Buggy source:
private void setupActionBarForEvents(){
  ActionBar bar=getSupportActionBar();
  if (bar != null) {
    bar.setDisplayShowTitleEnabled(false);
    ArrayAdapter<String> actionBarAdapter=new ArrayAdapter<>(bar.getThemedContext(),R.layout.actionbar_spinner_events,R.id.year,eventsDropdownItems);
    actionBarAdapter.setDropDownViewResource(R.layout.actionbar_spinner_dropdown);
    toolbarSpinner.setVisibility(View.VISIBLE);
    toolbarSpinner.setAdapter(actionBarAdapter);
    toolbarSpinner.setOnItemSelectedListener(this);
  }
}

Fixed version (ground truth):
private void setupActionBarForEvents(){
  ActionBar bar=getSupportActionBar();
  if (bar != null) {
    bar.setDisplayShowTitleEnabled(false);
    ArrayAdapter<String> actionBarAdapter=new ArrayAdapter<>(bar.getThemedContext(),R.layout.actionbar_spinner_events,R.id.year,eventsDropdownItems);
    actionBarAdapter.setDropDownViewResource(R.layout.actionbar_spinner_dropdown);
    toolbarSpinner.setVisibility(View.VISIBLE);
    toolbarSpinner.setAdapter(actionBarAdapter);
    toolbarSpinner.setOnItemSelectedListener(this);
    if (mCurrentSelectedYearPosition >= 0 && mCurrentSelectedYearPosition < eventsDropdownItems.length) {
      toolbarSpinner.setSelection(mCurrentSelectedYearPosition);
    }
 else {
      toolbarSpinner.setSelection(0);
    }
  }
}
Program: 33713
Project: 33713
Buggy source:
@Override public void onNavDrawerOpened(){
  getSupportActionBar().setTitle(R.string.app_name);
}

Fixed version (ground truth):
@Override public void onNavDrawerOpened(){
  if (mShowAppNameWhenDrawerOpened) {
    getSupportActionBar().setTitle(R.string.app_name);
  }
}
Program: 33714
Project: 33714
Buggy source:
@Override public void onCreate(){
  super.onCreate();
  Log.i(Constants.LOG_TAG,"String_Node_Str" + BuildConfig.VERSION_NAME);
  if (AccountHelper.isAccountSelected(this) && !AccountHelper.hasMyTBAData(this)) {
    new UpdateMyTBA(this,true).execute();
  }
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
  Log.i(Constants.LOG_TAG,"String_Node_Str" + BuildConfig.VERSION_NAME);
}
Program: 33715
Project: 33715
Buggy source:
protected void onRefreshComplete(){
  setMenuProgressBarVisible(false);
  mRefreshInProgress=false;
  mRefreshed=true;
}

Fixed version (ground truth):
protected void onRefreshComplete(){
  setMenuProgressBarVisible(false);
  mRefreshInProgress=false;
  mRefreshed=true;
  if (AccountHelper.isAccountSelected(this)) {
    new UpdateMyTBA(this,false).execute();
  }
}
Program: 33716
Project: 33716
Buggy source:
@Override public void onPanelCollapsed(View view){
  Log.d(Constants.LOG_TAG,"String_Node_Str");
  ArrayList<String> subscribed=new ArrayList<>();
  subscribed.add(modelKey);
  String[] modelNotifications=ModelHelper.getNotificationTypes(modelType);
  ListViewAdapter adapter=((ListViewAdapter)list.getAdapter());
  for (int i=0; i < adapter.values.size(); i++) {
    NotificationTypeListElement element=((NotificationTypeListElement)adapter.values.get(i));
    Log.d(Constants.LOG_TAG,"String_Node_Str" + i + "String_Node_Str"+ element.isEnabled());
    if (element.isEnabled()) {
      subscribed.add(modelNotifications[element.getPosition()]);
    }
  }
  Log.d(Constants.LOG_TAG,"String_Node_Str" + subscribed);
  if (subscribed.size() == 1) {
    new RemoveUserSubscription(getActivity()).execute(modelKey);
  }
 else {
    new AddUpdateUserSubscription(getActivity()).execute(subscribed.toArray(new String[subscribed.size()]));
  }
}

Fixed version (ground truth):
@Override public void onPanelCollapsed(View view){
  Log.d(Constants.LOG_TAG,"String_Node_Str");
  ArrayList<String> subscribed=new ArrayList<>();
  subscribed.add(modelKey);
  String[] modelNotifications=ModelHelper.getNotificationTypes(modelType);
  ListViewAdapter adapter=((ListViewAdapter)list.getAdapter());
  if (adapter != null) {
    for (int i=0; i < adapter.values.size(); i++) {
      NotificationTypeListElement element=((NotificationTypeListElement)adapter.values.get(i));
      Log.d(Constants.LOG_TAG,"String_Node_Str" + i + "String_Node_Str"+ element.isEnabled());
      if (element.isEnabled()) {
        subscribed.add(modelNotifications[element.getPosition()]);
      }
    }
  }
  Log.d(Constants.LOG_TAG,"String_Node_Str" + subscribed);
  if (subscribed.size() == 1) {
    new RemoveUserSubscription(getActivity()).execute(modelKey);
  }
 else {
    new AddUpdateUserSubscription(getActivity()).execute(subscribed.toArray(new String[subscribed.size()]));
  }
}
Program: 33718
Project: 33718
Buggy source:
public boolean isHappeningNow(){
  try {
    Date startDate=getStartDate(), endDate=getEndDate();
    if (startDate == null || endDate == null)     return false;
    Date now=new Date();
    return now.after(startDate) && now.before(endDate);
  }
 catch (  FieldNotDefinedException e) {
    Log.w(Constants.LOG_TAG,"String_Node_Str" + "String_Node_Str");
    return false;
  }
}

Fixed version (ground truth):
public boolean isHappeningNow(){
  try {
    Date startDate=getStartDate(), endDate=getEndDate();
    Calendar c=Calendar.getInstance();
    c.setTime(endDate);
    c.add(Calendar.DATE,1);
    endDate=c.getTime();
    if (startDate == null || endDate == null)     return false;
    Date now=new Date();
    return now.after(startDate) && now.before(endDate);
  }
 catch (  FieldNotDefinedException e) {
    Log.w(Constants.LOG_TAG,"String_Node_Str" + "String_Node_Str");
    return false;
  }
}
Program: 33719
Project: 33719
Buggy source:
public PopulateEventAwards(EventAwardsFragment f,boolean forceFromCache){
  mFragment=f;
  activity=(RefreshableHostActivity)mFragment.getActivity();
  this.forceFromCache=forceFromCache;
}

Fixed version (ground truth):
public PopulateEventAwards(EventAwardsFragment f,boolean forceFromCache){
  mFragment=f;
  if (mFragment != null) {
    activity=(RefreshableHostActivity)mFragment.getActivity();
  }
  this.forceFromCache=forceFromCache;
}
Program: 33722
Project: 33722
Buggy source:
public static JsonArray getasJsonArray(String input){
  if (input == null || input.equals("String_Node_Str"))   return new JsonArray();
  try {
    return getParser().parse(input).getAsJsonArray();
  }
 catch (  IllegalStateException err) {
    Log.w(Constants.LOG_TAG,"String_Node_Str" + err);
    return new JsonArray();
  }
}

Fixed version (ground truth):
public static JsonArray getasJsonArray(String input){
  if (input == null || input.equals("String_Node_Str"))   return new JsonArray();
  try {
    return getParser().parse(input).getAsJsonArray();
  }
 catch (  IllegalStateException err) {
    Log.w(Constants.LOG_TAG,"String_Node_Str" + err);
    return new JsonArray();
  }
catch (  Exception ex) {
    Log.w(Constants.LOG_TAG,"String_Node_Str");
    ex.printStackTrace();
    return new JsonArray();
  }
}
Program: 33723
Project: 33723
Buggy source:
public void merge(T in){
  fields.putAll(in.fields);
}

Fixed version (ground truth):
public void merge(T in){
  if (in != null) {
    fields.putAll(in.fields);
  }
}
Program: 33725
Project: 33725
Buggy source:
private void beginLoadingIfConnected(){
  if (ConnectionDetector.isConnectedToInternet(this)) {
    advanceToNextPage();
    beginLoading();
  }
 else {
    AlertDialog.Builder alertDialogBuilder=new AlertDialog.Builder(this);
    alertDialogBuilder.setTitle("String_Node_Str");
    alertDialogBuilder.setMessage(getString(R.string.warning_no_internet_connection)).setCancelable(false).setPositiveButton(getString(R.string.retry),new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int id){
        beginLoadingIfConnected();
        dialog.dismiss();
      }
    }
).setNegativeButton(getString(R.string.cancel),new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int id){
        finish();
      }
    }
);
    AlertDialog alertDialog=alertDialogBuilder.create();
    alertDialog.show();
  }
}

Fixed version (ground truth):
private void beginLoadingIfConnected(){
  if (ConnectionDetector.isConnectedToInternet(this)) {
    viewPager.advanceToNextPage();
    beginLoading();
  }
 else {
    AlertDialog.Builder alertDialogBuilder=new AlertDialog.Builder(this);
    alertDialogBuilder.setTitle("String_Node_Str");
    alertDialogBuilder.setMessage(getString(R.string.warning_no_internet_connection)).setCancelable(false).setPositiveButton(getString(R.string.retry),new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int id){
        beginLoadingIfConnected();
        dialog.dismiss();
      }
    }
).setNegativeButton(getString(R.string.cancel),new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int id){
        finish();
      }
    }
);
    AlertDialog alertDialog=alertDialogBuilder.create();
    alertDialog.show();
  }
}
Program: 33726
Project: 33726
Buggy source:
protected void onRefreshComplete(){
  hideMenuProgressBar();
  mRefreshInProgress=false;
  mRefreshed=true;
}

Fixed version (ground truth):
protected void onRefreshComplete(){
  setMenuProgressBarVisible(false);
  mRefreshInProgress=false;
  mRefreshed=true;
}
Program: 33727
Project: 33727
Buggy source:
public void restartRefresh(){
  for (  RefreshListener listener : mRefreshListeners) {
    listener.onRefreshStop();
  }
  for (  RefreshListener listener : mRefreshListeners) {
    listener.onRefreshStart();
  }
  mRefreshInProgress=true;
  showMenuProgressBar();
}

Fixed version (ground truth):
public void restartRefresh(){
  for (  RefreshListener listener : mRefreshListeners) {
    listener.onRefreshStop();
  }
  for (  RefreshListener listener : mRefreshListeners) {
    listener.onRefreshStart();
  }
  mRefreshInProgress=true;
  setMenuProgressBarVisible(true);
}
Program: 33728
Project: 33728
Buggy source:
public void cancelRefresh(){
  for (  RefreshListener listener : mRefreshListeners) {
    listener.onRefreshStop();
  }
  mRefreshInProgress=false;
  hideMenuProgressBar();
}

Fixed version (ground truth):
public void cancelRefresh(){
  for (  RefreshListener listener : mRefreshListeners) {
    listener.onRefreshStop();
  }
  mRefreshInProgress=false;
  setMenuProgressBarVisible(false);
}
Program: 33729
Project: 33729
Buggy source:
public void showMenuProgressBar(){
  if (mOptionsMenu != null) {
    MenuItem refresh=mOptionsMenu.findItem(R.id.refresh);
    refresh.setActionView(R.layout.actionbar_indeterminate_progress);
  }
}

Fixed version (ground truth):
public void showMenuProgressBar(){
}
Program: 33730
Project: 33730
Buggy source:
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  getMenuInflater().inflate(R.menu.refresh_menu,menu);
  mOptionsMenu=menu;
  if (mRefreshInProgress) {
    showMenuProgressBar();
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  getMenuInflater().inflate(R.menu.refresh_menu,menu);
  mOptionsMenu=menu;
  if (mRefreshInProgress) {
    setMenuProgressBarVisible(true);
  }
  return true;
}
Program: 33731
Project: 33731
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  int id=item.getItemId();
switch (id) {
case R.id.points_help:
    Utilities.showHelpDialog(this,R.raw.district_points_help,getString(R.string.district_points_help));
  return true;
case android.R.id.home:
if (isDrawerOpen()) {
  closeDrawer();
  return true;
}
Intent upIntent=NavUtils.getParentActivityIntent(this);
if (NavUtils.shouldUpRecreateTask(this,upIntent)) {
TaskStackBuilder.create(this).addNextIntent(HomeActivity.newInstance(this,R.id.nav_item_events)).startActivities();
}
 else {
Log.d(Constants.LOG_TAG,"String_Node_Str");
NavUtils.navigateUpTo(this,upIntent);
}
return true;
}
return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  int id=item.getItemId();
switch (id) {
case R.id.points_help:
    Utilities.showHelpDialog(this,R.raw.district_points_help,getString(R.string.district_points_help));
  return true;
case android.R.id.home:
if (isDrawerOpen()) {
  closeDrawer();
  return true;
}
startActivity(HomeActivity.newInstance(this,R.id.nav_item_districts).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
return true;
}
return super.onOptionsItemSelected(item);
}
Program: 33732
Project: 33732
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  int id=item.getItemId();
switch (id) {
case android.R.id.home:
    if (isDrawerOpen()) {
      closeDrawer();
      return true;
    }
  Intent upIntent=NavUtils.getParentActivityIntent(this);
if (NavUtils.shouldUpRecreateTask(this,upIntent)) {
  TaskStackBuilder.create(this).addNextIntent(HomeActivity.newInstance(this,R.id.nav_item_events)).startActivities();
}
 else {
  Log.d(Constants.LOG_TAG,"String_Node_Str");
  NavUtils.navigateUpTo(this,upIntent);
}
return true;
case R.id.stats_help:
Utilities.showHelpDialog(this,R.raw.stats_help,getString(R.string.stats_help_title));
return true;
case R.id.points_help:
Utilities.showHelpDialog(this,R.raw.district_points_help,getString(R.string.district_points_help));
return true;
default :
return super.onOptionsItemSelected(item);
}
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  int id=item.getItemId();
switch (id) {
case android.R.id.home:
    if (isDrawerOpen()) {
      closeDrawer();
      return true;
    }
  startActivity(HomeActivity.newInstance(this,R.id.nav_item_events).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
return true;
case R.id.stats_help:
Utilities.showHelpDialog(this,R.raw.stats_help,getString(R.string.stats_help_title));
return true;
case R.id.points_help:
Utilities.showHelpDialog(this,R.raw.district_points_help,getString(R.string.district_points_help));
return true;
default :
return super.onOptionsItemSelected(item);
}
}
Program: 33733
Project: 33733
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  int id=item.getItemId();
  if (id == android.R.id.home) {
    if (isDrawerOpen()) {
      closeDrawer();
      return true;
    }
    TaskStackBuilder.create(this).addNextIntent(HomeActivity.newInstance(this,R.id.nav_item_teams)).startActivities();
    return true;
  }
  return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  int id=item.getItemId();
  if (id == android.R.id.home) {
    if (isDrawerOpen()) {
      closeDrawer();
      return true;
    }
    startActivity(HomeActivity.newInstance(this,R.id.nav_item_teams).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
    return true;
  }
  return super.onOptionsItemSelected(item);
}
Program: 33734
Project: 33734
Buggy source:
private boolean checkDataRedownload(){
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this);
  int lastVersion=prefs.getInt(APP_VERSION_KEY,-1);
  if (getIntent().getBooleanExtra(REDOWNLOAD,false)) {
    return true;
  }
  boolean redownload=false;
  Log.d(Constants.LOG_TAG,"String_Node_Str" + lastVersion + "String_Node_Str"+ BuildConfig.VERSION_CODE+ "String_Node_Str"+ prefs.contains(APP_VERSION_KEY));
  if (!prefs.contains(APP_VERSION_KEY) && lastVersion < BuildConfig.VERSION_CODE) {
    SharedPreferences.Editor editor=prefs.edit();
    while (lastVersion <= BuildConfig.VERSION_CODE) {
      Log.v(Constants.LOG_TAG,"String_Node_Str" + lastVersion);
switch (lastVersion) {
case 14:
        redownload=true;
      getIntent().putExtra(LaunchActivity.DATA_TO_REDOWNLOAD,new short[]{LoadAllDataTaskFragment.LOAD_EVENTS,LaunchActivity.LoadAllDataTaskFragment.LOAD_DISTRICTS});
    getIntent().putExtra(LaunchActivity.REDOWNLOAD,true);
  break;
default :
break;
}
editor.putInt(APP_VERSION_KEY,lastVersion);
lastVersion++;
}
editor.putInt(APP_VERSION_KEY,BuildConfig.VERSION_CODE).commit();
}
prefs.edit().putInt(APP_VERSION_KEY,BuildConfig.VERSION_CODE).commit();
return redownload;
}

Fixed version (ground truth):
private boolean checkDataRedownload(){
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this);
  int lastVersion=prefs.getInt(APP_VERSION_KEY,-1);
  if (lastVersion == -1 && !prefs.getBoolean(ALL_DATA_LOADED,false)) {
    return false;
  }
  if (getIntent().getBooleanExtra(REDOWNLOAD,false)) {
    return true;
  }
  boolean redownload=false;
  Log.d(Constants.LOG_TAG,"String_Node_Str" + lastVersion + "String_Node_Str"+ BuildConfig.VERSION_CODE+ "String_Node_Str"+ prefs.contains(APP_VERSION_KEY));
  if (!prefs.contains(APP_VERSION_KEY) && lastVersion < BuildConfig.VERSION_CODE) {
    while (lastVersion <= BuildConfig.VERSION_CODE) {
      Log.v(Constants.LOG_TAG,"String_Node_Str" + lastVersion);
switch (lastVersion) {
case 14:
        redownload=true;
      getIntent().putExtra(LaunchActivity.DATA_TO_REDOWNLOAD,new short[]{LoadAllDataTaskFragment.LOAD_EVENTS,LaunchActivity.LoadAllDataTaskFragment.LOAD_DISTRICTS});
    getIntent().putExtra(LaunchActivity.REDOWNLOAD,true);
  break;
default :
break;
}
lastVersion++;
}
}
return redownload;
}
Program: 33736
Project: 33736
Buggy source:
@Override public Fragment getItem(int position){
  Fragment fragment;
switch (position) {
default :
case 0:
    fragment=TeamAtEventSummaryFragment.newInstance(teamKey,eventKey);
  break;
case 1:
fragment=EventResultsFragment.newInstance(eventKey,teamKey);
break;
case 2:
fragment=TeamAtEventStatsFragment.newInstance(teamKey,eventKey);
break;
case 3:
fragment=EventAwardsFragment.newInstance(eventKey,teamKey);
break;
}
return fragment;
}

Fixed version (ground truth):
@Override public Fragment getItem(int position){
  Fragment fragment;
switch (position) {
default :
case 0:
    fragment=TeamAtEventSummaryFragment.newInstance(teamKey,eventKey);
  break;
case 1:
fragment=EventMatchesFragment.newInstance(eventKey,teamKey);
break;
case 2:
fragment=TeamAtEventStatsFragment.newInstance(teamKey,eventKey);
break;
case 3:
fragment=EventAwardsFragment.newInstance(eventKey,teamKey);
break;
}
return fragment;
}
Program: 33737
Project: 33737
Buggy source:
@Override public Fragment getItem(int position){
  Fragment fragment;
switch (position) {
default :
case 0:
    fragment=EventInfoFragment.newInstance(mEventKey);
  break;
case 1:
fragment=EventTeamsFragment.newInstance(mEventKey);
break;
case 2:
fragment=EventRankingsFragment.newInstance(mEventKey);
break;
case 3:
fragment=EventResultsFragment.newInstance(mEventKey);
break;
case 4:
fragment=EventAlliancesFragment.newInstance(mEventKey);
break;
case 5:
fragment=EventDistrictPointsFragment.newInstance(mEventKey);
break;
case 6:
fragment=EventStatsFragment.newInstance(mEventKey);
break;
case 7:
fragment=EventAwardsFragment.newInstance(mEventKey);
break;
}
return fragment;
}

Fixed version (ground truth):
@Override public Fragment getItem(int position){
  Fragment fragment;
switch (position) {
default :
case 0:
    fragment=EventInfoFragment.newInstance(mEventKey);
  break;
case 1:
fragment=EventTeamsFragment.newInstance(mEventKey);
break;
case 2:
fragment=EventRankingsFragment.newInstance(mEventKey);
break;
case 3:
fragment=EventMatchesFragment.newInstance(mEventKey);
break;
case 4:
fragment=EventAlliancesFragment.newInstance(mEventKey);
break;
case 5:
fragment=EventDistrictPointsFragment.newInstance(mEventKey);
break;
case 6:
fragment=EventStatsFragment.newInstance(mEventKey);
break;
case 7:
fragment=EventAwardsFragment.newInstance(mEventKey);
break;
}
return fragment;
}
Program: 33738
Project: 33738
Buggy source:
protected void showNextMatch(MatchListElement match){
  LinearLayout lastLayout=(LinearLayout)getView().findViewById(R.id.event_next_match_container);
  lastLayout.setVisibility(View.VISIBLE);
  if (lastLayout.getChildCount() > 1) {
    lastLayout.removeViewAt(1);
  }
  lastLayout.addView(match.getView(getActivity(),getActivity().getLayoutInflater(),null));
}

Fixed version (ground truth):
protected void showNextMatch(MatchListElement match){
  LinearLayout nextLayout=(LinearLayout)getView().findViewById(R.id.event_next_match_container);
  nextLayout.setVisibility(View.VISIBLE);
  if (nextLayout.getChildCount() > 1) {
    nextLayout.removeViewAt(1);
  }
  nextLayout.addView(match.getView(getActivity(),getActivity().getLayoutInflater(),null));
}
Program: 33739
Project: 33739
Buggy source:
protected void onRefreshComplete(){
  hideMenuProgressBar();
  mRefreshInProgress=false;
}

Fixed version (ground truth):
protected void onRefreshComplete(){
  hideMenuProgressBar();
  mRefreshInProgress=false;
  mRefreshed=true;
}
Program: 33740
Project: 33740
Buggy source:
@Override protected void onResume(){
  super.onResume();
  refreshListener=new RefreshBroadcastReceiver();
  LocalBroadcastManager.getInstance(this).registerReceiver(refreshListener,new IntentFilter(ConnectionChangeBroadcast.ACTION));
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  refreshListener=new RefreshBroadcastReceiver();
  LocalBroadcastManager.getInstance(this).registerReceiver(refreshListener,new IntentFilter(ConnectionChangeBroadcast.ACTION));
  if (!mRefreshed) {
    startRefresh();
  }
}
Program: 33741
Project: 33741
Buggy source:
@Override public void onPageSelected(int position){
  if (mOptionsMenu != null) {
    MenuItem statsSort=mOptionsMenu.findItem(R.id.action_sort_by);
    MenuItem statsHelp=mOptionsMenu.findItem(R.id.stats_help);
    MenuItem pointsHelp=mOptionsMenu.findItem(R.id.points_help);
    if (position == Arrays.binarySearch(adapter.TITLES,"String_Node_Str")) {
      if (statsHelp != null) {
        statsHelp.setVisible(true);
      }
      if (statsSort != null) {
        statsSort.setVisible(true);
      }
    }
 else {
      if (statsHelp != null) {
        statsHelp.setVisible(false);
      }
      if (statsSort != null) {
        statsSort.setVisible(false);
      }
    }
    if (position == 5) {
      pointsHelp.setVisible(true);
      if (!isDistrict) {
        showInfoMessage(getString(R.string.warning_not_real_district));
      }
 else {
        hideInfoMessage();
      }
    }
 else {
      pointsHelp.setVisible(false);
      hideInfoMessage();
    }
  }
}

Fixed version (ground truth):
@Override public void onPageSelected(int position){
  if (mOptionsMenu != null) {
    if (position == 5 && !isDistrict) {
      showInfoMessage(getString(R.string.warning_not_real_district));
    }
 else {
      hideInfoMessage();
    }
  }
}
Program: 33742
Project: 33742
Buggy source:
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  mOptionsMenu=menu;
  getMenuInflater().inflate(R.menu.district_point_math,menu);
  menu.findItem(R.id.points_help).setVisible(false);
  return true;
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  mOptionsMenu=menu;
  return true;
}
Program: 33743
Project: 33743
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (getArguments() != null) {
    mEventKey=getArguments().getString(KEY,"String_Node_Str");
  }
  parent=getActivity();
  if (parent instanceof RefreshableHostActivity) {
    ((RefreshableHostActivity)parent).registerRefreshableActivityListener(this);
  }
  isDistrict=true;
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (getArguments() != null) {
    mEventKey=getArguments().getString(KEY,"String_Node_Str");
  }
  parent=getActivity();
  if (parent instanceof RefreshableHostActivity) {
    ((RefreshableHostActivity)parent).registerRefreshableActivityListener(this);
  }
  isDistrict=true;
  setHasOptionsMenu(true);
}
Program: 33744
Project: 33744
Buggy source:
public APIResponse(A data,CODE code){
  this.code=code;
  this.data=data;
  this.lastUpdate="String_Node_Str";
}

Fixed version (ground truth):
public APIResponse(A data,String errorMessage){
  this.code=CODE.ERROR;
  this.data=data;
  this.lastUpdate="String_Node_Str";
  this.errorMessage=errorMessage;
}
Program: 33746
Project: 33746
Buggy source:
public static synchronized Tracker getTracker(GAnalyticsTracker trackerId,Context c){
  if (!mTrackers.containsKey(trackerId)) {
    if (analytics == null) {
      analytics=GoogleAnalytics.getInstance(c);
      boolean dryRun;
      if (Utilities.isDebuggable(c)) {
        dryRun=PreferenceManager.getDefaultSharedPreferences(c).getBoolean("String_Node_Str",true);
      }
 else {
        dryRun=false;
      }
      analytics.setDryRun(dryRun);
      Log.d("String_Node_Str","String_Node_Str" + dryRun);
    }
    String id;
    if (Utilities.isDebuggable(c)) {
      boolean useDebugKey=PreferenceManager.getDefaultSharedPreferences(c).getBoolean("String_Node_Str",true);
      id=Utilities.readLocalProperty(c,useDebugKey ? DEBUG_ANALYTICS_KEY : PROD_ANALYTICS_KEY);
    }
 else {
      id=Utilities.readLocalProperty(c,PROD_ANALYTICS_KEY);
    }
    Tracker t;
    Log.d("String_Node_Str","String_Node_Str" + id);
    t=analytics.newTracker(id);
    t.enableAutoActivityTracking(true);
    t.enableExceptionReporting(true);
    mTrackers.put(trackerId,t);
  }
  return mTrackers.get(trackerId);
}

Fixed version (ground truth):
public static synchronized Tracker getTracker(GAnalyticsTracker trackerId,Context c){
  if (!mTrackers.containsKey(trackerId)) {
    if (analytics == null) {
      analytics=GoogleAnalytics.getInstance(c);
      boolean dryRun;
      if (Utilities.isDebuggable()) {
        dryRun=PreferenceManager.getDefaultSharedPreferences(c).getBoolean("String_Node_Str",true);
      }
 else {
        dryRun=false;
      }
      analytics.setDryRun(dryRun);
      Log.d("String_Node_Str","String_Node_Str" + dryRun);
    }
    String id;
    if (Utilities.isDebuggable()) {
      boolean useDebugKey=PreferenceManager.getDefaultSharedPreferences(c).getBoolean("String_Node_Str",true);
      id=Utilities.readLocalProperty(c,useDebugKey ? DEBUG_ANALYTICS_KEY : PROD_ANALYTICS_KEY);
    }
 else {
      id=Utilities.readLocalProperty(c,PROD_ANALYTICS_KEY);
    }
    Tracker t;
    Log.d("String_Node_Str","String_Node_Str" + id);
    t=analytics.newTracker(id);
    t.enableAutoActivityTracking(true);
    t.enableExceptionReporting(true);
    mTrackers.put(trackerId,t);
  }
  return mTrackers.get(trackerId);
}
Program: 33747
Project: 33747
Buggy source:
public static boolean isDebuggable(Context c){
  return (0 != (c.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE));
}

Fixed version (ground truth):
public static boolean isDebuggable(){
  Log.i(Constants.LOG_TAG,"String_Node_Str" + BuildConfig.DEBUG);
  return BuildConfig.DEBUG;
}
Program: 33751
Project: 33751
Buggy source:
@Override protected void onPostExecute(APIResponse.CODE code){
  super.onPostExecute(code);
  View view=mFragment.getView();
  if (view != null && activity != null) {
    ListViewAdapter adapter=new ListViewAdapter(activity,events);
    TextView noDataText=(TextView)view.findViewById(R.id.no_data);
    if (code == APIResponse.CODE.NODATA || (!forceFromCache && adapter.values.isEmpty())) {
      noDataText.setText(R.string.no_event_data);
      noDataText.setVisibility(View.VISIBLE);
    }
 else {
      ListView eventList=(ListView)view.findViewById(R.id.list);
      Parcelable state=eventList.onSaveInstanceState();
      eventList.setAdapter(adapter);
      noDataText.setVisibility(View.GONE);
      eventList.onRestoreInstanceState(state);
    }
    if (code == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(mFragment.getString(R.string.warning_using_cached_data));
    }
    if (!mHeader.equals("String_Node_Str") || mTeamKey != null) {
      view.findViewById(R.id.progress).setVisibility(View.GONE);
      view.findViewById(R.id.list).setVisibility(View.VISIBLE);
    }
    if (code == APIResponse.CODE.LOCAL && !isCancelled()) {
      new PopulateEventList(mFragment,host,mYear,mHeader,mTeamKey,false).execute();
    }
 else {
      Log.i(Constants.REFRESH_LOG,"String_Node_Str");
      host.notifyRefreshComplete((RefreshListener)mFragment);
    }
  }
}

Fixed version (ground truth):
@Override protected void onPostExecute(APIResponse.CODE code){
  super.onPostExecute(code);
  View view=mFragment.getView();
  if (view != null && activity != null) {
    ListViewAdapter adapter=new ListViewAdapter(activity,events);
    TextView noDataText=(TextView)view.findViewById(R.id.no_data);
    if ((code == APIResponse.CODE.NODATA && !ConnectionDetector.isConnectedToInternet(activity)) || (!forceFromCache && adapter.values.isEmpty())) {
      noDataText.setText(R.string.no_event_data);
      noDataText.setVisibility(View.VISIBLE);
    }
 else {
      ListView eventList=(ListView)view.findViewById(R.id.list);
      Parcelable state=eventList.onSaveInstanceState();
      eventList.setAdapter(adapter);
      noDataText.setVisibility(View.GONE);
      eventList.onRestoreInstanceState(state);
    }
    if (code == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(mFragment.getString(R.string.warning_using_cached_data));
    }
    if (!mHeader.equals("String_Node_Str") || mTeamKey != null) {
      view.findViewById(R.id.progress).setVisibility(View.GONE);
      view.findViewById(R.id.list).setVisibility(View.VISIBLE);
    }
    if (code == APIResponse.CODE.LOCAL && !isCancelled()) {
      new PopulateEventList(mFragment,host,mYear,mHeader,mTeamKey,false).execute();
    }
 else {
      Log.i(Constants.REFRESH_LOG,"String_Node_Str");
      host.notifyRefreshComplete((RefreshListener)mFragment);
    }
  }
}
Program: 33752
Project: 33752
Buggy source:
public static String getApiHeader(){
  return "String_Node_Str" + BuildConfig.VERSION_NAME;
}

Fixed version (ground truth):
public static String getApiHeader(){
  return "String_Node_Str" + BuildConfig.VERSION_NAME.replace("String_Node_Str","String_Node_Str");
}
Program: 33754
Project: 33754
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (getArguments() != null) {
    mEventKey=getArguments().getString(KEY,"String_Node_Str");
  }
  parent=getActivity();
  if (parent instanceof RefreshableHostActivity) {
    ((RefreshableHostActivity)parent).registerRefreshableActivityListener(this);
  }
  items=getResources().getStringArray(R.array.statsDialogArray);
  AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
  builder.setTitle(R.string.dialog_stats_title).setSingleChoiceItems(items,selectedStatSort,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialogInterface,    int i){
      selectedStatSort=i;
switch (items[i]) {
case "String_Node_Str":
        statSortCategory="String_Node_Str";
      break;
case "String_Node_Str":
    statSortCategory="String_Node_Str";
  break;
case "String_Node_Str":
statSortCategory="String_Node_Str";
break;
case "String_Node_Str":
statSortCategory="String_Node_Str";
break;
default :
break;
}
dialogInterface.dismiss();
mAdapter=(EventStatsFragmentAdapter)mListView.getAdapter();
if (mAdapter != null && statSortCategory != null) {
mAdapter.sortStats(mAdapter,statSortCategory);
}
}
}
).setNegativeButton(R.string.dialog_cancel,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int id){
dialog.cancel();
}
}
);
statsDialog=builder.create();
setHasOptionsMenu(true);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (getArguments() != null) {
    mEventKey=getArguments().getString(KEY,"String_Node_Str");
  }
  parent=getActivity();
  if (parent instanceof RefreshableHostActivity) {
    ((RefreshableHostActivity)parent).registerRefreshableActivityListener(this);
  }
  items=getResources().getStringArray(R.array.statsDialogArray);
  AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
  builder.setTitle(R.string.dialog_stats_title).setSingleChoiceItems(items,selectedStatSort,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialogInterface,    int i){
      selectedStatSort=i;
switch (items[i]) {
case "String_Node_Str":
        statSortCategory="String_Node_Str";
      break;
case "String_Node_Str":
    statSortCategory="String_Node_Str";
  break;
case "String_Node_Str":
statSortCategory="String_Node_Str";
break;
case "String_Node_Str":
statSortCategory="String_Node_Str";
break;
default :
break;
}
dialogInterface.dismiss();
mAdapter=(EventStatsFragmentAdapter)mListView.getAdapter();
if (mAdapter != null && statSortCategory != null) {
mAdapter.sortStats(mAdapter,statSortCategory);
}
}
}
).setNegativeButton(R.string.dialog_cancel,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int id){
dialog.cancel();
}
}
);
statsDialog=builder.create();
}
Program: 33755
Project: 33755
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View v=inflater.inflate(R.layout.fragment_team_list_fragment_pager,container,false);
  mViewPager=(ViewPager)v.findViewById(R.id.team_pager);
  mViewPager.setAdapter(new TeamListFragmentPagerAdapter(getChildFragmentManager()));
  mViewPager.setPageMargin(Utilities.getPixelsFromDp(getActivity(),16));
  PagerSlidingTabStrip tabs=(PagerSlidingTabStrip)v.findViewById(R.id.team_pager_tabs);
  tabs.setViewPager(mViewPager);
  return v;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View v=inflater.inflate(R.layout.fragment_team_list_fragment_pager,container,false);
  mViewPager=(ViewPager)v.findViewById(R.id.team_pager);
  mViewPager.setPageMargin(Utilities.getPixelsFromDp(getActivity(),16));
  mTabs=(PagerSlidingTabStrip)v.findViewById(R.id.team_pager_tabs);
  mViewPager.post(new Runnable(){
    public void run(){
      mViewPager.setAdapter(new TeamListFragmentPagerAdapter(getChildFragmentManager()));
      mTabs.setViewPager(mViewPager);
    }
  }
);
  return v;
}
Program: 33756
Project: 33756
Buggy source:
public synchronized void notifyRefreshComplete(RefreshListener completedListener){
  if (completedListener == null || !mRefreshListeners.contains(completedListener)) {
    return;
  }
  if (!mCompletedRefreshListeners.contains(completedListener)) {
    mCompletedRefreshListeners.add(completedListener);
  }
  if (mCompletedRefreshListeners.size() >= mRefreshListeners.size()) {
    onRefreshComplete();
    mCompletedRefreshListeners.clear();
  }
}

Fixed version (ground truth):
public synchronized void notifyRefreshComplete(RefreshListener completedListener){
  if (completedListener == null) {
    return;
  }
  if (!mRefreshListeners.contains(completedListener) && parent instanceof RefreshableHostActivity) {
    ((RefreshableHostActivity)parent).notifyRefreshComplete(completedListener);
  }
  if (!mCompletedRefreshListeners.contains(completedListener)) {
    mCompletedRefreshListeners.add(completedListener);
  }
  if (mCompletedRefreshListeners.size() >= mRefreshListeners.size()) {
    onRefreshComplete();
    mCompletedRefreshListeners.clear();
  }
}
Program: 33757
Project: 33757
Buggy source:
@Override public void onResume(){
  super.onResume();
  if (parent instanceof RefreshableHostActivity) {
    Log.d(Constants.LOG_TAG,"String_Node_Str");
    ((RefreshableHostActivity)parent).registerRefreshableActivityListener(this);
    ((RefreshableHostActivity)parent).startRefresh(this);
  }
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  if (parent instanceof RefreshableHostActivity) {
    ((RefreshableHostActivity)parent).startRefresh(this);
  }
}
Program: 33760
Project: 33760
Buggy source:
public EventsByWeekFragmentPagerAdapter(Context c,FragmentManager fm,int year,PagerSlidingTabStrip tabs,ViewPager pager){
  super(fm);
  mYear=year;
  thisYearsWeekLabels=new ArrayList<>();
  selectedTab=String.format(EventHelper.REGIONAL_LABEL,1);
  thisYearsWeekLabels.add(selectedTab);
  this.tabs=tabs;
  this.pager=pager;
  mCount=1;
  DownloadEventList task=new DownloadEventList(c,this);
  task.execute(year);
}

Fixed version (ground truth):
public EventsByWeekFragmentPagerAdapter(Context c,FragmentManager fm,int year,PagerSlidingTabStrip tabs,ViewPager pager){
  super(fm);
  mYear=year;
  thisYearsWeekLabels=new ArrayList<>();
  fragments=new ArrayList<>();
  selectedTab=String.format(EventHelper.REGIONAL_LABEL,1);
  thisYearsWeekLabels.add(selectedTab);
  this.tabs=tabs;
  this.pager=pager;
  mCount=1;
  DownloadEventList task=new DownloadEventList(c,this);
  task.execute(year);
  firstTabChanged=false;
}
Program: 33761
Project: 33761
Buggy source:
public void notifyDataSetChanged(){
  super.notifyDataSetChanged();
  tabs.notifyDataSetChanged();
}

Fixed version (ground truth):
public void notifyDataSetChanged(){
  super.notifyDataSetChanged();
  tabs.notifyDataSetChanged();
  if (firstTabChanged) {
    fragments.get(0).updateHeader(getPageTitle(0).toString());
  }
}
Program: 33762
Project: 33762
Buggy source:
@Override public Fragment getItem(int position){
  return EventListFragment.newInstance(mYear,position,null,getPageTitle(position).toString());
}

Fixed version (ground truth):
@Override public Fragment getItem(int position){
  EventListFragment f=EventListFragment.newInstance(mYear,position,null,getPageTitle(position).toString());
  fragments.add(position,f);
  return f;
}
Program: 33763
Project: 33763
Buggy source:
public void setLabels(ArrayList<String> labels){
  selectedTab=getPageTitle(pager.getCurrentItem()).toString();
  thisYearsWeekLabels=labels;
  mCount=thisYearsWeekLabels.size();
  pager.setAdapter(this);
  notifyDataSetChanged();
  pager.setCurrentItem(thisYearsWeekLabels.indexOf(selectedTab));
}

Fixed version (ground truth):
public void setLabels(ArrayList<String> labels){
  firstTabChanged=!getPageTitle(0).equals(labels.get(0));
  selectedTab=getPageTitle(pager.getCurrentItem()).toString();
  thisYearsWeekLabels=labels;
  mCount=thisYearsWeekLabels.size();
  pager.setAdapter(this);
  notifyDataSetChanged();
  pager.setCurrentItem(thisYearsWeekLabels.indexOf(selectedTab));
}
Program: 33764
Project: 33764
Buggy source:
public void notifyDataSetChanged(){
  super.notifyDataSetChanged();
  tabs.notifyDataSetChanged();
  if (tabsChanged) {
    for (int i=0; i < fragments.size(); i++) {
      fragments.get(i).updateHeader(getPageTitle(i).toString());
    }
  }
}

Fixed version (ground truth):
public void notifyDataSetChanged(){
  super.notifyDataSetChanged();
  tabs.notifyDataSetChanged();
  for (int i=0; i < fragments.size(); i++) {
    fragments.get(i).updateHeader(getPageTitle(i).toString());
  }
}
Program: 33765
Project: 33765
Buggy source:
public void setLabels(ArrayList<String> labels){
  tabsChanged=!thisYearsWeekLabels.equals(labels);
  selectedTab=getPageTitle(pager.getCurrentItem()).toString();
  thisYearsWeekLabels=labels;
  mCount=thisYearsWeekLabels.size();
  pager.setAdapter(this);
  notifyDataSetChanged();
  pager.setCurrentItem(thisYearsWeekLabels.indexOf(selectedTab));
}

Fixed version (ground truth):
public void setLabels(ArrayList<String> labels){
  tabsChanged=labels.size() != thisYearsWeekLabels.size() || !thisYearsWeekLabels.equals(labels);
  selectedTab=getPageTitle(pager.getCurrentItem()).toString();
  thisYearsWeekLabels=labels;
  mCount=thisYearsWeekLabels.size();
  pager.setAdapter(this);
  notifyDataSetChanged();
  pager.setCurrentItem(thisYearsWeekLabels.indexOf(selectedTab));
}
Program: 33767
Project: 33767
Buggy source:
@Override protected void onPostExecute(APIResponse.CODE code){
  super.onPostExecute(code);
  View view=mFragment.getView();
  if (view != null && activity != null) {
    ListViewAdapter adapter=new ListViewAdapter(activity,events);
    TextView noDataText=(TextView)view.findViewById(R.id.no_data);
    if (code == APIResponse.CODE.NODATA || adapter.values.isEmpty()) {
      noDataText.setText(R.string.no_event_data);
      noDataText.setVisibility(View.VISIBLE);
    }
 else {
      ListView eventList=(ListView)view.findViewById(R.id.list);
      Parcelable state=eventList.onSaveInstanceState();
      eventList.setAdapter(adapter);
      noDataText.setVisibility(View.GONE);
      eventList.onRestoreInstanceState(state);
    }
    if (code == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(mFragment.getString(R.string.warning_using_cached_data));
    }
    view.findViewById(R.id.progress).setVisibility(View.GONE);
    view.findViewById(R.id.list).setVisibility(View.VISIBLE);
    if (code == APIResponse.CODE.LOCAL && !isCancelled()) {
      new PopulateEventList(mFragment,mYear,mHeader,mTeamKey,false).execute();
    }
 else {
      Log.i(Constants.REFRESH_LOG,"String_Node_Str");
      if (mFragment instanceof RefreshListener) {
        activity.notifyRefreshComplete((RefreshListener)mFragment);
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void onPostExecute(APIResponse.CODE code){
  super.onPostExecute(code);
  View view=mFragment.getView();
  if (true || view != null && activity != null) {
    ListViewAdapter adapter=new ListViewAdapter(activity,events);
    TextView noDataText=(TextView)view.findViewById(R.id.no_data);
    if (code == APIResponse.CODE.NODATA || adapter.values.isEmpty()) {
      noDataText.setText(R.string.no_event_data);
      noDataText.setVisibility(View.VISIBLE);
    }
 else {
      ListView eventList=(ListView)view.findViewById(R.id.list);
      Parcelable state=eventList.onSaveInstanceState();
      eventList.setAdapter(adapter);
      noDataText.setVisibility(View.GONE);
      eventList.onRestoreInstanceState(state);
    }
    if (code == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(mFragment.getString(R.string.warning_using_cached_data));
    }
    view.findViewById(R.id.progress).setVisibility(View.GONE);
    view.findViewById(R.id.list).setVisibility(View.VISIBLE);
    if (code == APIResponse.CODE.LOCAL && !isCancelled()) {
      new PopulateEventList(mFragment,mYear,mHeader,mTeamKey,false).execute();
    }
 else {
      Log.i(Constants.REFRESH_LOG,"String_Node_Str");
      if (mFragment instanceof RefreshListener) {
        activity.notifyRefreshComplete((RefreshListener)mFragment);
      }
    }
  }
}
Program: 33768
Project: 33768
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mYear=getArguments().getInt(YEAR,-1);
  mWeek=getArguments().getInt(WEEK,-1);
  mTeamKey=getArguments().getString(TEAM_KEY);
  mHeader=getArguments().getString(WEEK_HEADER);
  parent=getActivity();
  if (parent instanceof RefreshableHostActivity) {
    ((RefreshableHostActivity)parent).registerRefreshableActivityListener(this);
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mYear=getArguments().getInt(YEAR,-1);
  mWeek=getArguments().getInt(WEEK,-1);
  mTeamKey=getArguments().getString(TEAM_KEY);
  mHeader=getArguments().getString(WEEK_HEADER);
  parent=getActivity();
  if (parent instanceof RefreshableHostActivity) {
    ((RefreshableHostActivity)parent).registerRefreshableActivityListener(this);
  }
  setRetainInstance(false);
}
Program: 33769
Project: 33769
Buggy source:
public void updateHeader(String newWeekHeader){
  mHeader=newWeekHeader;
  onRefreshStart();
}

Fixed version (ground truth):
public void updateHeader(String newWeekHeader){
  if (!newWeekHeader.equals(mHeader)) {
    mHeader=newWeekHeader;
    onRefreshStart();
  }
}
Program: 33770
Project: 33770
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  final View view=inflater.inflate(R.layout.fragment_event_list_fragment_pager,container,false);
  mViewPager=(ViewPager)view.findViewById(R.id.event_pager);
  mViewPager.setOffscreenPageLimit(50);
  final PagerSlidingTabStrip tabs=(PagerSlidingTabStrip)view.findViewById(R.id.event_pager_tabs);
  final Context c=getActivity();
  pagerAdapter=new EventsByWeekFragmentPagerAdapter(c,getChildFragmentManager(),mYear,tabs,mViewPager);
  mViewPager.setAdapter(pagerAdapter);
  mViewPager.setPageMargin(Utilities.getPixelsFromDp(getActivity(),16));
  tabs.setViewPager(mViewPager);
  int currentWeek=Utilities.getCurrentCompWeek();
  int currentYear=Utilities.getCurrentYear();
  int week1Index=((EventsByWeekFragmentPagerAdapter)mViewPager.getAdapter()).getLabels().indexOf(String.format(EventHelper.REGIONAL_LABEL,1));
  if (currentYear != mYear) {
    mViewPager.setCurrentItem(week1Index);
  }
 else {
    mViewPager.setCurrentItem((currentWeek > Utilities.getCmpWeek(mYear) + 1) ? Math.min(mViewPager.getAdapter().getCount(),week1Index) : currentWeek);
  }
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  final View view=inflater.inflate(R.layout.fragment_event_list_fragment_pager,container,false);
  mViewPager=(ViewPager)view.findViewById(R.id.event_pager);
  mViewPager.setOffscreenPageLimit(50);
  mTabs=(PagerSlidingTabStrip)view.findViewById(R.id.event_pager_tabs);
  final Context c=getActivity();
  if (pagerAdapter == null) {
    pagerAdapter=new EventsByWeekFragmentPagerAdapter(c,getChildFragmentManager(),mYear,mTabs,mViewPager);
  }
  mViewPager.setAdapter(pagerAdapter);
  mViewPager.setPageMargin(Utilities.getPixelsFromDp(getActivity(),16));
  mTabs.setViewPager(mViewPager);
  int currentWeek=Utilities.getCurrentCompWeek();
  int currentYear=Utilities.getCurrentYear();
  int week1Index=pagerAdapter.getLabels().indexOf(String.format(EventHelper.REGIONAL_LABEL,1));
  if (currentYear != mYear) {
    mViewPager.setCurrentItem(week1Index);
  }
 else {
    mViewPager.setCurrentItem((currentWeek > Utilities.getCmpWeek(mYear) + 1) ? Math.min(mViewPager.getAdapter().getCount(),week1Index) : currentWeek);
  }
  return view;
}
Program: 33771
Project: 33771
Buggy source:
@Override public boolean onNavigationItemSelected(int position,long id){
  if (position == mCurrentSelectedYearPosition) {
    return true;
  }
  mCurrentSelectedYear=Constants.MAX_COMP_YEAR - position;
  Log.d(Constants.LOG_TAG,"String_Node_Str" + mCurrentSelectedYear);
  getSupportFragmentManager().beginTransaction().setCustomAnimations(R.anim.fade_in_support,R.anim.fade_out_support).replace(R.id.container,EventsByWeekFragment.newInstance(mCurrentSelectedYear),MAIN_FRAGMENT_TAG).commit();
  mCurrentSelectedYearPosition=position;
  getActionBar().setSelectedNavigationItem(mCurrentSelectedYearPosition);
  return true;
}

Fixed version (ground truth):
@Override public boolean onNavigationItemSelected(int position,long id){
  if (position == mCurrentSelectedYearPosition) {
    return true;
  }
  int selectedYear=Constants.MAX_COMP_YEAR - position;
  Log.d(Constants.LOG_TAG,"String_Node_Str" + selectedYear);
  getSupportFragmentManager().beginTransaction().setCustomAnimations(R.anim.fade_in_support,R.anim.fade_out_support).replace(R.id.container,EventsByWeekFragment.newInstance(selectedYear),MAIN_FRAGMENT_TAG).commit();
  mCurrentSelectedYearPosition=position;
  getActionBar().setSelectedNavigationItem(mCurrentSelectedYearPosition);
  return true;
}