Program: 33637
Project: 33637
Buggy source:
@Override public void parseData() throws BasicModel.FieldNotDefinedException {
  mDataToBind.clear();
  mQualMatches.clear();
  mQuarterMatches.clear();
  mSemiMatches.clear();
  mFinalMatches.clear();
  if (mAPIData == null || mAPIData.isEmpty()) {
    return;
  }
  int[] record={0,0,0};
  Match nextMatch=null;
  Match lastMatch=null;
  Event event=mDb.getEventsTable().get(mEventKey);
  if (event != null && event.isHappeningNow()) {
    Collections.sort(mAPIData,new MatchSortByDisplayOrderComparator());
  }
 else {
    Collections.sort(mAPIData,new MatchSortByPlayOrderComparator());
  }
  ListGroup currentGroup=mQualMatches;
  MatchType lastType=null;
  Match previousIteration=null;
  boolean lastMatchPlayed=false;
  if (mAPIData.size() > 0) {
    nextMatch=mAPIData.get(0);
  }
  for (int i=0; i < mAPIData.size(); i++) {
    Match match=mAPIData.get(i);
    MatchType currentType=match.getType();
    if (lastType != currentType) {
switch (match.getType()) {
case QUAL:
        currentGroup=mQualMatches;
      break;
case QUARTER:
    currentGroup=mQuarterMatches;
  break;
case SEMI:
currentGroup=mSemiMatches;
break;
case FINAL:
currentGroup=mFinalMatches;
break;
}
}
currentGroup.children.add(match);
if (lastMatchPlayed && !match.hasBeenPlayed()) {
lastMatch=previousIteration;
nextMatch=match;
}
if (mTeamKey != null) {
match.addToRecord(mTeamKey,record);
}
lastType=currentType;
previousIteration=match;
lastMatchPlayed=match.hasBeenPlayed();
}
if (lastMatch == null && !mAPIData.isEmpty()) {
Match last=mAPIData.get(mAPIData.size() - 1);
if (last.hasBeenPlayed()) {
lastMatch=last;
}
}
if (nextMatch != null && nextMatch.hasBeenPlayed()) {
nextMatch=null;
}
if (!mQualMatches.children.isEmpty()) {
mDataToBind.add(mQualMatches);
}
if (!mQuarterMatches.children.isEmpty()) {
mDataToBind.add(mQuarterMatches);
}
if (!mSemiMatches.children.isEmpty()) {
mDataToBind.add(mSemiMatches);
}
if (!mFinalMatches.children.isEmpty()) {
mDataToBind.add(mFinalMatches);
}
mEventBus.post(new LiveEventMatchUpdateEvent(lastMatch,nextMatch));
}

Fixed version (ground truth):
@Override public void parseData() throws BasicModel.FieldNotDefinedException {
  if (mAPIData == null || mAPIData.isEmpty()) {
    return;
  }
  mDataToBind.clear();
  mQualMatches.clear();
  mQuarterMatches.clear();
  mSemiMatches.clear();
  mFinalMatches.clear();
  int[] record={0,0,0};
  Match nextMatch=null;
  Match lastMatch=null;
  Event event=mDb.getEventsTable().get(mEventKey);
  if (event != null && event.isHappeningNow()) {
    Collections.sort(mAPIData,new MatchSortByDisplayOrderComparator());
  }
 else {
    Collections.sort(mAPIData,new MatchSortByPlayOrderComparator());
  }
  ListGroup currentGroup=mQualMatches;
  MatchType lastType=null;
  Match previousIteration=null;
  boolean lastMatchPlayed=false;
  if (mAPIData.size() > 0) {
    nextMatch=mAPIData.get(0);
  }
  for (int i=0; i < mAPIData.size(); i++) {
    Match match=mAPIData.get(i);
    MatchType currentType=match.getType();
    if (lastType != currentType) {
switch (match.getType()) {
case QUAL:
        currentGroup=mQualMatches;
      break;
case QUARTER:
    currentGroup=mQuarterMatches;
  break;
case SEMI:
currentGroup=mSemiMatches;
break;
case FINAL:
currentGroup=mFinalMatches;
break;
}
}
currentGroup.children.add(match);
if (lastMatchPlayed && !match.hasBeenPlayed()) {
lastMatch=previousIteration;
nextMatch=match;
}
if (mTeamKey != null) {
match.addToRecord(mTeamKey,record);
}
lastType=currentType;
previousIteration=match;
lastMatchPlayed=match.hasBeenPlayed();
}
if (lastMatch == null && !mAPIData.isEmpty()) {
Match last=mAPIData.get(mAPIData.size() - 1);
if (last.hasBeenPlayed()) {
lastMatch=last;
}
}
if (nextMatch != null && nextMatch.hasBeenPlayed()) {
nextMatch=null;
}
if (!mQualMatches.children.isEmpty()) {
mDataToBind.add(mQualMatches);
}
if (!mQuarterMatches.children.isEmpty()) {
mDataToBind.add(mQuarterMatches);
}
if (!mSemiMatches.children.isEmpty()) {
mDataToBind.add(mSemiMatches);
}
if (!mFinalMatches.children.isEmpty()) {
mDataToBind.add(mFinalMatches);
}
mEventBus.post(new LiveEventMatchUpdateEvent(lastMatch,nextMatch));
}