nus-yam/ex-repair huggingface dataset:
Program: 33813
Project: 33813
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View v=inflater.inflate(R.layout.list_fragment_with_spinner,null);
  mListView=(ListView)v.findViewById(R.id.list);
  mProgressBar=(ProgressBar)v.findViewById(R.id.progress);
  if (mAdapter != null) {
    mListView.setAdapter(mAdapter);
    mListView.onRestoreInstanceState(mListState);
    mProgressBar.setVisibility(View.GONE);
  }
  mListView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      if (!(parent.getAdapter() instanceof ListViewAdapter)) {
        Log.w(Constants.LOG_TAG,"String_Node_Str");
        return;
      }
      Object item=((ListViewAdapter)parent.getAdapter()).getItem(position);
      if (item != null && item instanceof EventListElement) {
        String eventKey=((ListElement)item).getKey();
        startActivity(TeamAtEventActivity.newInstance(getActivity(),eventKey,mTeamKey));
      }
 else {
        Log.d(Constants.LOG_TAG,"String_Node_Str");
      }
    }
  }
);
  return v;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View v=inflater.inflate(R.layout.list_view_with_spinner,null);
  mListView=(ListView)v.findViewById(R.id.list);
  mProgressBar=(ProgressBar)v.findViewById(R.id.progress);
  if (mAdapter != null) {
    mListView.setAdapter(mAdapter);
    mListView.onRestoreInstanceState(mListState);
    mProgressBar.setVisibility(View.GONE);
  }
  mListView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      if (!(parent.getAdapter() instanceof ListViewAdapter)) {
        Log.w(Constants.LOG_TAG,"String_Node_Str");
        return;
      }
      Object item=((ListViewAdapter)parent.getAdapter()).getItem(position);
      if (item != null && item instanceof EventListElement) {
        String eventKey=((ListElement)item).getKey();
        startActivity(TeamAtEventActivity.newInstance(getActivity(),eventKey,mTeamKey));
      }
 else {
        Log.d(Constants.LOG_TAG,"String_Node_Str");
      }
    }
  }
);
  return v;
}
Program: 33815
Project: 33815
Buggy source:
public void storeTeams(ArrayList<Team> teams){
  Semaphore dbSemaphore=null;
  try {
    dbSemaphore=getSemaphore();
    dbSemaphore.acquire();
    db.beginTransaction();
    for (    Team team : teams) {
      db.insert(TABLE_TEAMS,null,team.getParams());
    }
    db.setTransactionSuccessful();
    db.endTransaction();
  }
 catch (  InterruptedException e) {
    Log.w("String_Node_Str","String_Node_Str");
  }
 finally {
    if (dbSemaphore != null) {
      dbSemaphore.release();
    }
  }
}

Fixed version (ground truth):
public void storeTeams(ArrayList<Team> teams){
  Semaphore dbSemaphore=null;
  try {
    dbSemaphore=getSemaphore();
    dbSemaphore.acquire();
    db.beginTransaction();
    for (    Team team : teams) {
      db.insert(TABLE_TEAMS,null,team.getParams());
      ContentValues cv=new ContentValues();
      try {
        cv.put(SearchTeam.KEY,team.getTeamKey());
        cv.put(SearchTeam.TITLES,Utilities.getAsciiApproximationOfUnicode(team.getSearchTitles()));
        cv.put(SearchTeam.NUMBER,team.getTeamNumber());
        db.insert(TABLE_SEARCH_TEAMS,null,cv);
      }
 catch (      BasicModel.FieldNotDefinedException e) {
        e.printStackTrace();
      }
    }
    db.setTransactionSuccessful();
    db.endTransaction();
  }
 catch (  InterruptedException e) {
    Log.w("String_Node_Str","String_Node_Str");
  }
 finally {
    if (dbSemaphore != null) {
      dbSemaphore.release();
    }
  }
}
Program: 33816
Project: 33816
Buggy source:
private Database(Context context){
  super(context,DATABASE_NAME,null,DATABASE_VERSION);
  this.context=context;
  db=getWritableDatabase();
  teamsTable=new Teams();
  eventsTable=new Events();
  awardsTable=new Awards();
  matchesTable=new Matches();
  mediasTable=new Medias();
  responseTable=new Response();
  sSemaphore=new Semaphore(1);
}

Fixed version (ground truth):
private Database(Context context){
  super(context,DATABASE_NAME,null,DATABASE_VERSION);
  this.context=context;
  db=getWritableDatabase();
  teamsTable=new Teams();
  eventsTable=new Events();
  awardsTable=new Awards();
  matchesTable=new Matches();
  mediasTable=new Medias();
  responseTable=new Response();
  mSemaphore=new Semaphore(1);
}
Program: 33817
Project: 33817
Buggy source:
public Semaphore getSemaphore(){
  return sSemaphore;
}

Fixed version (ground truth):
public Semaphore getSemaphore(){
  return mSemaphore;
}
Program: 33818
Project: 33818
Buggy source:
public void storeEvents(ArrayList<Event> events){
  Semaphore dbSemaphore=null;
  try {
    dbSemaphore=getSemaphore();
    dbSemaphore.acquire();
    db.beginTransaction();
    for (    Event event : events) {
      try {
        if (!exists(event.getEventKey())) {
          db.insert(TABLE_MATCHES,null,event.getParams());
        }
 else {
          db.update(TABLE_MATCHES,event.getParams(),KEY + "String_Node_Str",new String[]{event.getEventKey()});
        }
      }
 catch (      BasicModel.FieldNotDefinedException e) {
        Log.w(Constants.LOG_TAG,"String_Node_Str");
      }
    }
    db.setTransactionSuccessful();
    db.endTransaction();
  }
 catch (  InterruptedException e) {
    Log.w("String_Node_Str","String_Node_Str");
  }
 finally {
    if (dbSemaphore != null) {
      dbSemaphore.release();
    }
  }
}

Fixed version (ground truth):
public void storeEvents(ArrayList<Event> events){
  Semaphore dbSemaphore=null;
  try {
    dbSemaphore=getSemaphore();
    dbSemaphore.acquire();
    db.beginTransaction();
    for (    Event event : events) {
      try {
        db.insert(TABLE_EVENTS,null,event.getParams());
      }
 catch (      Exception e) {
        try {
          db.update(TABLE_EVENTS,event.getParams(),KEY + "String_Node_Str",new String[]{event.getEventKey()});
        }
 catch (        BasicModel.FieldNotDefinedException e1) {
          Log.w(Constants.LOG_TAG,"String_Node_Str");
        }
      }
    }
    db.setTransactionSuccessful();
    db.endTransaction();
  }
 catch (  InterruptedException e) {
    Log.w("String_Node_Str","String_Node_Str");
  }
 finally {
    if (dbSemaphore != null) {
      dbSemaphore.release();
    }
  }
}
Program: 33820
Project: 33820
Buggy source:
public static Event inflateEvent(Cursor data){
  Event event=new Event();
  for (int i=0; i < data.getColumnCount(); i++) {
switch (data.getColumnName(i)) {
case Database.Events.KEY:
      event.setEventKey(data.getString(i));
    break;
case Database.Events.NAME:
  event.setEventName(data.getString(i));
break;
case Database.Events.LOCATION:
event.setLocation(data.getString(i));
break;
case Database.Events.VENUE:
event.setVenue(data.getString(i));
break;
case Database.Events.TYPE:
event.setEventType(data.getString(i));
break;
case Database.Events.DISTRICT:
event.setDistrictEnum(data.getInt(i));
break;
case Database.Events.DISTRICT_STRING:
event.setDistrictTitle(data.getString(i));
break;
case Database.Events.START:
event.setStartDate(new Date(data.getLong(i)));
break;
case Database.Events.END:
event.setEndDate(new Date(data.getLong(i)));
break;
case Database.Events.OFFICIAL:
event.setOfficial(data.getInt(i) == 1);
break;
case Database.Events.WEEK:
event.setCompetitionWeek(data.getInt(i));
break;
case Database.Events.RANKINGS:
JsonArray rankings=JSONManager.getasJsonArray(data.getString(i));
event.setRankings(rankings);
break;
case Database.Events.ALLIANCES:
JsonArray alliances=JSONManager.getasJsonArray(data.getString(i));
event.setAlliances(alliances);
break;
case Database.Events.STATS:
JsonObject stats=JSONManager.getasJsonObject(data.getString(i));
event.setStats(stats);
break;
default :
}
}
return event;
}

Fixed version (ground truth):
public static Event inflateEvent(Cursor data){
  Event event=new Event();
  for (int i=0; i < data.getColumnCount(); i++) {
switch (data.getColumnName(i)) {
case Database.Events.KEY:
      event.setEventKey(data.getString(i));
    break;
case Database.Events.NAME:
  event.setEventName(data.getString(i));
break;
case Database.Events.LOCATION:
event.setLocation(data.getString(i));
break;
case Database.Events.VENUE:
event.setVenue(data.getString(i));
break;
case Database.Events.TYPE:
event.setEventType(data.getInt(i));
break;
case Database.Events.DISTRICT:
event.setDistrictEnum(data.getInt(i));
break;
case Database.Events.DISTRICT_STRING:
event.setDistrictTitle(data.getString(i));
break;
case Database.Events.START:
event.setStartDate(new Date(data.getLong(i)));
break;
case Database.Events.END:
event.setEndDate(new Date(data.getLong(i)));
break;
case Database.Events.OFFICIAL:
event.setOfficial(data.getInt(i) == 1);
break;
case Database.Events.WEEK:
event.setCompetitionWeek(data.getInt(i));
break;
case Database.Events.RANKINGS:
JsonArray rankings=JSONManager.getasJsonArray(data.getString(i));
event.setRankings(rankings);
break;
case Database.Events.ALLIANCES:
JsonArray alliances=JSONManager.getasJsonArray(data.getString(i));
event.setAlliances(alliances);
break;
case Database.Events.STATS:
JsonObject stats=JSONManager.getasJsonObject(data.getString(i));
event.setStats(stats);
break;
default :
}
}
return event;
}
Program: 33821
Project: 33821
Buggy source:
@Override public int compare(Event event,Event event2){
  try {
    if (event.getEventType() == event2.getEventType()) {
      int districtSort=((Integer)event.getDistrictEnum()).compareTo(event2.getDistrictEnum());
      if (districtSort == 0) {
        return event.getStartDate().compareTo(event2.getStartDate());
      }
 else {
        return districtSort;
      }
    }
 else {
      int typeCompare=event.getEventType().compareTo(event2.getEventType());
      if (typeCompare == 0 && event.getEventType() == EventHelper.TYPE.DISTRICT) {
        return ((Integer)event.getDistrictEnum()).compareTo(event2.getDistrictEnum());
      }
 else {
        return typeCompare;
      }
    }
  }
 catch (  BasicModel.FieldNotDefinedException e) {
    Log.e(Constants.LOG_TAG,"String_Node_Str" + e.getMessage());
    return 0;
  }
}

Fixed version (ground truth):
@Override public int compare(Event event,Event event2){
  try {
    if (event.getEventType() == event2.getEventType()) {
      int districtSort=((Integer)event.getDistrictEnum()).compareTo(event2.getDistrictEnum());
      if (districtSort == 0) {
        int eventSort=event.getStartDate().compareTo(event2.getStartDate());
        if (eventSort == 0) {
          return event.getShortName().compareTo(event2.getShortName());
        }
 else {
          return eventSort;
        }
      }
 else {
        return districtSort;
      }
    }
 else {
      int typeCompare=event.getEventType().compareTo(event2.getEventType());
      if (typeCompare == 0 && event.getEventType() == EventHelper.TYPE.DISTRICT) {
        return ((Integer)event.getDistrictEnum()).compareTo(event2.getDistrictEnum());
      }
 else {
        return typeCompare;
      }
    }
  }
 catch (  BasicModel.FieldNotDefinedException e) {
    Log.e(Constants.LOG_TAG,"String_Node_Str" + e.getMessage());
    return 0;
  }
}
Program: 33822
Project: 33822
Buggy source:
public static APIResponse<ArrayList<Event>> getSimpleEventsInWeek(Context c,int year,int week,boolean loadFromCache) throws NoDataException {
  Log.d("String_Node_Str","String_Node_Str" + week);
  String apiUrl=String.format(TBAv2.API_URL.get(TBAv2.QUERY.EVENT_LIST),year);
  String sqlWhere=Database.Events.YEAR + "String_Node_Str" + Database.Events.WEEK+ "String_Node_Str";
  return Event.queryList(c,loadFromCache,null,sqlWhere,new String[]{Integer.toString(year),Integer.toString(week)},new String[]{apiUrl});
}

Fixed version (ground truth):
public static APIResponse<ArrayList<Event>> getSimpleEventsInWeek(Context c,int year,int week,boolean loadFromCache) throws NoDataException {
  Log.d("String_Node_Str","String_Node_Str" + week);
  String apiUrl=String.format(TBAv2.API_URL.get(TBAv2.QUERY.EVENT_LIST),year);
  String sqlWhere;
  String[] whereArgs;
  if (week > Utilities.getCmpWeek(year)) {
    sqlWhere=Database.Events.YEAR + "String_Node_Str" + Database.Events.WEEK+ "String_Node_Str";
    whereArgs=new String[]{Integer.toString(year),Integer.toString(Utilities.getCmpWeek(year))};
  }
 else {
    sqlWhere=Database.Events.YEAR + "String_Node_Str" + Database.Events.WEEK+ "String_Node_Str";
    whereArgs=new String[]{Integer.toString(year),Integer.toString(week)};
  }
  return Event.queryList(c,loadFromCache,null,sqlWhere,whereArgs,new String[]{apiUrl});
}
Program: 33824
Project: 33824
Buggy source:
/** 
 * Returns a list of events sorted by name and type. This is optimal for quickly finding a particular event within a given week.
 * @param events a list of events to render
 * @return a list of ListItems representing the sorted events
 */
public static ArrayList<ListItem> renderEventListForWeek(ArrayList<Event> events){
  return renderEventListWithComparator(events,new EventSortByTypeAndNameComparator());
}

Fixed version (ground truth):
/** 
 * Returns a list of events sorted by name and type. This is optimal for quickly finding a particular event within a given week.
 * @param events a list of events to render
 * @return a list of ListItems representing the sorted events
 */
public static ArrayList<ListItem> renderEventListForWeek(ArrayList<Event> events){
  return renderEventListWithComparator(events,new EventSortByTypeAndDateComparator());
}
Program: 33825
Project: 33825
Buggy source:
@Override public EventListElement render(){
  try {
    String eventKey=getEventKey(), eventName=getEventName(), location=getLocation();
    if (getShortName() == null || shortName.isEmpty()) {
      return new EventListElement(eventKey,eventName,getDateString(),location);
    }
 else {
      return new EventListElement(eventKey,getShortName(),getDateString(),location);
    }
  }
 catch (  FieldNotDefinedException e) {
    Log.w(Constants.LOG_TAG,"String_Node_Str" + "String_Node_Str");
    return null;
  }
}

Fixed version (ground truth):
@Override public EventListElement render(){
  try {
    String eventKey=getEventKey(), eventName=getShortName(), location=getLocation();
    if (getShortName() == null || shortName.isEmpty()) {
      return new EventListElement(eventKey,eventName,getDateString(),location);
    }
 else {
      return new EventListElement(eventKey,getShortName(),getDateString(),location);
    }
  }
 catch (  FieldNotDefinedException e) {
    Log.w(Constants.LOG_TAG,"String_Node_Str" + "String_Node_Str");
    return null;
  }
}
Program: 33826
Project: 33826
Buggy source:
public String getShortName(){
  try {
    return EventHelper.getShortNameForEvent(getEventName(),getEventType());
  }
 catch (  FieldNotDefinedException e) {
    Log.e(Constants.LOG_TAG,"String_Node_Str");
    return "String_Node_Str";
  }
}

Fixed version (ground truth):
public String getShortName(){
  try {
    if (shortName == null || shortName.isEmpty()) {
      setShortName(EventHelper.getShortNameForEvent(getEventName(),getEventType()));
    }
    return shortName;
  }
 catch (  FieldNotDefinedException e) {
    Log.e(Constants.LOG_TAG,"String_Node_Str");
    return "String_Node_Str";
  }
}
Program: 33827
Project: 33827
Buggy source:
private void setupActionBar(){
  getActionBar().setDisplayHomeAsUpEnabled(true);
  getActionBar().setTitle(getString(R.string.contributors));
}

Fixed version (ground truth):
private void setupActionBar(){
  getActionBar().setDisplayHomeAsUpEnabled(true);
  setActionBarTitle(getString(R.string.contributors));
}
Program: 33828
Project: 33828
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  int id=item.getItemId();
  if (id == android.R.id.home) {
    this.finish();
    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;
    }
    this.finish();
    return true;
  }
  return super.onOptionsItemSelected(item);
}
Program: 33829
Project: 33829
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.action_view_event:
    startActivity(ViewEventActivity.newInstance(this,eventKey));
  break;
case 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)).addNextIntent(ViewEventActivity.newInstance(this,eventKey)).startActivities();
}
 else {
Log.d(Constants.LOG_TAG,"String_Node_Str");
NavUtils.navigateUpTo(this,upIntent);
}
return true;
default :
break;
}
return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.action_view_event:
    startActivity(ViewEventActivity.newInstance(this,eventKey));
  break;
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_teams)).addNextIntent(ViewEventActivity.newInstance(this,eventKey)).startActivities();
}
 else {
Log.d(Constants.LOG_TAG,"String_Node_Str");
NavUtils.navigateUpTo(this,upIntent);
}
return true;
default :
break;
}
return super.onOptionsItemSelected(item);
}
Program: 33830
Project: 33830
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_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();
  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_events)).startActivities();
    }
 else {
      Log.d(Constants.LOG_TAG,"String_Node_Str");
      NavUtils.navigateUpTo(this,upIntent);
    }
    return true;
  }
  return super.onOptionsItemSelected(item);
}
Program: 33831
Project: 33831
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: 33832
Project: 33832
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: 33833
Project: 33833
Buggy source:
@Override protected void onPostExecute(Void aVoid){
  super.onPostExecute(aVoid);
  activity.findViewById(R.id.progress).setVisibility(View.GONE);
  activity.findViewById(R.id.no_data).setVisibility(View.GONE);
  activity.findViewById(android.R.id.list).setVisibility(View.VISIBLE);
  ((ListView)activity.findViewById(android.R.id.list)).setAdapter(adapter);
  activity.notifyRefreshComplete(activity);
}

Fixed version (ground truth):
@Override protected void onPostExecute(Void aVoid){
  super.onPostExecute(aVoid);
  activity.findViewById(R.id.progress).setVisibility(View.GONE);
  activity.findViewById(R.id.no_data).setVisibility(View.GONE);
  activity.findViewById(android.R.id.list).setVisibility(View.VISIBLE);
  ListView contributors=(ListView)activity.findViewById(android.R.id.list);
  Parcelable state=contributors.onSaveInstanceState();
  contributors.setAdapter(adapter);
  contributors.onRestoreInstanceState(state);
  activity.notifyRefreshComplete(activity);
}
Program: 33834
Project: 33834
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);
      eventList.setAdapter(adapter);
    }
    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 {
      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 (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);
      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 {
      if (mFragment instanceof RefreshListener) {
        activity.notifyRefreshComplete((RefreshListener)mFragment);
      }
    }
  }
}
Program: 33836
Project: 33836
Buggy source:
@Override protected void onPostExecute(APIResponse.CODE code){
  super.onPostExecute(code);
  View view=fragment.getView();
  if (activity != null && view != null) {
    TeamCursorAdapter adapter=new TeamCursorAdapter(activity,teams,0);
    TextView noDataText=(TextView)view.findViewById(R.id.no_data);
    if (code == APIResponse.CODE.NODATA || teams == null || !teams.moveToFirst()) {
      noDataText.setText(R.string.no_team_list);
      noDataText.setVisibility(View.VISIBLE);
    }
 else {
      ListView eventList=(ListView)view.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);
    view.findViewById(R.id.list).setVisibility(View.VISIBLE);
    if (fragment instanceof RefreshListener) {
      activity.notifyRefreshComplete((RefreshListener)fragment);
    }
  }
}

Fixed version (ground truth):
@Override protected void onPostExecute(APIResponse.CODE code){
  super.onPostExecute(code);
  View view=fragment.getView();
  if (activity != null && view != null) {
    TeamCursorAdapter adapter=new TeamCursorAdapter(activity,teams,0);
    TextView noDataText=(TextView)view.findViewById(R.id.no_data);
    if (code == APIResponse.CODE.NODATA || teams == null || !teams.moveToFirst()) {
      noDataText.setText(R.string.no_team_list);
      noDataText.setVisibility(View.VISIBLE);
    }
 else {
      ListView eventList=(ListView)view.findViewById(R.id.list);
      Parcelable state=eventList.onSaveInstanceState();
      eventList.setAdapter(adapter);
      eventList.onRestoreInstanceState(state);
    }
    if (code == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(fragment.getString(R.string.warning_using_cached_data));
    }
    view.findViewById(R.id.progress).setVisibility(View.GONE);
    view.findViewById(R.id.list).setVisibility(View.VISIBLE);
    if (fragment instanceof RefreshListener) {
      activity.notifyRefreshComplete((RefreshListener)fragment);
    }
  }
}
Program: 33837
Project: 33837
Buggy source:
@Override protected void onPostExecute(APIResponse.CODE code){
  View view=mFragment.getView();
  if (view != null) {
    adapter=new ListViewAdapter(activity,awards);
    TextView noDataText=(TextView)view.findViewById(R.id.no_data);
    if (code == APIResponse.CODE.NODATA || adapter.values.isEmpty()) {
      noDataText.setText(R.string.no_awards_data);
      noDataText.setVisibility(View.VISIBLE);
    }
 else {
      ListView rankings=(ListView)view.findViewById(R.id.list);
      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);
    view.findViewById(R.id.list).setVisibility(View.VISIBLE);
  }
  if (code == APIResponse.CODE.LOCAL && !isCancelled()) {
    PopulateEventAwards secondLoad=new PopulateEventAwards(mFragment,false);
    mFragment.updateTask(secondLoad);
    secondLoad.execute(eventKey);
  }
 else {
    if (mFragment instanceof RefreshListener) {
      Log.d(Constants.LOG_TAG,"String_Node_Str");
      activity.notifyRefreshComplete(mFragment);
    }
  }
}

Fixed version (ground truth):
@Override protected void onPostExecute(APIResponse.CODE code){
  View view=mFragment.getView();
  if (view != null) {
    adapter=new ListViewAdapter(activity,awards);
    TextView noDataText=(TextView)view.findViewById(R.id.no_data);
    if (code == APIResponse.CODE.NODATA || adapter.values.isEmpty()) {
      noDataText.setText(R.string.no_awards_data);
      noDataText.setVisibility(View.VISIBLE);
    }
 else {
      ListView rankings=(ListView)view.findViewById(R.id.list);
      Parcelable state=rankings.onSaveInstanceState();
      rankings.setAdapter(adapter);
      rankings.onRestoreInstanceState(state);
    }
    if (code == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(activity.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()) {
    PopulateEventAwards secondLoad=new PopulateEventAwards(mFragment,false);
    mFragment.updateTask(secondLoad);
    secondLoad.execute(eventKey);
  }
 else {
    if (mFragment instanceof RefreshListener) {
      Log.d(Constants.LOG_TAG,"String_Node_Str");
      activity.notifyRefreshComplete(mFragment);
    }
  }
}
Program: 33838
Project: 33838
Buggy source:
@Override protected void onPostExecute(APIResponse.CODE code){
  View view=mFragment.getView();
  if (view != null && activity != null) {
    ListViewAdapter adapter=new ListViewAdapter(activity,teams);
    TextView noDataText=(TextView)view.findViewById(R.id.no_data);
    if (code == APIResponse.CODE.NODATA || adapter.values.isEmpty()) {
      noDataText.setText(R.string.no_ranking_data);
      noDataText.setVisibility(View.VISIBLE);
    }
 else {
      ListView rankings=(ListView)view.findViewById(R.id.list);
      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);
    view.findViewById(R.id.list).setVisibility(View.VISIBLE);
  }
  if (code == APIResponse.CODE.LOCAL && !isCancelled()) {
    PopulateEventRankings secondLoad=new PopulateEventRankings(mFragment,false);
    mFragment.updateTask(secondLoad);
    secondLoad.execute(eventKey);
  }
 else {
    if (mFragment instanceof RefreshListener) {
      Log.d(Constants.LOG_TAG,"String_Node_Str");
      activity.notifyRefreshComplete(mFragment);
    }
  }
}

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);
    TextView noDataText=(TextView)view.findViewById(R.id.no_data);
    if (code == APIResponse.CODE.NODATA || adapter.values.isEmpty()) {
      noDataText.setText(R.string.no_ranking_data);
      noDataText.setVisibility(View.VISIBLE);
    }
 else {
      ListView rankings=(ListView)view.findViewById(R.id.list);
      Parcelable state=rankings.onSaveInstanceState();
      rankings.setAdapter(adapter);
      rankings.onRestoreInstanceState(state);
    }
    if (code == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(activity.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()) {
    PopulateEventRankings secondLoad=new PopulateEventRankings(mFragment,false);
    mFragment.updateTask(secondLoad);
    secondLoad.execute(eventKey);
  }
 else {
    if (mFragment instanceof RefreshListener) {
      Log.d(Constants.LOG_TAG,"String_Node_Str");
      activity.notifyRefreshComplete(mFragment);
    }
  }
}
Program: 33839
Project: 33839
Buggy source:
protected void onPostExecute(APIResponse.CODE code){
  View view=mFragment.getView();
  if (view != null && activity != null) {
    MatchListAdapter adapter=new MatchListAdapter(activity,groups,teamKey);
    TextView noDataText=(TextView)view.findViewById(R.id.no_match_data);
    if (code == APIResponse.CODE.NODATA || groups == null || adapter.groups.isEmpty()) {
      noDataText.setVisibility(View.VISIBLE);
    }
 else {
      ExpandableListView listView=(ExpandableListView)view.findViewById(R.id.match_results);
      listView.setAdapter(adapter);
    }
    view.findViewById(R.id.progress).setVisibility(View.GONE);
    view.findViewById(R.id.match_results).setVisibility(View.VISIBLE);
    if (code == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(activity.getString(R.string.warning_using_cached_data));
    }
  }
  if (code == APIResponse.CODE.LOCAL && !isCancelled()) {
    PopulateEventResults secondLoad;
    secondLoad=new PopulateEventResults(mFragment,false);
    mFragment.updateTask(secondLoad);
    secondLoad.execute(eventKey,teamKey);
  }
 else {
    if (mFragment instanceof RefreshListener) {
      Log.d(Constants.LOG_TAG,"String_Node_Str");
      activity.notifyRefreshComplete(mFragment);
    }
  }
}

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);
    TextView noDataText=(TextView)view.findViewById(R.id.no_match_data);
    if (code == APIResponse.CODE.NODATA || groups == null || adapter.groups.isEmpty()) {
      noDataText.setVisibility(View.VISIBLE);
    }
 else {
      ExpandableListView results=(ExpandableListView)view.findViewById(R.id.match_results);
      Parcelable state=results.onSaveInstanceState();
      int firstVisiblePosition=results.getFirstVisiblePosition();
      results.setAdapter(adapter);
      results.onRestoreInstanceState(state);
      results.setSelection(firstVisiblePosition);
    }
    view.findViewById(R.id.progress).setVisibility(View.GONE);
    view.findViewById(R.id.match_results).setVisibility(View.VISIBLE);
    if (code == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(activity.getString(R.string.warning_using_cached_data));
    }
  }
  if (code == APIResponse.CODE.LOCAL && !isCancelled()) {
    PopulateEventResults secondLoad;
    secondLoad=new PopulateEventResults(mFragment,false);
    mFragment.updateTask(secondLoad);
    secondLoad.execute(eventKey,teamKey);
  }
 else {
    if (mFragment instanceof RefreshListener) {
      Log.d(Constants.LOG_TAG,"String_Node_Str");
      activity.notifyRefreshComplete(mFragment);
    }
  }
}
Program: 33840
Project: 33840
Buggy source:
@Override protected void onPostExecute(APIResponse.CODE code){
  View view=mFragment.getView();
  if (view != null && activity != null) {
    ListViewAdapter adapter=new ListViewAdapter(activity,teams);
    TextView noDataText=(TextView)view.findViewById(R.id.no_data);
    if (code == APIResponse.CODE.NODATA || adapter.values.isEmpty()) {
      noDataText.setText(R.string.no_stats_data);
      noDataText.setVisibility(View.VISIBLE);
    }
 else {
      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);
    view.findViewById(R.id.list).setVisibility(View.VISIBLE);
  }
  if (code == APIResponse.CODE.LOCAL && !isCancelled()) {
    PopulateEventStats secondLoad=new PopulateEventStats(mFragment,false);
    mFragment.updateTask(secondLoad);
    secondLoad.execute(eventKey);
  }
 else {
    if (mFragment instanceof RefreshListener) {
      Log.d(Constants.LOG_TAG,"String_Node_Str");
      activity.notifyRefreshComplete(mFragment);
    }
  }
}

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);
    TextView noDataText=(TextView)view.findViewById(R.id.no_data);
    if (code == APIResponse.CODE.NODATA || adapter.values.isEmpty()) {
      noDataText.setText(R.string.no_stats_data);
      noDataText.setVisibility(View.VISIBLE);
    }
 else {
      ListView stats=(ListView)view.findViewById(R.id.list);
      Parcelable state=stats.onSaveInstanceState();
      stats.setAdapter(adapter);
      stats.onRestoreInstanceState(state);
    }
    if (code == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(activity.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()) {
    PopulateEventStats secondLoad=new PopulateEventStats(mFragment,false);
    mFragment.updateTask(secondLoad);
    secondLoad.execute(eventKey);
  }
 else {
    if (mFragment instanceof RefreshListener) {
      Log.d(Constants.LOG_TAG,"String_Node_Str");
      activity.notifyRefreshComplete(mFragment);
    }
  }
}
Program: 33841
Project: 33841
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,teams);
    adapter.notifyDataSetChanged();
    TextView noDataText=(TextView)view.findViewById(R.id.no_data);
    if (code == APIResponse.CODE.NODATA || adapter.values.isEmpty()) {
      noDataText.setText(R.string.no_team_data);
      noDataText.setVisibility(View.VISIBLE);
    }
 else {
      ListView teamList=(ListView)view.findViewById(R.id.list);
      teamList.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);
    view.findViewById(R.id.list).setVisibility(View.VISIBLE);
  }
  if (code == APIResponse.CODE.LOCAL && !isCancelled()) {
    PopulateEventTeams secondLoad=new PopulateEventTeams(mFragment,false);
    mFragment.updateTask(secondLoad);
    secondLoad.execute(eventKey);
  }
 else {
    if (mFragment instanceof RefreshListener) {
      Log.d(Constants.LOG_TAG,"String_Node_Str");
      activity.notifyRefreshComplete(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,teams);
    TextView noDataText=(TextView)view.findViewById(R.id.no_data);
    if (code == APIResponse.CODE.NODATA || adapter.values.isEmpty()) {
      noDataText.setText(R.string.no_team_data);
      noDataText.setVisibility(View.VISIBLE);
    }
 else {
      ListView teamList=(ListView)view.findViewById(R.id.list);
      Parcelable state=teamList.onSaveInstanceState();
      teamList.setAdapter(adapter);
      teamList.onRestoreInstanceState(state);
    }
    if (code == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(activity.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()) {
    PopulateEventTeams secondLoad=new PopulateEventTeams(mFragment,false);
    mFragment.updateTask(secondLoad);
    secondLoad.execute(eventKey);
  }
 else {
    if (mFragment instanceof RefreshListener) {
      Log.d(Constants.LOG_TAG,"String_Node_Str");
      activity.notifyRefreshComplete(mFragment);
    }
  }
}
Program: 33842
Project: 33842
Buggy source:
@Override protected void onPostExecute(APIResponse.CODE code){
  View view=fragment.getView();
  if (view != null && activity != null) {
    ExpandableListAdapter adapter=new ExpandableListAdapter(activity,groups);
    ExpandableListView listView=(ExpandableListView)view.findViewById(R.id.team_media_list);
    TextView noDataText=(TextView)view.findViewById(R.id.no_media);
    if (code == APIResponse.CODE.NODATA || adapter.groups.isEmpty()) {
      noDataText.setVisibility(View.VISIBLE);
    }
 else {
      listView.setAdapter(adapter);
      for (int i=0; i < groups.size(); i++) {
        listView.expandGroup(i);
      }
    }
    if (code == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(activity.getString(R.string.warning_using_cached_data));
    }
    view.findViewById(R.id.progress).setVisibility(View.GONE);
    view.findViewById(R.id.team_media_list).setVisibility(View.VISIBLE);
    if (code == APIResponse.CODE.LOCAL && !isCancelled()) {
      PopulateTeamMedia secondLoad=new PopulateTeamMedia(fragment,false);
      fragment.updateTask(secondLoad);
      secondLoad.execute(team,year);
    }
 else {
      if (fragment instanceof RefreshListener) {
        activity.notifyRefreshComplete(fragment);
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void onPostExecute(APIResponse.CODE code){
  View view=fragment.getView();
  if (view != null && activity != null) {
    ExpandableListAdapter adapter=new ExpandableListAdapter(activity,groups);
    ExpandableListView media=(ExpandableListView)view.findViewById(R.id.team_media_list);
    TextView noDataText=(TextView)view.findViewById(R.id.no_media);
    if (code == APIResponse.CODE.NODATA || adapter.groups.isEmpty()) {
      noDataText.setVisibility(View.VISIBLE);
    }
 else {
      Parcelable state=media.onSaveInstanceState();
      int firstVisiblePosition=media.getFirstVisiblePosition();
      media.setAdapter(adapter);
      media.onRestoreInstanceState(state);
      media.setSelection(firstVisiblePosition);
    }
    if (code == APIResponse.CODE.OFFLINECACHE) {
      activity.showWarningMessage(activity.getString(R.string.warning_using_cached_data));
    }
    view.findViewById(R.id.progress).setVisibility(View.GONE);
    view.findViewById(R.id.team_media_list).setVisibility(View.VISIBLE);
    if (code == APIResponse.CODE.LOCAL && !isCancelled()) {
      PopulateTeamMedia secondLoad=new PopulateTeamMedia(fragment,false);
      fragment.updateTask(secondLoad);
      secondLoad.execute(team,year);
    }
 else {
      if (fragment instanceof RefreshListener) {
        activity.notifyRefreshComplete(fragment);
      }
    }
  }
}
Program: 33843
Project: 33843
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: 33845
Project: 33845
Buggy source:
private void setupActionBar(){
  getActionBar().setDisplayHomeAsUpEnabled(true);
  getActionBar().setTitle(getString(R.string.contributors));
}

Fixed version (ground truth):
private void setupActionBar(){
  getActionBar().setDisplayHomeAsUpEnabled(true);
  setActionBarTitle(getString(R.string.contributors));
}
Program: 33846
Project: 33846
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  int id=item.getItemId();
  if (id == android.R.id.home) {
    this.finish();
    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;
    }
    this.finish();
    return true;
  }
  return super.onOptionsItemSelected(item);
}
Program: 33847
Project: 33847
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.action_view_event:
    startActivity(ViewEventActivity.newInstance(this,eventKey));
  break;
case 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)).addNextIntent(ViewEventActivity.newInstance(this,eventKey)).startActivities();
}
 else {
Log.d(Constants.LOG_TAG,"String_Node_Str");
NavUtils.navigateUpTo(this,upIntent);
}
return true;
default :
break;
}
return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.action_view_event:
    startActivity(ViewEventActivity.newInstance(this,eventKey));
  break;
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_teams)).addNextIntent(ViewEventActivity.newInstance(this,eventKey)).startActivities();
}
 else {
Log.d(Constants.LOG_TAG,"String_Node_Str");
NavUtils.navigateUpTo(this,upIntent);
}
return true;
default :
break;
}
return super.onOptionsItemSelected(item);
}
Program: 33848
Project: 33848
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_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();
  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_events)).startActivities();
    }
 else {
      Log.d(Constants.LOG_TAG,"String_Node_Str");
      NavUtils.navigateUpTo(this,upIntent);
    }
    return true;
  }
  return super.onOptionsItemSelected(item);
}