Program: 33690
Project: 33690
Buggy source:
@Override protected APIResponse.CODE doInBackground(String... params){
  eventKey=params[0];
  if (params.length == 2) {
    teamKey=params[1];
  }
 else {
    teamKey="String_Node_Str";
  }
  APIResponse<Event> eventResponse;
  try {
    eventResponse=DataManager.Events.getEvent(activity,eventKey,requestParams);
    event=eventResponse.getData();
    if (isCancelled()) {
      return APIResponse.CODE.NODATA;
    }
  }
 catch (  DataManager.NoDataException e) {
    Log.w(Constants.LOG_TAG,"String_Node_Str" + teamKey + "String_Node_Str"+ eventKey);
    return APIResponse.CODE.NODATA;
  }
  groups=new ArrayList<>();
  ListGroup qualMatches=new ListGroup(activity.getString(R.string.quals_header));
  ListGroup quarterMatches=new ListGroup(activity.getString(R.string.quarters_header));
  ListGroup semiMatches=new ListGroup(activity.getString(R.string.semis_header));
  ListGroup finalMatches=new ListGroup(activity.getString(R.string.finals_header));
  APIResponse<ArrayList<Match>> response;
  int[] record={0,0,0};
  try {
    response=DataManager.Events.getMatchList(activity,eventKey,teamKey,requestParams);
    ArrayList<Match> results=response.getData();
    if (event != null && event.isHappeningNow()) {
      Collections.sort(results,new MatchSortByPlayOrderComparator());
    }
 else {
      Collections.sort(results,new MatchSortByDisplayOrderComparator());
    }
    if (isCancelled()) {
      return APIResponse.CODE.NODATA;
    }
    ListGroup currentGroup=qualMatches;
    MatchHelper.TYPE lastType=null;
    Match previousIteration=null;
    boolean lastMatchPlayed=false;
    if (results.size() > 0) {
      nextMatch=results.get(0);
    }
    for (    Match match : results) {
      try {
        MatchHelper.TYPE currentType=match.getType();
        if (lastType != currentType) {
switch (match.getType()) {
case QUAL:
            currentGroup=qualMatches;
          break;
case QUARTER:
        currentGroup=quarterMatches;
      break;
case SEMI:
    currentGroup=semiMatches;
  break;
case FINAL:
currentGroup=finalMatches;
break;
}
}
currentGroup.children.add(match);
if (lastMatchPlayed && !match.hasBeenPlayed()) {
lastMatch=previousIteration;
nextMatch=match;
}
match.addToRecord(teamKey,record);
lastType=currentType;
previousIteration=match;
lastMatchPlayed=match.hasBeenPlayed();
}
 catch (BasicModel.FieldNotDefinedException e) {
Log.e(Constants.LOG_TAG,"String_Node_Str" + Arrays.toString(e.getStackTrace()));
}
}
if (lastMatch == null && !results.isEmpty()) {
Match last=results.get(results.size() - 1);
if (last.hasBeenPlayed()) {
lastMatch=last;
}
}
}
 catch (DataManager.NoDataException e) {
Log.w(Constants.LOG_TAG,"String_Node_Str");
response=new APIResponse<>(null,APIResponse.CODE.NODATA);
}
if (!qualMatches.children.isEmpty()) {
groups.add(qualMatches);
}
if (!quarterMatches.children.isEmpty()) {
groups.add(quarterMatches);
}
if (!semiMatches.children.isEmpty()) {
groups.add(semiMatches);
}
if (!finalMatches.children.isEmpty()) {
groups.add(finalMatches);
}
adapter=new MatchListAdapter(activity,groups,teamKey);
return APIResponse.mergeCodes(eventResponse.getCode(),response.getCode());
}

Fixed version (ground truth):
@Override protected APIResponse.CODE doInBackground(String... params){
  eventKey=params[0];
  if (params.length == 2) {
    teamKey=params[1];
  }
 else {
    teamKey="String_Node_Str";
  }
  APIResponse<Event> eventResponse;
  try {
    eventResponse=DataManager.Events.getEvent(activity,eventKey,requestParams);
    event=eventResponse.getData();
    if (isCancelled()) {
      return APIResponse.CODE.NODATA;
    }
  }
 catch (  DataManager.NoDataException e) {
    Log.w(Constants.LOG_TAG,"String_Node_Str" + teamKey + "String_Node_Str"+ eventKey);
    return APIResponse.CODE.NODATA;
  }
  groups=new ArrayList<>();
  ListGroup qualMatches=new ListGroup(activity.getString(R.string.quals_header));
  ListGroup quarterMatches=new ListGroup(activity.getString(R.string.quarters_header));
  ListGroup semiMatches=new ListGroup(activity.getString(R.string.semis_header));
  ListGroup finalMatches=new ListGroup(activity.getString(R.string.finals_header));
  APIResponse<ArrayList<Match>> response;
  int[] record={0,0,0};
  try {
    response=DataManager.Events.getMatchList(activity,eventKey,teamKey,requestParams);
    ArrayList<Match> results=response.getData();
    matchCount=results.size();
    if (event != null && event.isHappeningNow()) {
      Collections.sort(results,new MatchSortByPlayOrderComparator());
    }
 else {
      Collections.sort(results,new MatchSortByDisplayOrderComparator());
    }
    if (isCancelled()) {
      return APIResponse.CODE.NODATA;
    }
    ListGroup currentGroup=qualMatches;
    MatchHelper.TYPE lastType=null;
    Match previousIteration=null;
    boolean lastMatchPlayed=false;
    if (results.size() > 0) {
      nextMatch=results.get(0);
    }
    for (    Match match : results) {
      try {
        MatchHelper.TYPE currentType=match.getType();
        if (lastType != currentType) {
switch (match.getType()) {
case QUAL:
            currentGroup=qualMatches;
          break;
case QUARTER:
        currentGroup=quarterMatches;
      break;
case SEMI:
    currentGroup=semiMatches;
  break;
case FINAL:
currentGroup=finalMatches;
break;
}
}
currentGroup.children.add(match);
if (lastMatchPlayed && !match.hasBeenPlayed()) {
lastMatch=previousIteration;
nextMatch=match;
}
match.addToRecord(teamKey,record);
lastType=currentType;
previousIteration=match;
lastMatchPlayed=match.hasBeenPlayed();
}
 catch (BasicModel.FieldNotDefinedException e) {
Log.e(Constants.LOG_TAG,"String_Node_Str" + Arrays.toString(e.getStackTrace()));
}
}
if (lastMatch == null && !results.isEmpty()) {
Match last=results.get(results.size() - 1);
if (last.hasBeenPlayed()) {
lastMatch=last;
}
}
}
 catch (DataManager.NoDataException e) {
Log.w(Constants.LOG_TAG,"String_Node_Str");
response=new APIResponse<>(null,APIResponse.CODE.NODATA);
}
if (!qualMatches.children.isEmpty()) {
groups.add(qualMatches);
}
if (!quarterMatches.children.isEmpty()) {
groups.add(quarterMatches);
}
if (!semiMatches.children.isEmpty()) {
groups.add(semiMatches);
}
if (!finalMatches.children.isEmpty()) {
groups.add(finalMatches);
}
adapter=new MatchListAdapter(activity,groups,teamKey);
return response.getCode();
}