nus-yam/ex-repair huggingface dataset:
Program: 33849
Project: 33849
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  int id=item.getItemId();
  if (id == android.R.id.home) {
    Intent upIntent=NavUtils.getParentActivityIntent(this);
    String eventKey=mMatchKey.substring(0,mMatchKey.indexOf("String_Node_Str"));
    if (NavUtils.shouldUpRecreateTask(this,upIntent)) {
      Log.d(Constants.LOG_TAG,"String_Node_Str" + eventKey);
      TaskStackBuilder.create(this).addNextIntent(HomeActivity.newInstance(this,R.id.nav_item_events)).addNextIntent(ViewEventActivity.newInstance(this,eventKey)).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();
  if (id == android.R.id.home) {
    if (isDrawerOpen()) {
      closeDrawer();
      return true;
    }
    Intent upIntent=NavUtils.getParentActivityIntent(this);
    String eventKey=mMatchKey.substring(0,mMatchKey.indexOf("String_Node_Str"));
    if (NavUtils.shouldUpRecreateTask(this,upIntent)) {
      Log.d(Constants.LOG_TAG,"String_Node_Str" + eventKey);
      TaskStackBuilder.create(this).addNextIntent(HomeActivity.newInstance(this,R.id.nav_item_events)).addNextIntent(ViewEventActivity.newInstance(this,eventKey)).startActivities();
    }
 else {
      Log.d(Constants.LOG_TAG,"String_Node_Str");
      NavUtils.navigateUpTo(this,upIntent);
    }
    return true;
  }
  return super.onOptionsItemSelected(item);
}
Program: 33850
Project: 33850
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  int id=item.getItemId();
  if (id == android.R.id.home) {
    Intent upIntent=NavUtils.getParentActivityIntent(this);
    if (NavUtils.shouldUpRecreateTask(this,upIntent)) {
      TaskStackBuilder.create(this).addNextIntent(HomeActivity.newInstance(this,R.id.nav_item_teams)).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();
  if (id == 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_teams)).startActivities();
    }
 else {
      Log.d(Constants.LOG_TAG,"String_Node_Str");
      NavUtils.navigateUpTo(this,upIntent);
    }
    return true;
  }
  return super.onOptionsItemSelected(item);
}
Program: 33852
Project: 33852
Buggy source:
public MatchListElement(String youTubeVideoKey,String matchTitle,String[] redTeams,String[] blueTeams,String redScore,String blueScore,String matchKey,String selectedTeamKey){
  super();
  this.videoKey=youTubeVideoKey;
  this.matchTitle=matchTitle;
  this.redTeams=redTeams;
  this.blueTeams=blueTeams;
  this.redScore=redScore;
  this.blueScore=blueScore;
  this.matchKey=matchKey;
  this.selectedTeamKey=selectedTeamKey;
}

Fixed version (ground truth):
public MatchListElement(String youTubeVideoKey,String matchTitle,String[] redTeams,String[] blueTeams,String redScore,String blueScore,String matchKey,String selectedTeamKey){
  super();
  this.videoKey=youTubeVideoKey;
  this.matchTitle=matchTitle;
  this.redTeams=redTeams;
  this.blueTeams=blueTeams;
  this.redScore=redScore;
  this.blueScore=blueScore;
  this.matchKey=matchKey;
  this.selectedTeamNumber=selectedTeamKey.replace("String_Node_Str","String_Node_Str");
}
Program: 33854
Project: 33854
Buggy source:
@Override public boolean onCreateOptionsMenu(Menu menu){
  getMenuInflater().inflate(R.menu.search_menu,menu);
  return super.onCreateOptionsMenu(menu);
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(Menu menu){
  if (searchEnabled) {
    getMenuInflater().inflate(R.menu.search_menu,menu);
  }
  return super.onCreateOptionsMenu(menu);
}
Program: 33855
Project: 33855
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_contributors);
  setupActionBar();
  ((ListView)findViewById(android.R.id.list)).setOnItemClickListener(new AdapterView.OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> adapterView,    View view,    int position,    long id){
      String login=((ListElement)((ListViewAdapter)adapterView.getAdapter()).getItem(position)).getKey();
      String url="String_Node_Str" + login;
      startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(url)));
    }
  }
);
  if (ConnectionDetector.isConnectedToInternet(this)) {
    new PopulateContributors(this).execute();
  }
 else {
    findViewById(android.R.id.list).setVisibility(View.GONE);
    findViewById(R.id.no_data).setVisibility(View.VISIBLE);
    findViewById(R.id.progress).setVisibility(View.GONE);
  }
  registerRefreshableActivityListener(this);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_contributors);
  setupActionBar();
  ((ListView)findViewById(android.R.id.list)).setOnItemClickListener(new AdapterView.OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> adapterView,    View view,    int position,    long id){
      String login=((ListElement)((ListViewAdapter)adapterView.getAdapter()).getItem(position)).getKey();
      String url="String_Node_Str" + login;
      startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(url)));
    }
  }
);
  registerRefreshableActivityListener(this);
  setSearchEnabled(false);
}
Program: 33858
Project: 33858
Buggy source:
public void startRefresh(){
  mRefreshInProgress=true;
  if (mRefreshListeners.isEmpty()) {
    return;
  }
  for (  RefreshListener listener : mRefreshListeners) {
    listener.onRefreshStart();
  }
  if (mOptionsMenu != null) {
    MenuItem refresh=mOptionsMenu.findItem(R.id.refresh);
    refresh.setActionView(R.layout.actionbar_indeterminate_progress);
  }
}

Fixed version (ground truth):
public void startRefresh(){
  if (mRefreshInProgress) {
    return;
  }
  mRefreshInProgress=true;
  if (mRefreshListeners.isEmpty()) {
    return;
  }
  for (  RefreshListener listener : mRefreshListeners) {
    listener.onRefreshStart();
  }
  if (mOptionsMenu != null) {
    MenuItem refresh=mOptionsMenu.findItem(R.id.refresh);
    refresh.setActionView(R.layout.actionbar_indeterminate_progress);
  }
}
Program: 33860
Project: 33860
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_search_results);
  resultsList=(ListView)findViewById(R.id.results);
  getActionBar().setDisplayHomeAsUpEnabled(true);
  searchView=new SearchView(getActionBar().getThemedContext());
  searchView.setOnQueryTextListener(this);
  searchView.setIconified(false);
  searchView.setQueryHint(getString(R.string.search_hint));
  searchView.setOnCloseListener(new SearchView.OnCloseListener(){
    @Override public boolean onClose(){
      return true;
    }
  }
);
  closeButtonId=searchView.getContext().getResources().getIdentifier("String_Node_Str",null,null);
  searchView.findViewById(closeButtonId).setVisibility(View.GONE);
  ActionBar.LayoutParams layoutParams=new ActionBar.LayoutParams(ActionBar.LayoutParams.FILL_PARENT,ActionBar.LayoutParams.FILL_PARENT);
  getActionBar().setDisplayShowCustomEnabled(true);
  getActionBar().setCustomView(searchView,layoutParams);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_search_results);
  resultsList=(ListView)findViewById(R.id.results);
  getActionBar().setDisplayHomeAsUpEnabled(true);
  searchView=new SearchView(getActionBar().getThemedContext());
  searchView.setOnQueryTextListener(this);
  searchView.setIconifiedByDefault(false);
  searchView.setIconified(false);
  searchView.setQueryHint(getString(R.string.search_hint));
  searchView.setOnCloseListener(new SearchView.OnCloseListener(){
    @Override public boolean onClose(){
      return true;
    }
  }
);
  closeButtonId=searchView.getContext().getResources().getIdentifier("String_Node_Str",null,null);
  searchView.findViewById(closeButtonId).setVisibility(View.GONE);
  ActionBar.LayoutParams layoutParams=new ActionBar.LayoutParams(ActionBar.LayoutParams.FILL_PARENT,ActionBar.LayoutParams.FILL_PARENT);
  getActionBar().setDisplayShowCustomEnabled(true);
  getActionBar().setCustomView(searchView,layoutParams);
  int searchIconId=searchView.getContext().getResources().getIdentifier("String_Node_Str",null,null);
  searchView.findViewById(searchIconId).setLayoutParams(new LinearLayout.LayoutParams(0,0));
}
Program: 33862
Project: 33862
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.list_fragment_with_spinner,null);
  mListView=(ListView)view.findViewById(R.id.list);
  mListView.setFastScrollAlwaysVisible(true);
  mProgressBar=(ProgressBar)view.findViewById(R.id.progress);
  mListView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> adapterView,    View view,    int position,    long id){
      String teamKey=((ListElement)((ListViewAdapter)adapterView.getAdapter()).getItem(position)).getKey();
      Intent i=new Intent(getActivity(),ViewTeamActivity.class);
      i.putExtra(ViewTeamActivity.TEAM_KEY,teamKey);
      startActivity(i);
    }
  }
);
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.list_fragment_with_spinner,null);
  mListView=(ListView)view.findViewById(R.id.list);
  mListView.setFastScrollAlwaysVisible(true);
  mProgressBar=(ProgressBar)view.findViewById(R.id.progress);
  mListView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> adapterView,    View view,    int position,    long id){
      String teamKey=((TeamCursorAdapter)adapterView.getAdapter()).getKey(position);
      Intent i=new Intent(getActivity(),ViewTeamActivity.class);
      i.putExtra(ViewTeamActivity.TEAM_KEY,teamKey);
      startActivity(i);
    }
  }
);
  return view;
}
Program: 33863
Project: 33863
Buggy source:
@Override public void onItemClick(AdapterView<?> adapterView,View view,int position,long id){
  String teamKey=((ListElement)((ListViewAdapter)adapterView.getAdapter()).getItem(position)).getKey();
  Intent i=new Intent(getActivity(),ViewTeamActivity.class);
  i.putExtra(ViewTeamActivity.TEAM_KEY,teamKey);
  startActivity(i);
}

Fixed version (ground truth):
@Override public void onItemClick(AdapterView<?> adapterView,View view,int position,long id){
  String teamKey=((TeamCursorAdapter)adapterView.getAdapter()).getKey(position);
  Intent i=new Intent(getActivity(),ViewTeamActivity.class);
  i.putExtra(ViewTeamActivity.TEAM_KEY,teamKey);
  startActivity(i);
}
Program: 33864
Project: 33864
Buggy source:
@Override public void onClick(View v){
  if (v.getTag() != null) {
    if (v.getTag().equals("String_Node_Str")) {
      ((ViewEventActivity)getActivity()).getPager().setCurrentItem(2);
    }
 else     if (v.getTag().equals("String_Node_Str")) {
      ((ViewEventActivity)getActivity()).getPager().setCurrentItem(4);
    }
 else {
      PackageManager manager=getActivity().getPackageManager();
      String uri=v.getTag().toString();
      Intent i=new Intent(android.content.Intent.ACTION_VIEW,Uri.parse(uri));
      List<ResolveInfo> handlers=manager.queryIntentActivities(i,0);
      if (!handlers.isEmpty()) {
        startActivity(i);
      }
 else {
        Toast.makeText(getActivity(),"String_Node_Str",Toast.LENGTH_SHORT).show();
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onClick(View v){
  int id=v.getId();
  if (id == R.id.event_top_teams_container) {
    ((ViewEventActivity)getActivity()).getPager().setCurrentItem(2);
    return;
  }
 else   if (id == R.id.event_top_opr_container) {
    ((ViewEventActivity)getActivity()).getPager().setCurrentItem(4);
    return;
  }
  if (v.getTag() != null) {
    PackageManager manager=getActivity().getPackageManager();
    String uri=v.getTag().toString();
    Intent i=new Intent(android.content.Intent.ACTION_VIEW,Uri.parse(uri));
    List<ResolveInfo> handlers=manager.queryIntentActivities(i,0);
    if (!handlers.isEmpty()) {
      startActivity(i);
    }
 else {
      Toast.makeText(getActivity(),"String_Node_Str",Toast.LENGTH_SHORT).show();
    }
  }
}
Program: 33865
Project: 33865
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View info=inflater.inflate(R.layout.fragment_event_info,null);
  info.findViewById(R.id.event_location_container).setOnClickListener(this);
  info.findViewById(R.id.event_website_button).setOnClickListener(this);
  info.findViewById(R.id.event_twitter_button).setOnClickListener(this);
  info.findViewById(R.id.event_youtube_button).setOnClickListener(this);
  info.findViewById(R.id.event_cd_button).setOnClickListener(this);
  info.findViewById(R.id.event_top_teams_container).setOnClickListener(this);
  info.findViewById(R.id.top_opr_container).setOnClickListener(this);
  return info;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View info=inflater.inflate(R.layout.fragment_event_info,null);
  info.findViewById(R.id.event_location_container).setOnClickListener(this);
  info.findViewById(R.id.event_website_button).setOnClickListener(this);
  info.findViewById(R.id.event_twitter_button).setOnClickListener(this);
  info.findViewById(R.id.event_youtube_button).setOnClickListener(this);
  info.findViewById(R.id.event_cd_button).setOnClickListener(this);
  info.findViewById(R.id.event_top_teams_container).setOnClickListener(this);
  info.findViewById(R.id.event_top_opr_container).setOnClickListener(this);
  return info;
}
Program: 33867
Project: 33867
Buggy source:
public SimpleEvent getEvent(String eventKey){
  Cursor cursor=db.query(TABLE_EVENTS,new String[]{Events.KEY,Events.NAME,Events.TYPE,Events.DISTRICT,Events.START,Events.END,Events.LOCATION,Events.OFFICIAL,Events.DISTRICT_STRING},Events.KEY + "String_Node_Str",new String[]{eventKey},null,null,null,null);
  if (cursor != null && cursor.moveToFirst()) {
    SimpleEvent event=new SimpleEvent();
    event.setEventKey(cursor.getString(0));
    event.setEventName(cursor.getString(1));
    event.setEventType(EventHelper.TYPE.values()[cursor.getInt(2)]);
    event.setDistrictEnum(cursor.getInt(3));
    event.setStartDate(cursor.getString(4));
    event.setEndDate(cursor.getString(5));
    event.setLocation(cursor.getString(6));
    event.setOfficial(cursor.getInt(7) == 1);
    event.setDistrictTitle(cursor.getString(8));
    return event;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public SimpleEvent getEvent(String eventKey){
  Cursor cursor=db.query(TABLE_EVENTS,new String[]{Events.KEY,Events.NAME,Events.TYPE,Events.DISTRICT,Events.START,Events.END,Events.LOCATION,Events.OFFICIAL,Events.DISTRICT_STRING},Events.KEY + "String_Node_Str",new String[]{eventKey},null,null,null,null);
  if (cursor != null && cursor.moveToFirst()) {
    SimpleEvent event=new SimpleEvent();
    event.setEventKey(cursor.getString(0));
    event.setEventName(cursor.getString(1));
    event.setEventType(EventHelper.TYPE.values()[cursor.getInt(2)]);
    event.setDistrictEnum(cursor.getInt(3));
    event.setStartDate(cursor.getString(4));
    event.setEndDate(cursor.getString(5));
    event.setLocation(cursor.getString(6));
    event.setOfficial(cursor.getInt(7) == 1);
    event.setDistrictTitle(cursor.getString(8));
    cursor.close();
    return event;
  }
 else {
    return null;
  }
}
Program: 33868
Project: 33868
Buggy source:
public SimpleTeam getTeam(String teamKey){
  Cursor cursor=db.query(TABLE_TEAMS,new String[]{Teams.KEY,Teams.NUMBER,Teams.NAME,Teams.SHORTNAME,Teams.LOCATION},Teams.KEY + "String_Node_Str",new String[]{teamKey},null,null,null,null);
  if (cursor != null && cursor.moveToFirst()) {
    SimpleTeam team=new SimpleTeam();
    team.setTeamKey(cursor.getString(0));
    team.setTeamNumber(cursor.getInt(1));
    team.setFullName(cursor.getString(2));
    team.setNickname(cursor.getString(3));
    team.setLocation(cursor.getString(4));
    return team;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public SimpleTeam getTeam(String teamKey){
  Cursor cursor=db.query(TABLE_TEAMS,new String[]{Teams.KEY,Teams.NUMBER,Teams.NAME,Teams.SHORTNAME,Teams.LOCATION},Teams.KEY + "String_Node_Str",new String[]{teamKey},null,null,null,null);
  if (cursor != null && cursor.moveToFirst()) {
    SimpleTeam team=new SimpleTeam();
    team.setTeamKey(cursor.getString(0));
    team.setTeamNumber(cursor.getInt(1));
    team.setFullName(cursor.getString(2));
    team.setNickname(cursor.getString(3));
    team.setLocation(cursor.getString(4));
    cursor.close();
    return team;
  }
 else {
    return null;
  }
}
Program: 33869
Project: 33869
Buggy source:
public ArrayList<SimpleEvent> getEventsInYear(int year){
  ArrayList<SimpleEvent> events=new ArrayList<>();
  Cursor cursor=db.query(TABLE_EVENTS,new String[]{Events.KEY,Events.NAME,Events.TYPE,Events.DISTRICT,Events.START,Events.END,Events.LOCATION,Events.OFFICIAL,Events.DISTRICT_STRING},Events.KEY + "String_Node_Str",new String[]{Integer.toString(year) + "String_Node_Str"},null,null,null,null);
  if (cursor != null && cursor.moveToFirst()) {
    do {
      SimpleEvent event=new SimpleEvent();
      event.setEventKey(cursor.getString(0));
      event.setEventName(cursor.getString(1));
      event.setEventType(EventHelper.TYPE.values()[cursor.getInt(2)]);
      event.setDistrictEnum(cursor.getInt(3));
      event.setStartDate(cursor.getString(4));
      event.setEndDate(cursor.getString(5));
      event.setLocation(cursor.getString(6));
      event.setOfficial(cursor.getInt(7) == 1);
      event.setDistrictTitle(cursor.getString(8));
      events.add(event);
    }
 while (cursor.moveToNext());
    return events;
  }
 else {
    Log.w(Constants.LOG_TAG,"String_Node_Str" + year);
    return null;
  }
}

Fixed version (ground truth):
public ArrayList<SimpleEvent> getEventsInYear(int year){
  ArrayList<SimpleEvent> events=new ArrayList<>();
  Cursor cursor=db.query(TABLE_EVENTS,new String[]{Events.KEY,Events.NAME,Events.TYPE,Events.DISTRICT,Events.START,Events.END,Events.LOCATION,Events.OFFICIAL,Events.DISTRICT_STRING},Events.KEY + "String_Node_Str",new String[]{Integer.toString(year) + "String_Node_Str"},null,null,null,null);
  if (cursor != null && cursor.moveToFirst()) {
    do {
      SimpleEvent event=new SimpleEvent();
      event.setEventKey(cursor.getString(0));
      event.setEventName(cursor.getString(1));
      event.setEventType(EventHelper.TYPE.values()[cursor.getInt(2)]);
      event.setDistrictEnum(cursor.getInt(3));
      event.setStartDate(cursor.getString(4));
      event.setEndDate(cursor.getString(5));
      event.setLocation(cursor.getString(6));
      event.setOfficial(cursor.getInt(7) == 1);
      event.setDistrictTitle(cursor.getString(8));
      events.add(event);
    }
 while (cursor.moveToNext());
    cursor.close();
    return events;
  }
 else {
    Log.w(Constants.LOG_TAG,"String_Node_Str" + year);
    return null;
  }
}
Program: 33870
Project: 33870
Buggy source:
public boolean eventExists(String key){
  Cursor cursor=db.query(TABLE_EVENTS,new String[]{Events.KEY},Events.KEY + "String_Node_Str",new String[]{key},null,null,null,null);
  return cursor != null && cursor.moveToFirst();
}

Fixed version (ground truth):
public boolean eventExists(String key){
  Cursor cursor=db.query(TABLE_EVENTS,new String[]{Events.KEY},Events.KEY + "String_Node_Str",new String[]{key},null,null,null,null);
  boolean exists=cursor != null && cursor.moveToFirst();
  cursor.close();
  return exists;
}
Program: 33871
Project: 33871
Buggy source:
public String getResponse(String url){
  Cursor cursor=db.query(TABLE_API,new String[]{Response.URL,Response.RESPONSE,Response.LASTUPDATE},Response.URL + "String_Node_Str",new String[]{url},null,null,null,null);
  if (cursor != null && cursor.moveToFirst()) {
    return cursor.getString(1);
  }
 else {
    Log.w(Constants.LOG_TAG,"String_Node_Str" + url);
    return null;
  }
}

Fixed version (ground truth):
public String getResponse(String url){
  Cursor cursor=db.query(TABLE_API,new String[]{Response.URL,Response.RESPONSE,Response.LASTUPDATE},Response.URL + "String_Node_Str",new String[]{url},null,null,null,null);
  if (cursor != null && cursor.moveToFirst()) {
    String response=cursor.getString(1);
    cursor.close();
    return response;
  }
 else {
    Log.w(Constants.LOG_TAG,"String_Node_Str" + url);
    return null;
  }
}
Program: 33872
Project: 33872
Buggy source:
public boolean responseExists(String url){
  Cursor cursor=db.query(TABLE_API,new String[]{Response.URL},Response.URL + "String_Node_Str",new String[]{url},null,null,null,null);
  return (cursor.moveToFirst()) || (cursor.getCount() != 0);
}

Fixed version (ground truth):
public boolean responseExists(String url){
  Cursor cursor=db.query(TABLE_API,new String[]{Response.URL},Response.URL + "String_Node_Str",new String[]{url},null,null,null,null);
  boolean exists=(cursor.moveToFirst()) || (cursor.getCount() != 0);
  cursor.close();
  return exists;
}
Program: 33873
Project: 33873
Buggy source:
public ArrayList<SimpleTeam> getTeamsInRange(int lowerBound,int upperBound){
  ArrayList<SimpleTeam> teams=new ArrayList<>();
  Cursor cursor=db.query(TABLE_TEAMS,new String[]{Teams.KEY,Teams.NUMBER,Teams.NAME,Teams.SHORTNAME,Teams.LOCATION},Teams.NUMBER + "String_Node_Str",new String[]{"String_Node_Str" + lowerBound,"String_Node_Str" + upperBound},null,null,null,null);
  cursor.moveToPosition(-1);
  while (cursor.moveToNext()) {
    teams.add(new SimpleTeam(cursor.getString(0),cursor.getInt(1),cursor.getString(3),cursor.getString(4),-1));
  }
  return teams;
}

Fixed version (ground truth):
public ArrayList<SimpleTeam> getTeamsInRange(int lowerBound,int upperBound){
  ArrayList<SimpleTeam> teams=new ArrayList<>();
  Cursor cursor=db.query(TABLE_TEAMS,new String[]{Teams.KEY,Teams.NUMBER,Teams.NAME,Teams.SHORTNAME,Teams.LOCATION},Teams.NUMBER + "String_Node_Str",new String[]{"String_Node_Str" + lowerBound,"String_Node_Str" + upperBound},null,null,null,null);
  cursor.moveToPosition(-1);
  while (cursor.moveToNext()) {
    teams.add(new SimpleTeam(cursor.getString(0),cursor.getInt(1),cursor.getString(3),cursor.getString(4),-1));
  }
  cursor.close();
  return teams;
}
Program: 33874
Project: 33874
Buggy source:
public ArrayList<SimpleEvent> getEventsInWeek(int year,int week){
  ArrayList<SimpleEvent> events=new ArrayList<>();
  Cursor cursor=db.query(TABLE_EVENTS,new String[]{Events.KEY,Events.NAME,Events.TYPE,Events.DISTRICT,Events.START,Events.END,Events.LOCATION,Events.OFFICIAL,Events.DISTRICT_STRING},Events.KEY + "String_Node_Str" + Events.WEEK+ "String_Node_Str",new String[]{Integer.toString(year) + "String_Node_Str",Integer.toString(week)},null,null,null,null);
  if (cursor != null && cursor.moveToFirst()) {
    do {
      SimpleEvent event=new SimpleEvent();
      event.setEventKey(cursor.getString(0));
      event.setEventName(cursor.getString(1));
      event.setEventType(EventHelper.TYPE.values()[cursor.getInt(2)]);
      event.setDistrictEnum(cursor.getInt(3));
      event.setStartDate(cursor.getString(4));
      event.setEndDate(cursor.getString(5));
      event.setLocation(cursor.getString(6));
      event.setOfficial(cursor.getInt(7) == 1);
      event.setDistrictTitle(cursor.getString(8));
      events.add(event);
    }
 while (cursor.moveToNext());
    return events;
  }
 else {
    Log.w(Constants.LOG_TAG,"String_Node_Str" + year + "String_Node_Str"+ week);
    return null;
  }
}

Fixed version (ground truth):
public ArrayList<SimpleEvent> getEventsInWeek(int year,int week){
  ArrayList<SimpleEvent> events=new ArrayList<>();
  Cursor cursor=db.query(TABLE_EVENTS,new String[]{Events.KEY,Events.NAME,Events.TYPE,Events.DISTRICT,Events.START,Events.END,Events.LOCATION,Events.OFFICIAL,Events.DISTRICT_STRING},Events.KEY + "String_Node_Str" + Events.WEEK+ "String_Node_Str",new String[]{Integer.toString(year) + "String_Node_Str",Integer.toString(week)},null,null,null,null);
  if (cursor != null && cursor.moveToFirst()) {
    do {
      SimpleEvent event=new SimpleEvent();
      event.setEventKey(cursor.getString(0));
      event.setEventName(cursor.getString(1));
      event.setEventType(EventHelper.TYPE.values()[cursor.getInt(2)]);
      event.setDistrictEnum(cursor.getInt(3));
      event.setStartDate(cursor.getString(4));
      event.setEndDate(cursor.getString(5));
      event.setLocation(cursor.getString(6));
      event.setOfficial(cursor.getInt(7) == 1);
      event.setDistrictTitle(cursor.getString(8));
      events.add(event);
    }
 while (cursor.moveToNext());
    cursor.close();
    return events;
  }
 else {
    Log.w(Constants.LOG_TAG,"String_Node_Str" + year + "String_Node_Str"+ week);
    return null;
  }
}
Program: 33880
Project: 33880
Buggy source:
public static synchronized APIResponse<HashMap<Match.TYPE,ArrayList<Match>>> getEventResults(Context c,String eventKey,String teamKey) throws NoDataException {
  HashMap<Match.TYPE,ArrayList<Match>> results=new HashMap<Match.TYPE,ArrayList<Match>>();
  results.put(Match.TYPE.QUAL,new ArrayList<Match>());
  results.put(Match.TYPE.QUARTER,new ArrayList<Match>());
  results.put(Match.TYPE.SEMI,new ArrayList<Match>());
  results.put(Match.TYPE.FINAL,new ArrayList<Match>());
  Log.d("String_Node_Str","String_Node_Str" + eventKey);
  APIResponse<String> response=TBAv2.getResponseFromURLOrThrow(c,"String_Node_Str" + eventKey + "String_Node_Str",true);
  Iterator<JsonElement> iterator=JSONManager.getasJsonArray(response.getData()).iterator();
  while (iterator.hasNext()) {
    Match match=JSONManager.getGson().fromJson(iterator.next().getAsJsonObject(),Match.class);
    if (match.getAlliances().toString().contains(teamKey)) {
      results.get(match.getType()).add(match);
    }
  }
  return new APIResponse<>(results,response.getCode());
}

Fixed version (ground truth):
public static synchronized APIResponse<HashMap<Match.TYPE,ArrayList<Match>>> getEventResults(Context c,String eventKey,String teamKey) throws NoDataException {
  HashMap<Match.TYPE,ArrayList<Match>> results=new HashMap<Match.TYPE,ArrayList<Match>>();
  results.put(Match.TYPE.QUAL,new ArrayList<Match>());
  results.put(Match.TYPE.QUARTER,new ArrayList<Match>());
  results.put(Match.TYPE.SEMI,new ArrayList<Match>());
  results.put(Match.TYPE.FINAL,new ArrayList<Match>());
  Log.d("String_Node_Str","String_Node_Str" + eventKey);
  APIResponse<String> response=TBAv2.getResponseFromURLOrThrow(c,"String_Node_Str" + eventKey + "String_Node_Str",true);
  Iterator<JsonElement> iterator=JSONManager.getasJsonArray(response.getData()).iterator();
  while (iterator.hasNext()) {
    Match match=JSONManager.getGson().fromJson(iterator.next().getAsJsonObject(),Match.class);
    if (match.getAlliances().toString().contains(teamKey + "String_Node_Str")) {
      results.get(match.getType()).add(match);
    }
  }
  return new APIResponse<>(results,response.getCode());
}
Program: 33881
Project: 33881
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_team_at_event);
  Bundle extras=getIntent().getExtras();
  if (extras != null && (extras.containsKey(EVENT) && extras.containsKey(TEAM))) {
    teamKey=extras.getString(TEAM);
    eventKey=extras.getString(EVENT);
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  getActionBar().setDisplayHomeAsUpEnabled(true);
  getSupportFragmentManager().beginTransaction().add(R.id.content,EventResultsFragment.newInstance(eventKey,teamKey)).commit();
  warningMessage=(TextView)findViewById(R.id.warning_container);
  hideWarningMessage();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_team_at_event);
  Bundle extras=getIntent().getExtras();
  if (extras != null && (extras.containsKey(EVENT) && extras.containsKey(TEAM))) {
    teamKey=extras.getString(TEAM);
    eventKey=extras.getString(EVENT);
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  getActionBar().setDisplayHomeAsUpEnabled(true);
  FragmentManager manager=getSupportFragmentManager();
  Fragment f=manager.findFragmentByTag("String_Node_Str");
  if (f == null) {
    manager.beginTransaction().add(R.id.content,EventResultsFragment.newInstance(eventKey,teamKey),"String_Node_Str").commit();
  }
 else {
    f.onResume();
  }
  warningMessage=(TextView)findViewById(R.id.warning_container);
  hideWarningMessage();
}
Program: 33882
Project: 33882
Buggy source:
protected void onPostExecute(APIResponse.CODE code){
  View view=mFragment.getView();
  if (view != null && activity != null) {
    MatchListAdapter adapter=new MatchListAdapter(activity,groups,teamKey);
    ExpandableListView listView=(ExpandableListView)view.findViewById(R.id.match_results);
    listView.setAdapter(adapter);
    if (teamKey.isEmpty()) {
      activity.getActionBar().setTitle(event.getEventName());
    }
 else {
      activity.getActionBar().setTitle(teamKey.substring(3) + "String_Node_Str" + event.getShortName());
      ((TextView)activity.findViewById(R.id.team_record)).setText(Html.fromHtml(String.format(activity.getString(R.string.team_record),teamKey.substring(3),rank,recordString)));
      activity.findViewById(R.id.content_view).setVisibility(View.VISIBLE);
    }
    if (code == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(activity.getString(R.string.warning_using_cached_data));
    }
    view.findViewById(R.id.progress).setVisibility(View.GONE);
  }
}

Fixed version (ground truth):
protected void onPostExecute(APIResponse.CODE code){
  View view=mFragment.getView();
  if (view != null && activity != null) {
    MatchListAdapter adapter=new MatchListAdapter(activity,groups,teamKey);
    ExpandableListView listView=(ExpandableListView)view.findViewById(R.id.match_results);
    listView.setAdapter(adapter);
    if (teamKey.isEmpty()) {
      activity.getActionBar().setTitle(event.getEventName());
    }
 else {
      activity.getActionBar().setTitle(teamKey.substring(3) + "String_Node_Str" + event.getShortName());
      ((TextView)activity.findViewById(R.id.team_record)).setText(Html.fromHtml(String.format(activity.getString(R.string.team_record),teamKey.substring(3),rank,recordString)));
      activity.findViewById(R.id.team_at_event_info).setVisibility(View.VISIBLE);
    }
    if (code == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(activity.getString(R.string.warning_using_cached_data));
    }
    view.findViewById(R.id.progress).setVisibility(View.GONE);
  }
}
Program: 33884
Project: 33884
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activty_start);
  warningMessage=(TextView)findViewById(R.id.warning_container);
  hideWarningMessage();
  int initNavId=R.id.nav_item_events;
  Bundle b=getIntent().getExtras();
  if (b != null) {
    if (b.containsKey(REQUESTED_MODE)) {
      if (b.getInt(REQUESTED_MODE,-1) != -1) {
        initNavId=b.getInt(REQUESTED_MODE);
      }
    }
  }
  if (savedInstanceState != null) {
    if (savedInstanceState.containsKey(STATE_SELECTED_NAV_ID)) {
      initNavId=savedInstanceState.getInt(STATE_SELECTED_NAV_ID);
    }
    if (savedInstanceState.containsKey(STATE_SELECTED_YEAR_SPINNER_POSITION) && getActionBar().getNavigationMode() == ActionBar.NAVIGATION_MODE_LIST) {
      getActionBar().setSelectedNavigationItem(savedInstanceState.getInt(STATE_SELECTED_YEAR_SPINNER_POSITION));
    }
  }
  switchToModeForId(initNavId);
  if (!ConnectionDetector.isConnectedToInternet(this)) {
    showWarningMessage(getString(R.string.warning_unable_to_load));
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_start);
  warningMessage=(TextView)findViewById(R.id.warning_container);
  hideWarningMessage();
  int initNavId=R.id.nav_item_events;
  Bundle b=getIntent().getExtras();
  if (b != null) {
    if (b.containsKey(REQUESTED_MODE)) {
      if (b.getInt(REQUESTED_MODE,-1) != -1) {
        initNavId=b.getInt(REQUESTED_MODE);
      }
    }
  }
  if (savedInstanceState != null) {
    if (savedInstanceState.containsKey(STATE_SELECTED_NAV_ID)) {
      initNavId=savedInstanceState.getInt(STATE_SELECTED_NAV_ID);
    }
    if (savedInstanceState.containsKey(STATE_SELECTED_YEAR_SPINNER_POSITION) && getActionBar().getNavigationMode() == ActionBar.NAVIGATION_MODE_LIST) {
      getActionBar().setSelectedNavigationItem(savedInstanceState.getInt(STATE_SELECTED_YEAR_SPINNER_POSITION));
    }
  }
  switchToModeForId(initNavId);
  if (!ConnectionDetector.isConnectedToInternet(this)) {
    showWarningMessage(getString(R.string.warning_unable_to_load));
  }
}
Program: 33885
Project: 33885
Buggy source:
public PopulateEventList(EventListFragment fragment,int year,int week,String teamKey){
  mFragment=fragment;
  mYear=year;
  mWeek=week;
  mTeamKey=teamKey;
}

Fixed version (ground truth):
public PopulateEventList(EventListFragment fragment,int year,int week,String teamKey){
  mFragment=fragment;
  mYear=year;
  mWeek=week;
  mTeamKey=teamKey;
  activity=(RefreshableHostActivity)mFragment.getActivity();
}
Program: 33886
Project: 33886
Buggy source:
@Override protected void onPostExecute(APIResponse.CODE c){
  super.onPostExecute(c);
  if (mFragment.getView() != null && mFragment.getActivity() != null) {
    ListView eventList=(ListView)mFragment.getView().findViewById(R.id.list);
    ListViewAdapter adapter=new ListViewAdapter(mFragment.getActivity(),events);
    eventList.setAdapter(adapter);
    if (c == APIResponse.CODE.OFFLINECACHE) {
      ((RefreshableHostActivity)mFragment.getActivity()).showWarningMessage(mFragment.getString(R.string.warning_using_cached_data));
    }
    mFragment.getView().findViewById(R.id.progress).setVisibility(View.GONE);
  }
}

Fixed version (ground truth):
@Override protected void onPostExecute(APIResponse.CODE c){
  super.onPostExecute(c);
  View view=mFragment.getView();
  if (view != null && activity != null) {
    ListView eventList=(ListView)view.findViewById(R.id.list);
    ListViewAdapter adapter=new ListViewAdapter(activity,events);
    eventList.setAdapter(adapter);
    if (c == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(mFragment.getString(R.string.warning_using_cached_data));
    }
    view.findViewById(R.id.progress).setVisibility(View.GONE);
  }
}
Program: 33887
Project: 33887
Buggy source:
@Override protected void onPostExecute(APIResponse.CODE code){
  super.onPostExecute(code);
  if (fragment.getActivity() != null) {
    adapter=new ListViewAdapter(fragment.getActivity(),teamItems);
  }
  if (fragment.getView() != null) {
    ListView eventList=(ListView)fragment.getView().findViewById(R.id.list);
    eventList.setAdapter(adapter);
    if (code == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(fragment.getString(R.string.warning_using_cached_data));
    }
    fragment.getView().findViewById(R.id.progress).setVisibility(View.GONE);
  }
}

Fixed version (ground truth):
@Override protected void onPostExecute(APIResponse.CODE code){
  super.onPostExecute(code);
  View view=fragment.getView();
  if (activity != null && view != null) {
    adapter=new ListViewAdapter(fragment.getActivity(),teamItems);
    ListView eventList=(ListView)fragment.getView().findViewById(R.id.list);
    eventList.setAdapter(adapter);
    if (code == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(fragment.getString(R.string.warning_using_cached_data));
    }
    view.findViewById(R.id.progress).setVisibility(View.GONE);
  }
}
Program: 33890
Project: 33890
Buggy source:
@Override protected void onPostExecute(APIResponse.CODE code){
  View view=mFragment.getView();
  if (view != null && mFragment.getActivity() != null) {
    ListView rankings=(ListView)view.findViewById(R.id.list);
    ListViewAdapter adapter=new ListViewAdapter(mFragment.getActivity(),teams);
    rankings.setAdapter(adapter);
    if (code == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(activity.getString(R.string.warning_using_cached_data));
    }
    view.findViewById(R.id.progress).setVisibility(View.GONE);
  }
}

Fixed version (ground truth):
@Override protected void onPostExecute(APIResponse.CODE code){
  View view=mFragment.getView();
  if (view != null && activity != null) {
    ListView rankings=(ListView)view.findViewById(R.id.list);
    ListViewAdapter adapter=new ListViewAdapter(activity,teams);
    rankings.setAdapter(adapter);
    if (code == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(activity.getString(R.string.warning_using_cached_data));
    }
    view.findViewById(R.id.progress).setVisibility(View.GONE);
  }
}
Program: 33891
Project: 33891
Buggy source:
protected void onPostExecute(APIResponse.CODE code){
  View view=mFragment.getView();
  if (view != null && mFragment.getActivity() != null) {
    MatchListAdapter adapter=new MatchListAdapter(activity,groups);
    ExpandableListView listView=(ExpandableListView)view.findViewById(R.id.match_results);
    listView.setAdapter(adapter);
    if (code == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(activity.getString(R.string.warning_using_cached_data));
    }
    view.findViewById(R.id.progress).setVisibility(View.GONE);
  }
}

Fixed version (ground truth):
protected void onPostExecute(APIResponse.CODE code){
  View view=mFragment.getView();
  if (view != null && activity != null) {
    MatchListAdapter adapter=new MatchListAdapter(activity,groups);
    ExpandableListView listView=(ExpandableListView)view.findViewById(R.id.match_results);
    listView.setAdapter(adapter);
    if (code == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(activity.getString(R.string.warning_using_cached_data));
    }
    view.findViewById(R.id.progress).setVisibility(View.GONE);
  }
}
Program: 33892
Project: 33892
Buggy source:
@Override protected void onPostExecute(APIResponse.CODE code){
  View view=mFragment.getView();
  if (view != null && mFragment != null) {
    ListViewAdapter adapter=new ListViewAdapter(mFragment.getActivity(),teams);
    ListView stats=(ListView)view.findViewById(R.id.list);
    stats.setAdapter(adapter);
    if (code == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(activity.getString(R.string.warning_using_cached_data));
    }
    view.findViewById(R.id.progress).setVisibility(View.GONE);
  }
}

Fixed version (ground truth):
@Override protected void onPostExecute(APIResponse.CODE code){
  View view=mFragment.getView();
  if (view != null && activity != null) {
    ListViewAdapter adapter=new ListViewAdapter(activity,teams);
    ListView stats=(ListView)view.findViewById(R.id.list);
    stats.setAdapter(adapter);
    if (code == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(activity.getString(R.string.warning_using_cached_data));
    }
    view.findViewById(R.id.progress).setVisibility(View.GONE);
  }
}
Program: 33893
Project: 33893
Buggy source:
@Override protected void onPostExecute(APIResponse.CODE c){
  super.onPostExecute(c);
  View view=mFragment.getView();
  if (view != null && mFragment.getActivity() != null) {
    ListViewAdapter adapter=new ListViewAdapter(mFragment.getActivity(),teams);
    adapter.notifyDataSetChanged();
    ListView teamList=(ListView)view.findViewById(R.id.list);
    teamList.setAdapter(adapter);
    if (c == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(activity.getString(R.string.warning_using_cached_data));
    }
    view.findViewById(R.id.progress).setVisibility(View.GONE);
  }
}

Fixed version (ground truth):
@Override protected void onPostExecute(APIResponse.CODE c){
  super.onPostExecute(c);
  View view=mFragment.getView();
  if (view != null && activity != null) {
    ListViewAdapter adapter=new ListViewAdapter(activity,teams);
    adapter.notifyDataSetChanged();
    ListView teamList=(ListView)view.findViewById(R.id.list);
    teamList.setAdapter(adapter);
    if (c == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(activity.getString(R.string.warning_using_cached_data));
    }
    view.findViewById(R.id.progress).setVisibility(View.GONE);
  }
}
Program: 33894
Project: 33894
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.list_fragment_with_spinner,null);
  mListView=(ListView)view.findViewById(R.id.list);
  mProgressBar=(ProgressBar)view.findViewById(R.id.progress);
  if (mAdapter != null) {
    mListView.setAdapter(mAdapter);
    mListView.onRestoreInstanceState(mListState);
    mProgressBar.setVisibility(View.GONE);
  }
 else {
    mTask=new PopulateEventAwards(this);
    mTask.execute(mEventKey);
  }
  mListView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> adapterView,    View view,    int position,    long id){
      String eventKey=((ListElement)((ListViewAdapter)adapterView.getAdapter()).getItem(position)).getKey();
      startActivity(ViewTeamActivity.newInstance(getActivity(),eventKey));
    }
  }
);
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.list_fragment_with_spinner,null);
  mListView=(ListView)view.findViewById(R.id.list);
  mProgressBar=(ProgressBar)view.findViewById(R.id.progress);
  if (mAdapter != null) {
    mListView.setAdapter(mAdapter);
    mListView.onRestoreInstanceState(mListState);
    mProgressBar.setVisibility(View.GONE);
  }
 else {
    mTask=new PopulateEventAwards(this);
    mTask.execute(mEventKey);
  }
  mListView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> adapterView,    View view,    int position,    long id){
      String eventKey=((ListElement)((ListViewAdapter)adapterView.getAdapter()).getItem(position)).getKey();
      if (!eventKey.equals("String_Node_Str")) {
        startActivity(ViewTeamActivity.newInstance(getActivity(),eventKey));
      }
    }
  }
);
  return view;
}
Program: 33895
Project: 33895
Buggy source:
@Override public void onItemClick(AdapterView<?> adapterView,View view,int position,long id){
  String eventKey=((ListElement)((ListViewAdapter)adapterView.getAdapter()).getItem(position)).getKey();
  startActivity(ViewTeamActivity.newInstance(getActivity(),eventKey));
}

Fixed version (ground truth):
@Override public void onItemClick(AdapterView<?> adapterView,View view,int position,long id){
  String eventKey=((ListElement)((ListViewAdapter)adapterView.getAdapter()).getItem(position)).getKey();
  if (!eventKey.equals("String_Node_Str")) {
    startActivity(ViewTeamActivity.newInstance(getActivity(),eventKey));
  }
}
Program: 33896
Project: 33896
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_start);
  warningMessage=(TextView)findViewById(R.id.warning_container);
  hideWarningMessage();
  int currentYear=Calendar.getInstance().get(Calendar.YEAR);
  dropdownItems=new String[currentYear - oldestYearToDisplay + 1];
  for (int i=0; i < dropdownItems.length; i++) {
    dropdownItems[i]=Integer.toString(currentYear - i);
  }
  int initNavId=R.id.nav_item_events;
  Bundle b=getIntent().getExtras();
  if (b != null) {
    if (b.containsKey(REQUESTED_MODE)) {
      if (b.getInt(REQUESTED_MODE,-1) != -1) {
        initNavId=b.getInt(REQUESTED_MODE);
      }
    }
  }
  if (savedInstanceState != null) {
    if (savedInstanceState.containsKey(STATE_SELECTED_NAV_ID)) {
      initNavId=savedInstanceState.getInt(STATE_SELECTED_NAV_ID);
    }
    if (savedInstanceState.containsKey(STATE_SELECTED_YEAR_SPINNER_POSITION) && getActionBar().getNavigationMode() == ActionBar.NAVIGATION_MODE_LIST) {
      getActionBar().setSelectedNavigationItem(savedInstanceState.getInt(STATE_SELECTED_YEAR_SPINNER_POSITION));
    }
  }
  switchToModeForId(initNavId);
  if (!ConnectionDetector.isConnectedToInternet(this)) {
    showWarningMessage(getString(R.string.warning_unable_to_load));
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_start);
  warningMessage=(TextView)findViewById(R.id.warning_container);
  hideWarningMessage();
  int currentYear=Calendar.getInstance().get(Calendar.YEAR);
  dropdownItems=new String[currentYear - oldestYearToDisplay + 1];
  for (int i=0; i < dropdownItems.length; i++) {
    dropdownItems[i]=Integer.toString(currentYear - i);
  }
  int initNavId=R.id.nav_item_events;
  Bundle b=getIntent().getExtras();
  if (b != null) {
    if (b.containsKey(REQUESTED_MODE)) {
      if (b.getInt(REQUESTED_MODE,-1) != -1) {
        initNavId=b.getInt(REQUESTED_MODE);
      }
    }
  }
  if (savedInstanceState != null) {
    fromSavedInstance=true;
    if (savedInstanceState.containsKey(STATE_SELECTED_NAV_ID)) {
      initNavId=savedInstanceState.getInt(STATE_SELECTED_NAV_ID);
    }
    if (savedInstanceState.containsKey(STATE_SELECTED_YEAR_SPINNER_POSITION) && getActionBar().getNavigationMode() == ActionBar.NAVIGATION_MODE_LIST) {
      getActionBar().setSelectedNavigationItem(savedInstanceState.getInt(STATE_SELECTED_YEAR_SPINNER_POSITION));
    }
  }
  switchToModeForId(initNavId);
  if (!ConnectionDetector.isConnectedToInternet(this)) {
    showWarningMessage(getString(R.string.warning_unable_to_load));
  }
}
Program: 33897
Project: 33897
Buggy source:
@Override public boolean onNavigationItemSelected(int position,long id){
  Log.d(Constants.LOG_TAG,"String_Node_Str" + Integer.parseInt(dropdownItems[position]));
  getSupportFragmentManager().beginTransaction().setCustomAnimations(R.anim.fade_in,R.anim.fade_out).replace(R.id.container,EventsByWeekFragment.newInstance(Integer.parseInt(dropdownItems[position])),MAIN_FRAGMENT_TAG).commit();
  mCurrentSelectedYearPosition=position;
  return true;
}

Fixed version (ground truth):
@Override public boolean onNavigationItemSelected(int position,long id){
  if (position == mCurrentSelectedYearPosition) {
    return true;
  }
  Log.d(Constants.LOG_TAG,"String_Node_Str" + Integer.parseInt(dropdownItems[position]));
  getSupportFragmentManager().beginTransaction().setCustomAnimations(R.anim.fade_in,R.anim.fade_out).replace(R.id.container,EventsByWeekFragment.newInstance(Integer.parseInt(dropdownItems[position])),MAIN_FRAGMENT_TAG).commit();
  mCurrentSelectedYearPosition=position;
  return true;
}
Program: 33898
Project: 33898
Buggy source:
@Override public void onCreateNavigationDrawer(){
  useActionBarToggle(true);
  encourageLearning(true);
}

Fixed version (ground truth):
@Override public void onCreateNavigationDrawer(){
  useActionBarToggle(true);
  encourageLearning(fromSavedInstance ? false : true);
}
Program: 33899
Project: 33899
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (getArguments() != null) {
    mYear=getArguments().getInt(YEAR,2014);
  }
  Log.d(Constants.LOG_TAG,"String_Node_Str" + mYear);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Log.d(Constants.LOG_TAG,"String_Node_Str");
  int currentYear=Calendar.getInstance().get(Calendar.YEAR);
  if (getArguments() != null) {
    mYear=getArguments().getInt(YEAR,currentYear);
  }
}