nus-yam/ex-repair huggingface dataset:
Program: 33544
Project: 33544
Buggy source:
/** 
 * Search for a string into this trie
 * @param needle the string to search
 * @return the length of the match (ie, the string) or -1 if not found
 */
public int search(final String needle){
  return node.search(needle);
}

Fixed version (ground truth):
/** 
 * Search for a string into this trie
 * @param needle the string to search
 * @return the length of the match (ie, the string) or -1 if not found
 */
public int search(final String needle,final boolean ignoreCase){
  return node.search(needle,ignoreCase);
}
Program: 33545
Project: 33545
Buggy source:
/** 
 * Create a new builder for this class
 * @param ignoreCase should the resulting trie be case insensitive
 * @return a builder
 * @see Character#isLowerCase(char)
 * @see Character#isUpperCase(char)
 */
public static TrieBuilder newBuilder(final boolean ignoreCase){
  return new TrieBuilder(ignoreCase);
}

Fixed version (ground truth):
/** 
 * Create a new builder for this class
 * @return a builder
 */
public static TrieBuilder newBuilder(){
  return new TrieBuilder();
}
Program: 33546
Project: 33546
Buggy source:
/** 
 * Add one word to the trie
 * @param word the word to add
 * @return this
 * @throws IllegalArgumentException word is less than two characters long
 */
public TrieBuilder addWord(@Nonnull final String word){
  Objects.requireNonNull(word);
  final int length=word.length();
  if (length == 0)   throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
  nrWords++;
  maxLength=Math.max(maxLength,length);
  nodeBuilder.addWord(word,ignoreCase);
  return this;
}

Fixed version (ground truth):
/** 
 * Add one word to the trie
 * @param word the word to add
 * @return this
 * @throws IllegalArgumentException word is less than two characters long
 */
public TrieBuilder addWord(@Nonnull final String word){
  Objects.requireNonNull(word);
  final int length=word.length();
  if (length == 0)   throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
  nrWords++;
  maxLength=Math.max(maxLength,length);
  nodeBuilder.addWord(word);
  return this;
}
Program: 33547
Project: 33547
Buggy source:
TrieBuilder(final boolean ignoreCase){
  this.ignoreCase=ignoreCase;
}

Fixed version (ground truth):
TrieBuilder(){
}
Program: 33548
Project: 33548
Buggy source:
/** 
 * Tries a match on the given MatcherContext.
 * @param context the MatcherContext
 * @return true if the match was successful
 */
@Override public <V>boolean match(final MatcherContext<V> context){
  final int maxLength=trie.getMaxLength();
  final int index=context.getCurrentIndex();
  final String input=context.getInputBuffer().extract(index,index + maxLength);
  final int ret=trie.search(input);
  if (ret == -1)   return false;
  context.advanceIndex(ret);
  return true;
}

Fixed version (ground truth):
/** 
 * Tries a match on the given MatcherContext.
 * @param context the MatcherContext
 * @return true if the match was successful
 */
@Override public <V>boolean match(final MatcherContext<V> context){
  final int maxLength=trie.getMaxLength();
  final int index=context.getCurrentIndex();
  final String input=context.getInputBuffer().extract(index,index + maxLength);
  final int ret=trie.search(input,false);
  if (ret == -1)   return false;
  context.advanceIndex(ret);
  return true;
}
Program: 33549
Project: 33549
Buggy source:
public int search(final String needle){
  return doSearch(CharBuffer.wrap(needle),fullWord ? 0 : -1,0);
}

Fixed version (ground truth):
public int search(final String needle,final boolean ignoreCase){
  return doSearch(CharBuffer.wrap(needle),fullWord ? 0 : -1,0,ignoreCase);
}
Program: 33550
Project: 33550
Buggy source:
/** 
 * Core search method <p>This method uses a   {@link CharBuffer} to perform searches, and changesthis buffer's position as the match progresses. The two other arguments are the depth of the current search (ie the number of nodes visited since root) and the index of the last node where a match was found (ie the last node where  {@link #fullWord} was true.</p>
 * @param buffer the charbuffer
 * @param matchedLength the last matched length (-1 if no match yet)
 * @param currentLength the current length walked by the trie
 * @return the length of the match found, -1 otherwise
 */
private int doSearch(final CharBuffer buffer,final int matchedLength,final int currentLength){
  final int nextLength=fullWord ? currentLength : matchedLength;
  if (!buffer.hasRemaining())   return nextLength;
  final int index=Arrays.binarySearch(nextChars,buffer.get());
  return index < 0 ? nextLength : nextNodes[index].doSearch(buffer,nextLength,currentLength + 1);
}

Fixed version (ground truth):
/** 
 * Core search method <p>This method uses a   {@link CharBuffer} to perform searches, and changesthis buffer's position as the match progresses. The two other arguments are the depth of the current search (ie the number of nodes visited since root) and the index of the last node where a match was found (ie the last node where  {@link #fullWord} was true.</p>
 * @param buffer the charbuffer
 * @param matchedLength the last matched length (-1 if no match yet)
 * @param currentLength the current length walked by the trie
 * @return the length of the match found, -1 otherwise
 */
private int doSearch(final CharBuffer buffer,final int matchedLength,final int currentLength,final boolean ignoreCase){
  final int nextLength=fullWord ? currentLength : matchedLength;
  if (!buffer.hasRemaining())   return nextLength;
  char c=buffer.get();
  int index=Arrays.binarySearch(nextChars,c);
  if (index == -1 && ignoreCase) {
    final boolean isUpper=Character.isUpperCase(c);
    final boolean isLower=Character.isLowerCase(c);
    if (isUpper != isLower) {
      c=isUpper ? Character.toLowerCase(c) : Character.toUpperCase(c);
      index=Arrays.binarySearch(nextChars,c);
    }
  }
  if (index < 0)   return nextLength;
  return nextNodes[index].doSearch(buffer,nextLength,currentLength + 1,ignoreCase);
}
Program: 33551
Project: 33551
Buggy source:
TrieNodeBuilder addWord(final CharSequence word,final boolean ignoreCase){
  doAddWord(word,ignoreCase,0);
  return this;
}

Fixed version (ground truth):
public TrieNodeBuilder addWord(final String word){
  doAddWord(CharBuffer.wrap(word));
  return this;
}
Program: 33552
Project: 33552
Buggy source:
/** 
 * Add a word
 * @param word the word as a {@link CharSequence}
 * @param ignoreCase whether the trie ignores case
 * @param index the current index in the sequence
 */
private void doAddWord(final CharSequence word,final boolean ignoreCase,final int index){
  if (word.length() == index) {
    fullWord=true;
    return;
  }
  char c;
  TrieNodeBuilder builder;
  c=word.charAt(index);
  builder=subnodes.get(c);
  if (builder == null) {
    builder=new TrieNodeBuilder();
    subnodes.put(c,builder);
  }
  builder.doAddWord(word,ignoreCase,index + 1);
  if (!ignoreCase)   return;
  final boolean upper=Character.isUpperCase(c);
  final boolean lower=Character.isLowerCase(c);
  if (upper == lower)   return;
  if (Character.isUpperCase(c)) {
    c=Character.toLowerCase(c);
    builder=subnodes.get(c);
    if (builder == null) {
      builder=new TrieNodeBuilder();
      subnodes.put(c,builder);
    }
    builder.doAddWord(word,ignoreCase,index + 1);
  }
  if (Character.isLowerCase(c)) {
    c=Character.toUpperCase(c);
    builder=subnodes.get(c);
    if (builder == null) {
      builder=new TrieNodeBuilder();
      subnodes.put(c,builder);
    }
    builder.doAddWord(word,ignoreCase,index + 1);
  }
}

Fixed version (ground truth):
/** 
 * Add a word <p>Here also, a   {@link CharBuffer} is used, which changes position as weprogress into building the tree, character by character, node by node. </p> <p>If the buffer is "empty" when entering this method, it means a match must be recorded (see  {@link #fullWord}).</p>
 * @param buffer the buffer (never null)
 */
private void doAddWord(final CharBuffer buffer){
  if (!buffer.hasRemaining()) {
    fullWord=true;
    return;
  }
  final char c=buffer.get();
  TrieNodeBuilder builder=subnodes.get(c);
  if (builder == null) {
    builder=new TrieNodeBuilder();
    subnodes.put(c,builder);
  }
  builder.doAddWord(buffer);
}
Program: 33553
Project: 33553
Buggy source:
/** 
 * Match one string among many using a <a href="http://en.wikipedia.org/wiki/Trie" target="_blank">trie</a>, case insensitive <p>This method delegates to   {@link #trieIgnoreCase(Collection)}.</p>
 * @param first the first string
 * @param second the second string
 * @param others other strings
 * @return a rule
 * @see TrieBuilder#TrieBuilder(boolean)
 */
public Rule trieIgnoreCase(final String first,final String second,final String... others){
  final List<String> words=ImmutableList.<String>builder().add(first).add(second).add(others).build();
  return trieIgnoreCase(words);
}

Fixed version (ground truth):
/** 
 * Match one string among many using a <a href="http://en.wikipedia.org/wiki/Trie" target="_blank">trie</a>, case insensitive <p>This method delegates to   {@link #trieIgnoreCase(Collection)}.</p>
 * @param first the first string
 * @param second the second string
 * @param others other strings
 * @return a rule
 * @see CaseInsensitiveTrieMatcher
 */
public Rule trieIgnoreCase(final String first,final String second,final String... others){
  final List<String> words=ImmutableList.<String>builder().add(first).add(second).add(others).build();
  return trieIgnoreCase(words);
}
Program: 33554
Project: 33554
Buggy source:
public TrieMatcherTest(){
  final TrieBuilder builder=Trie.newBuilder(false);
  for (  final String keyword : KEYWORDS)   builder.addWord(keyword);
  matcher=new TrieMatcher(builder.build());
}

Fixed version (ground truth):
public TrieMatcherTest(){
  final TrieBuilder builder=Trie.newBuilder();
  for (  final String keyword : KEYWORDS)   builder.addWord(keyword);
  matcher=new TrieMatcher(builder.build());
}
Program: 33555
Project: 33555
Buggy source:
protected final void resetValueStack(){
  if (stackSnapshot == null)   stackSnapshot=new ArrayList<>();
  valueStack.restoreSnapshot(stackSnapshot);
}

Fixed version (ground truth):
protected final void resetValueStack(){
  valueStack=new DefaultValueStack<>();
  stackSnapshot=null;
}
Program: 33556
Project: 33556
Buggy source:
public void writeBefore(final MatcherContext<?> context) throws IOException {
  final Matcher matcher=context.getMatcher();
  @SuppressWarnings("String_Node_Str") final String name=matcher.getClass().getSimpleName();
  sb.setLength(0);
  sb.append(BEFORE_MATCH).append(';').append(context.getCurrentIndex()).append(';').append(context.getLevel()).append(';').append(matcher.toString().replace("String_Node_Str","String_Node_Str")).append(';').append(matcher.getType().ordinal()).append(name.isEmpty() ? "String_Node_Str" : name).append(';');
  writer.append(sb);
}

Fixed version (ground truth):
public void writeBefore(final MatcherContext<?> context,final long nanos) throws IOException {
  final Matcher matcher=context.getMatcher();
  @SuppressWarnings("String_Node_Str") final String name=matcher.getClass().getSimpleName();
  sb.setLength(0);
  sb.append(BEFORE_MATCH).append(';').append(context.getCurrentIndex()).append(';').append(context.getLevel()).append(';').append(matcher.toString().replace("String_Node_Str","String_Node_Str")).append(';').append(matcher.getType().ordinal()).append(';').append(name.isEmpty() ? "String_Node_Str" : name).append(';').append(nanos).append('\n');
  writer.append(sb);
}
Program: 33557
Project: 33557
Buggy source:
@Override public void beforeMatch(final PreMatchEvent<V> event){
  try {
    eventWriter.writeBefore(event.getContext());
  }
 catch (  IOException e) {
    throw cleanup("String_Node_Str",e);
  }
  before=System.nanoTime();
}

Fixed version (ground truth):
@Override public void beforeMatch(final PreMatchEvent<V> event){
  try {
    eventWriter.writeBefore(event.getContext(),System.nanoTime());
  }
 catch (  IOException e) {
    throw cleanup("String_Node_Str",e);
  }
}
Program: 33558
Project: 33558
Buggy source:
@Override public void matchFailure(final MatchFailureEvent<V> event){
  try {
    eventWriter.writeAfter(event.getContext(),before,System.nanoTime(),false);
  }
 catch (  IOException e) {
    throw cleanup("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public void matchFailure(final MatchFailureEvent<V> event){
  try {
    eventWriter.writeFailure(event.getContext(),System.nanoTime());
  }
 catch (  IOException e) {
    throw cleanup("String_Node_Str",e);
  }
}
Program: 33559
Project: 33559
Buggy source:
@Override public void matchSuccess(final MatchSuccessEvent<V> event){
  try {
    eventWriter.writeAfter(event.getContext(),before,System.nanoTime(),true);
  }
 catch (  IOException e) {
    throw cleanup("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public void matchSuccess(final MatchSuccessEvent<V> event){
  try {
    eventWriter.writeSuccess(event.getContext(),System.nanoTime());
  }
 catch (  IOException e) {
    throw cleanup("String_Node_Str",e);
  }
}
Program: 33560
Project: 33560
Buggy source:
private int doBinarySearch(final int low,final int high,final int index){
  if (low == high)   return low;
  final int middle=(low + high) / 2;
  final Range<Integer> range=lines.get(middle);
  if (range.contains(index))   return middle;
  return index < range.lowerEndpoint() ? doBinarySearch(low,middle,index) : doBinarySearch(middle,high,index);
}

Fixed version (ground truth):
private int doBinarySearch(final int low,final int high,final int index){
  if (high - low <= 1)   return lines.get(low).contains(index) ? low : high;
  final int middle=(low + high) / 2;
  final Range<Integer> range=lines.get(middle);
  if (range.contains(index))   return middle;
  return index < range.lowerEndpoint() ? doBinarySearch(low,middle,index) : doBinarySearch(middle,high,index);
}
Program: 33561
Project: 33561
Buggy source:
@BeforeMethod public void initContext(){
  builder=new MatcherContextBuilder().withInput("String_Node_Str").withMatcher(EndOfInputMatcher.INSTANCE);
}

Fixed version (ground truth):
@BeforeMethod public void initContext(){
  builder=new MatcherContextBuilder().withInput("String_Node_Str").withMatcher(new EndOfInputMatcher());
}
Program: 33562
Project: 33562
Buggy source:
public TestResult(final ParsingResult<V> result){
  this.result=result;
  resultAssert=OldParsingResultAssert.assertResult(result);
}

Fixed version (ground truth):
public TestResult(final ParsingResult<V> result){
  this.result=result;
}
Program: 33563
Project: 33563
Buggy source:
/** 
 * Tries a match on the given MatcherContext.
 * @param context the MatcherContext
 * @return true if the match was successful
 */
@Override public <V>boolean match(final MatcherContext<V> context){
  if (!joined.getSubContext(context).runMatcher()) {
    if (minCycles != 0)     return false;
    context.createNode();
    return true;
  }
  int beforeCycle;
  beforeCycle=context.getCurrentIndex();
  if (!matchJoining(context,beforeCycle)) {
    context.setCurrentIndex(beforeCycle);
    if (minCycles > 1)     return false;
    context.createNode();
    return true;
  }
  int cycles=2;
  while (true) {
    beforeCycle=context.getCurrentIndex();
    if (matchJoining(context,beforeCycle) && joined.getSubContext(context).runMatcher()) {
      cycles++;
      continue;
    }
    context.setCurrentIndex(beforeCycle);
    break;
  }
  if (cycles < minCycles)   return false;
  context.createNode();
  return true;
}

Fixed version (ground truth):
/** 
 * Tries a match on the given MatcherContext.
 * @param context the MatcherContext
 * @return true if the match was successful
 */
@Override public <V>boolean match(final MatcherContext<V> context){
  if (!joined.getSubContext(context).runMatcher()) {
    if (minCycles != 0)     return false;
    context.createNode();
    return true;
  }
  int completedCycles=1;
  int beforeCycle=context.getCurrentIndex();
  while (matchCycle(context,beforeCycle)) {
    beforeCycle=context.getCurrentIndex();
    completedCycles++;
  }
  context.setCurrentIndex(beforeCycle);
  if (completedCycles < minCycles)   return false;
  context.createNode();
  return true;
}
Program: 33564
Project: 33564
Buggy source:
@Override protected void generateMethod(final InstructionGroup group,final ClassWriter cw){
  final MethodVisitor mv=cw.visitMethod(ACC_PUBLIC,"String_Node_Str",CodegenUtils.sig(void.class,Object.class),null,null);
  convertXLoads(group);
  group.getInstructions().accept(mv);
  mv.visitInsn(ARETURN);
  mv.visitMaxs(0,0);
}

Fixed version (ground truth):
@Override protected void generateMethod(final InstructionGroup group,final ClassWriter cw){
  final MethodVisitor mv=cw.visitMethod(ACC_PUBLIC,"String_Node_Str",CodegenUtils.sig(Object.class),null,null);
  convertXLoads(group);
  group.getInstructions().accept(mv);
  mv.visitInsn(ARETURN);
  mv.visitMaxs(0,0);
}
Program: 33565
Project: 33565
Buggy source:
/** 
 * Tries a match on the given MatcherContext.
 * @param context the MatcherContext
 * @return true if the match was successful
 */
@Override public <V>boolean match(final MatcherContext<V> context){
  if (!joined.getSubContext(context).runMatcher()) {
    if (minCycles != 0)     return false;
    context.createNode();
    return true;
  }
  int beforeCycle;
  beforeCycle=context.getCurrentIndex();
  if (!matchJoining(context,beforeCycle)) {
    context.setCurrentIndex(beforeCycle);
    if (minCycles != 1)     return false;
    context.createNode();
    return true;
  }
  int cycles=2;
  while (true) {
    beforeCycle=context.getCurrentIndex();
    if (matchJoining(context,beforeCycle) && joined.getSubContext(context).runMatcher()) {
      cycles++;
      continue;
    }
    context.setCurrentIndex(beforeCycle);
    break;
  }
  if (cycles < minCycles)   return false;
  context.createNode();
  return true;
}

Fixed version (ground truth):
/** 
 * Tries a match on the given MatcherContext.
 * @param context the MatcherContext
 * @return true if the match was successful
 */
@Override public <V>boolean match(final MatcherContext<V> context){
  if (!joined.getSubContext(context).runMatcher()) {
    if (minCycles != 0)     return false;
    context.createNode();
    return true;
  }
  int beforeCycle;
  beforeCycle=context.getCurrentIndex();
  if (!matchJoining(context,beforeCycle)) {
    context.setCurrentIndex(beforeCycle);
    if (minCycles > 1)     return false;
    context.createNode();
    return true;
  }
  int cycles=2;
  while (true) {
    beforeCycle=context.getCurrentIndex();
    if (matchJoining(context,beforeCycle) && joined.getSubContext(context).runMatcher()) {
      cycles++;
      continue;
    }
    context.setCurrentIndex(beforeCycle);
    break;
  }
  if (cycles < minCycles)   return false;
  context.createNode();
  return true;
}
Program: 33566
Project: 33566
Buggy source:
@Override public int getLineCount(){
  return 0;
}

Fixed version (ground truth):
@Override public int getLineCount(){
  if (!newlinesAreBuilt.getAndSet(true))   buildNewlines();
  return newlines.length + 1;
}
Program: 33567
Project: 33567
Buggy source:
@Override public AnnotationVisitor visitAnnotation(final String desc,final boolean visible){
  recordDesc(ruleAnnotations,desc);
  if (Types.EXPLICIT_ACTIONS_ONLY_DESC.equals(desc)) {
    return null;
  }
  if (Types.SUPPRESS_NODE_DESC.equals(desc)) {
    hasSuppressNodeAnnotation=true;
    return null;
  }
  if (Types.SUPPRESS_SUBNODES_DESC.equals(desc)) {
    hasSuppressSubnodesAnnotation=true;
    return null;
  }
  if (Types.SKIP_NODE_DESC.equals(desc)) {
    hasSkipNodeAnnotation=true;
    return null;
  }
  if (Types.MEMO_MISMATCHES_DESC.equals(desc)) {
    hasMemoMismatchesAnnotation=true;
    return null;
  }
  if (Types.SKIP_ACTIONS_IN_PREDICATES_DESC.equals(desc)) {
    hasSkipActionsInPredicatesAnnotation=true;
    return null;
  }
  if (Types.DONT_SKIP_ACTIONS_IN_PREDICATES_DESC.equals(desc)) {
    hasSkipActionsInPredicatesAnnotation=false;
    return null;
  }
  if (Types.DONT_LABEL_DESC.equals(desc)) {
    hasDontLabelAnnotation=true;
    return null;
  }
  return visible ? super.visitAnnotation(desc,true) : null;
}

Fixed version (ground truth):
@Override public AnnotationVisitor visitAnnotation(final String desc,final boolean visible){
  recordDesc(ruleAnnotations,desc);
  if (Types.EXPLICIT_ACTIONS_ONLY_DESC.equals(desc)) {
    return null;
  }
  if (Types.SUPPRESS_NODE_DESC.equals(desc)) {
    hasSuppressNodeAnnotation=true;
    return null;
  }
  if (Types.SUPPRESS_SUBNODES_DESC.equals(desc)) {
    hasSuppressSubnodesAnnotation=true;
    return null;
  }
  if (Types.SKIP_NODE_DESC.equals(desc)) {
    hasSkipNodeAnnotation=true;
    return null;
  }
  if (Types.MEMO_MISMATCHES_DESC.equals(desc)) {
    hasMemoMismatchesAnnotation=true;
    return null;
  }
  if (Types.SKIP_ACTIONS_IN_PREDICATES_DESC.equals(desc)) {
    hasSkipActionsInPredicatesAnnotation=true;
    return null;
  }
  if (Types.DONT_SKIP_ACTIONS_IN_PREDICATES_DESC.equals(desc)) {
    hasSkipActionsInPredicatesAnnotation=false;
    return null;
  }
  if (Types.DONT_LABEL_DESC.equals(desc)) {
    hasDontLabelAnnotation=true;
    return null;
  }
  if (Types.DONT_EXTEND_DESC.equals(desc)) {
    return null;
  }
  return visible ? super.visitAnnotation(desc,true) : null;
}
Program: 33568
Project: 33568
Buggy source:
@Override public View getView(Context c,LayoutInflater inflater,View convertView){
  ViewHolder holder;
  if (convertView == null || !(convertView.getTag() instanceof ViewHolder)) {
    convertView=inflater.inflate(R.layout.list_item_stats,null);
    holder=new ViewHolder();
    holder.teamNumber=(TextView)convertView.findViewById(R.id.team_number);
    holder.teamName=(TextView)convertView.findViewById(R.id.team_name);
    holder.teamStat=(TextView)convertView.findViewById(R.id.team_stat);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.teamNumber.setText("String_Node_Str" + teamNumber);
  if (!teamName.isEmpty()) {
    holder.teamName.setText(teamName);
  }
 else {
    holder.teamName.setText("String_Node_Str" + teamNumber);
  }
  holder.teamStat.setText(teamStat);
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(Context c,LayoutInflater inflater,View convertView){
  ViewHolder holder;
  if (convertView == null || !(convertView.getTag() instanceof ViewHolder)) {
    convertView=inflater.inflate(R.layout.list_item_stats,null);
    holder=new ViewHolder();
    holder.teamNumber=(TextView)convertView.findViewById(R.id.team_number);
    holder.teamName=(TextView)convertView.findViewById(R.id.team_name);
    holder.teamStat=(TextView)convertView.findViewById(R.id.team_stat);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.teamNumber.setText("String_Node_Str" + teamNumber);
  holder.teamName.setText(TextUtils.isEmpty(teamName) ? "String_Node_Str" + teamNumber : teamName);
  holder.teamStat.setText(teamStat);
  return convertView;
}
Program: 33569
Project: 33569
Buggy source:
@Override public void parseData(){
  mDataToBind.clear();
  if (mAPIData == null || mAPIData.getRankings() == null || mAPIData.getRankings().isEmpty()) {
    return;
  }
  List<IRankingItem> rankings=mAPIData.getRankings();
  List<IRankingSortOrder> sortOrders=mAPIData.getSortOrderInfo();
  List<IRankingSortOrder> extraStats=mAPIData.getExtraStatsInfo();
  for (int i=0; i < rankings.size(); i++) {
    IRankingItem row=rankings.get(i);
    String teamKey=row.getTeamKey();
    String rankingString;
    String rankingSummary;
    String record;
    @Nullable ITeamRecord teamRecord=row.getRecord();
    if (teamRecord != null) {
      record="String_Node_Str" + RankingItem.TeamRecord.buildRecordString(teamRecord) + "String_Node_Str";
    }
 else {
      record="String_Node_Str";
    }
    IRankingSortOrder firstSortInfo=sortOrders.get(0);
    Double firstSort=row.getSortOrders().remove(0);
    rankingSummary=mResources.getString(R.string.rank_item_summary,sortOrders.get(0).getName(),formatSortOrder(firstSortInfo,firstSort));
    rankingString=buildRankingString(row,sortOrders,extraStats,mResources,BOLD_TITLES | LINE_BREAKS);
    Team team=mDb.getTeamsTable().get(teamKey);
    String nickname;
    if (team != null) {
      nickname=team.getNickname();
    }
 else {
      nickname="String_Node_Str" + teamKey.substring(3);
    }
    mDataToBind.add(new TeamRankingViewModel(teamKey,nickname,teamKey.substring(3),row.getRank(),record,rankingSummary,rankingString));
  }
  mEventBus.post(new EventRankingsEvent(generateTopRanksString(mAPIData)));
}

Fixed version (ground truth):
@Override public void parseData(){
  mDataToBind.clear();
  if (mAPIData == null || mAPIData.getRankings() == null || mAPIData.getRankings().isEmpty()) {
    return;
  }
  List<IRankingItem> rankings=mAPIData.getRankings();
  List<IRankingSortOrder> sortOrders=mAPIData.getSortOrderInfo();
  List<IRankingSortOrder> extraStats=mAPIData.getExtraStatsInfo();
  IRankingSortOrder firstSortInfo=sortOrders.remove(0);
  for (int i=0; i < rankings.size(); i++) {
    IRankingItem row=rankings.get(i);
    String teamKey=row.getTeamKey();
    String rankingString;
    String rankingSummary;
    String record;
    @Nullable ITeamRecord teamRecord=row.getRecord();
    if (teamRecord != null) {
      record="String_Node_Str" + RankingItem.TeamRecord.buildRecordString(teamRecord) + "String_Node_Str";
    }
 else {
      record="String_Node_Str";
    }
    Double firstSort=row.getSortOrders().remove(0);
    rankingSummary=mResources.getString(R.string.rank_item_summary,firstSortInfo.getName(),formatSortOrder(firstSortInfo,firstSort));
    rankingString=buildRankingString(row,sortOrders,extraStats,mResources,BOLD_TITLES | LINE_BREAKS);
    Team team=mDb.getTeamsTable().get(teamKey);
    String nickname;
    if (team != null) {
      nickname=team.getNickname();
    }
 else {
      nickname="String_Node_Str" + teamKey.substring(3);
    }
    mDataToBind.add(new TeamRankingViewModel(teamKey,nickname,teamKey.substring(3),row.getRank(),record,rankingSummary,rankingString));
  }
  mEventBus.post(new EventRankingsEvent(generateTopRanksString(mAPIData)));
}
Program: 33570
Project: 33570
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.notification_preferences);
  if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) {
    addPreferencesFromResource(R.xml.notification_preferences_lollipop);
  }
  notificationTone=findPreference("String_Node_Str");
  notificationVibrate=findPreference("String_Node_Str");
  notificationHeadsup=null;
  if (Utilities.hasLApis()) {
    notificationHeadsup=findPreference("String_Node_Str");
  }
  notificationLedEnabled=(CheckBoxPreference)findPreference("String_Node_Str");
  notificationLedColor=findPreference("String_Node_Str");
  CheckBoxPreference enableNotifications=(CheckBoxPreference)findPreference("String_Node_Str");
  boolean currentlyEnabled=enableNotifications.isChecked();
  setPreferencesEnabled(currentlyEnabled);
  enableNotifications.setOnPreferenceChangeListener((preference,newValue) -> {
    boolean enabled=(Boolean)newValue;
    setPreferencesEnabled(enabled);
    return true;
  }
);
  notificationLedColor.setEnabled(notificationLedEnabled.isChecked());
  notificationLedEnabled.setOnPreferenceChangeListener((preference,newValue) -> {
    boolean enabled=(Boolean)newValue;
    notificationLedColor.setEnabled(enabled);
    return true;
  }
);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.notification_preferences);
  if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) {
    addPreferencesFromResource(R.xml.notification_preferences_lollipop);
  }
}
Program: 33572
Project: 33572
Buggy source:
public Observable<List<Media>> fetchTeamMediaInYear(String teamKey,int year,String cacheHeader){
  Observable<List<Media>> apiData=mResponseMap.getAndWriteResponseBody(mApiv3.fetchTeamMediaInYear(teamKey,year,cacheHeader),mWriter.getMediaListWriter().get());
  return mAPICache.fetchTeamMediaInYear(teamKey,year).concatWith(apiData);
}

Fixed version (ground truth):
public Observable<List<Media>> fetchTeamMediaInYear(String teamKey,int year,String cacheHeader){
  Observable<List<Media>> apiData=mResponseMap.mapAndWriteResponseBody(mApiv3.fetchTeamMediaInYear(teamKey,year,cacheHeader),new TeamMediaKeyAdder(teamKey,year),mWriter.getMediaListWriter().get());
  return mAPICache.fetchTeamMediaInYear(teamKey,year).concatWith(apiData);
}
Program: 33573
Project: 33573
Buggy source:
public Integer getPlayOrder(){
  int matchNumber=getMatchNumber(), setNumber=getSetNumber();
  return type.getPlayOrder() * 1000000 + matchNumber * 1000 + setNumber;
}

Fixed version (ground truth):
public Integer getPlayOrder(){
  int matchNumber=getMatchNumber(), setNumber=getSetNumber();
  return getType().getPlayOrder() * 1000000 + matchNumber * 1000 + setNumber;
}
Program: 33574
Project: 33574
Buggy source:
public Integer getDisplayOrder(){
  int matchNumber=getMatchNumber(), setNumber=getSetNumber();
  return type.getPlayOrder() * 1000000 + setNumber * 1000 + matchNumber;
}

Fixed version (ground truth):
public Integer getDisplayOrder(){
  int matchNumber=getMatchNumber(), setNumber=getSetNumber();
  return getType().getPlayOrder() * 1000000 + setNumber * 1000 + matchNumber;
}
Program: 33575
Project: 33575
Buggy source:
@Nullable @Override public Void renderToViewModel(Context context,@Nullable Void aVoid){
  return null;
}

Fixed version (ground truth):
@Nullable @Override public GenericNotificationViewModel renderToViewModel(Context context,@Nullable Void aVoid){
  Resources r=context.getResources();
  String header=getNotificationCardHeader(context,districtName,districtKey);
  String districtCode=EventHelper.getEventCode(districtKey);
  String title=r.getString(R.string.notification_district_points_title,districtCode);
  String contentText=r.getString(R.string.notification_district_points_updated,districtName);
  return new GenericNotificationViewModel(header,title,contentText,getNotificationTimeString(context),getIntent(context));
}
Program: 33576
Project: 33576
Buggy source:
@Override public void updateData(@Nullable MatchBreakdownBinder.Model data){
  if (data == null || data.allianceData == null || data.scoreData == null || breakdown == null) {
    if (!isDataBound()) {
      setDataBound(false);
    }
    return;
  }
  long startTime=System.currentTimeMillis();
  Log.d(Constants.LOG_TAG,"String_Node_Str");
  breakdown.initWithData(mMatchType,data.allianceData,data.scoreData);
  if (progressBar != null) {
    progressBar.setVisibility(View.GONE);
  }
  breakdown.setVisibility(View.VISIBLE);
  mNoDataBinder.unbindData();
  Log.d(Constants.LOG_TAG,"String_Node_Str" + (System.currentTimeMillis() - startTime) + "String_Node_Str");
  setDataBound(true);
}

Fixed version (ground truth):
@Override public void updateData(@Nullable MatchBreakdownBinder.Model data){
  if (data == null || data.allianceData == null || data.scoreData == null || breakdown == null) {
    if (!isDataBound()) {
      setDataBound(false);
    }
    return;
  }
  long startTime=System.currentTimeMillis();
  Log.d(Constants.LOG_TAG,"String_Node_Str");
  boolean success=breakdown.initWithData(mMatchType,data.allianceData,data.scoreData);
  if (!success) {
    setDataBound(false);
    return;
  }
  if (progressBar != null) {
    progressBar.setVisibility(View.GONE);
  }
  breakdown.setVisibility(View.VISIBLE);
  mNoDataBinder.unbindData();
  Log.d(Constants.LOG_TAG,"String_Node_Str" + (System.currentTimeMillis() - startTime) + "String_Node_Str");
  setDataBound(true);
}
Program: 33578
Project: 33578
Buggy source:
@Override public void updateData(@Nullable List<ListGroup> data){
  if (data == null || expandableListView == null) {
    if (!isDataBound()) {
      setDataBound(false);
    }
    return;
  }
  if (data.isEmpty()) {
    Log.d(Constants.LOG_TAG,"String_Node_Str");
    if (!isDataBound()) {
      setDataBound(false);
    }
    return;
  }
  if (mAdapter == null) {
    mAdapter=newAdapter(new ArrayList<>(data));
    expandableListView.setAdapter(mAdapter);
  }
 else {
    mAdapter.removeAllGroups();
    mAdapter.addAllGroups(new ArrayList<>(data));
    mAdapter.notifyDataSetChanged();
  }
  expandableListView.setVisibility(View.VISIBLE);
  expandForMode(data);
  if (progressBar != null) {
    progressBar.setVisibility(View.GONE);
  }
  mNoDataBinder.unbindData();
  setDataBound(true);
}

Fixed version (ground truth):
@Override public void updateData(@Nullable List<ListGroup> data){
  if (data == null || expandableListView == null) {
    if (!isDataBound()) {
      setDataBound(false);
    }
    return;
  }
  if (data.isEmpty()) {
    Log.d(Constants.LOG_TAG,"String_Node_Str");
    if (!isDataBound()) {
      setDataBound(false);
    }
    return;
  }
  if (expandableListView.getExpandableListAdapter() == null) {
    expandableListView.setAdapter(newAdapter(new ArrayList<>(data)));
  }
 else {
    ExpandableListViewAdapter adapter=(ExpandableListViewAdapter)expandableListView.getExpandableListAdapter();
    adapter.removeAllGroups();
    adapter.addAllGroups(new ArrayList<>(data));
    adapter.notifyDataSetChanged();
  }
  expandableListView.setVisibility(View.VISIBLE);
  expandForMode(data);
  if (progressBar != null) {
    progressBar.setVisibility(View.GONE);
  }
  mNoDataBinder.unbindData();
  setDataBound(true);
}
Program: 33579
Project: 33579
Buggy source:
/** 
 * @return a comma-separated CharSequence of the given names, applying bold style to names thatsatisfy the given predicate.
 */
public static CharSequence boldNameList(Iterable<? extends CharSequence> names,Predicate<String> beBold){
  final SpannableStringBuilder result=new SpannableStringBuilder();
  boolean first=true;
  for (  CharSequence name : names) {
    if (first) {
      first=false;
    }
 else {
      result.append("String_Node_Str");
    }
    if (beBold.apply(name.toString())) {
      result.append(name,new StyleSpan(Typeface.BOLD),0);
    }
 else {
      result.append(name);
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * @return a comma-separated CharSequence of the given names, applying bold style to names thatsatisfy the given predicate.
 */
public static CharSequence boldNameList(Iterable<? extends CharSequence> names,Predicate<String> beBold){
  final SpannableStringBuilder result=new SpannableStringBuilder();
  boolean first=true;
  for (  CharSequence name : names) {
    if (first) {
      first=false;
    }
 else {
      result.append("String_Node_Str");
    }
    if (beBold.apply(name.toString())) {
      supportAppend(result,name,new StyleSpan(Typeface.BOLD),0);
    }
 else {
      result.append(name);
    }
  }
  return result;
}
Program: 33580
Project: 33580
Buggy source:
@Override public void onScrolled(RecyclerView recyclerView,int dx,int dy){
  if (mRecyclerView.computeVerticalScrollOffset() == 0) {
    hideNewNotificationIndicator(true);
    return;
  }
  if (dy > 0) {
    hideNewNotificationIndicator(true);
  }
 else   if (dy < 0) {
    showNewNotificationIndicator(true);
  }
}

Fixed version (ground truth):
@Override public void onScrolled(RecyclerView recyclerView,int dx,int dy){
  if (mRecyclerView.computeVerticalScrollOffset() == 0) {
    hideNewNotificationIndicator(true);
    mNewNotificationCount=0;
    updateNewNotificationIndicator();
    return;
  }
  if (dy > 0) {
    hideNewNotificationIndicator(true);
  }
 else   if (dy < 0) {
    showNewNotificationIndicator(true);
  }
}
Program: 33581
Project: 33581
Buggy source:
@Override public void bindViews(){
  super.bindViews();
  mNewNotificationIndicator=(TextView)mRootView.findViewById(R.id.new_notification_indicator);
  mNewNotificationIndicator.setOnClickListener(v -> {
    mNewNotificationCount=0;
    mRecyclerView.smoothScrollToPosition(0);
    hideNewNotificationIndicator(true);
  }
);
  hideNewNotificationIndicator(false);
  mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener(){
    @Override public void onScrolled(    RecyclerView recyclerView,    int dx,    int dy){
      if (mRecyclerView.computeVerticalScrollOffset() == 0) {
        hideNewNotificationIndicator(true);
        return;
      }
      if (dy > 0) {
        hideNewNotificationIndicator(true);
      }
 else       if (dy < 0) {
        showNewNotificationIndicator(true);
      }
    }
  }
);
}

Fixed version (ground truth):
@Override public void bindViews(){
  super.bindViews();
  mNewNotificationIndicator=(TextView)mRootView.findViewById(R.id.new_notification_indicator);
  mNewNotificationIndicator.setOnClickListener(v -> {
    hideNewNotificationIndicator(true);
    mNewNotificationCount=0;
    mRecyclerView.smoothScrollToPosition(0);
  }
);
  hideNewNotificationIndicator(false);
  mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener(){
    @Override public void onScrolled(    RecyclerView recyclerView,    int dx,    int dy){
      if (mRecyclerView.computeVerticalScrollOffset() == 0) {
        hideNewNotificationIndicator(true);
        mNewNotificationCount=0;
        updateNewNotificationIndicator();
        return;
      }
      if (dy > 0) {
        hideNewNotificationIndicator(true);
      }
 else       if (dy < 0) {
        showNewNotificationIndicator(true);
      }
    }
  }
);
}
Program: 33582
Project: 33582
Buggy source:
private void switchToModeForId(int id,Bundle savedInstanceState){
  Fragment fragment;
switch (id) {
default :
case R.id.nav_item_events:
    int weekTab=savedInstanceState != null ? savedInstanceState.getInt(EventsByWeekFragment.TAB,-1) : -1;
  fragment=EventsByWeekFragment.newInstance(mMaxCompYear - mCurrentSelectedYearPosition,weekTab);
break;
case R.id.nav_item_districts:
fragment=DistrictListFragment.newInstance(mMaxCompYear - mCurrentSelectedYearPosition);
break;
case R.id.nav_item_teams:
int teamTab=savedInstanceState != null ? savedInstanceState.getInt(AllTeamsListFragment.SELECTED_TAB,0) : 0;
fragment=AllTeamsListFragment.newInstance(teamTab);
break;
case R.id.nav_item_my_tba:
fragment=new MyTBAFragment();
break;
case R.id.nav_item_settings:
startActivity(new Intent(this,SettingsActivity.class));
return;
case R.id.nav_item_notifications:
fragment=new RecentNotificationsFragment();
break;
case R.id.nav_item_gameday:
startActivity(GamedayActivity.newInstance(this));
return;
}
fragment.setRetainInstance(true);
getSupportFragmentManager().beginTransaction().setCustomAnimations(R.anim.fade_in_support,R.anim.fade_out_support).replace(R.id.container,fragment,MAIN_FRAGMENT_TAG).commit();
mCurrentSelectedNavigationItemId=id;
invalidateOptionsMenu();
if (mCurrentSelectedNavigationItemId == R.id.nav_item_districts || mCurrentSelectedNavigationItemId == R.id.nav_item_notifications) {
ViewCompat.setElevation(mToolbar,getResources().getDimension(R.dimen.toolbar_elevation));
}
 else {
ViewCompat.setElevation(mToolbar,0);
}
}

Fixed version (ground truth):
private void switchToModeForId(int id,Bundle savedInstanceState){
  Fragment fragment;
switch (id) {
default :
case R.id.nav_item_events:
    int weekTab=savedInstanceState != null ? savedInstanceState.getInt(EventsByWeekFragment.TAB,-1) : -1;
  fragment=EventsByWeekFragment.newInstance(mMaxCompYear - mCurrentSelectedYearPosition,weekTab);
break;
case R.id.nav_item_districts:
fragment=DistrictListFragment.newInstance(mMaxCompYear - mCurrentSelectedYearPosition);
break;
case R.id.nav_item_teams:
int teamTab=savedInstanceState != null ? savedInstanceState.getInt(AllTeamsListFragment.SELECTED_TAB,0) : 0;
fragment=AllTeamsListFragment.newInstance(teamTab);
break;
case R.id.nav_item_my_tba:
fragment=new MyTBAFragment();
break;
case R.id.nav_item_settings:
startActivity(new Intent(this,SettingsActivity.class));
return;
case R.id.nav_item_notifications:
fragment=new RecentNotificationsFragment();
break;
case R.id.nav_item_gameday:
startActivity(GamedayActivity.newInstance(this));
return;
}
fragment.setRetainInstance(true);
getSupportFragmentManager().beginTransaction().setCustomAnimations(R.anim.fade_in_support,R.anim.fade_out_support).replace(R.id.container,fragment,MAIN_FRAGMENT_TAG).commit();
mCurrentSelectedNavigationItemId=id;
setupToolbarForCurrentMode();
if (mCurrentSelectedNavigationItemId == R.id.nav_item_districts || mCurrentSelectedNavigationItemId == R.id.nav_item_notifications) {
ViewCompat.setElevation(mToolbar,getResources().getDimension(R.dimen.toolbar_elevation));
}
 else {
ViewCompat.setElevation(mToolbar,0);
}
}
Program: 33583
Project: 33583
Buggy source:
@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  if (intent != null && intent.getExtras() != null) {
    int requestedMode=intent.getExtras().getInt(REQUESTED_MODE,R.id.nav_item_events);
    if (requestedMode == mCurrentSelectedNavigationItemId) {
      return;
    }
 else {
      switchToModeForId(requestedMode,null);
    }
  }
 else {
    switchToModeForId(mCurrentSelectedNavigationItemId,null);
    invalidateOptionsMenu();
  }
}

Fixed version (ground truth):
@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  if (intent != null && intent.getExtras() != null) {
    int requestedMode=intent.getExtras().getInt(REQUESTED_MODE,R.id.nav_item_events);
    if (requestedMode == mCurrentSelectedNavigationItemId) {
      return;
    }
 else {
      switchToModeForId(requestedMode,null);
    }
  }
 else {
    switchToModeForId(mCurrentSelectedNavigationItemId,null);
  }
}
Program: 33584
Project: 33584
Buggy source:
@Override public ListViewAdapter newAdapter(List<ListItem> data){
  mData=(ListPair<ListItem>)data;
  return new EventStatsFragmentAdapter(mActivity,mData);
}

Fixed version (ground truth):
@Override public ListViewAdapter newAdapter(List<ListItem> data){
  mData=((ListPair<ListItem>)data).copyOf();
  return new EventStatsFragmentAdapter(mActivity,mData);
}
Program: 33585
Project: 33585
Buggy source:
@Override protected void replaceDataInAdapter(List<ListItem> data){
  mAdapter.notifyDataSetChanged();
}

Fixed version (ground truth):
@Override protected void replaceDataInAdapter(List<ListItem> data){
  mData.replaceAll((ListPair<ListItem>)data);
  mAdapter.notifyDataSetChanged();
}
Program: 33586
Project: 33586
Buggy source:
private void switchToModeForId(int id,Bundle savedInstanceState){
  Fragment fragment;
switch (id) {
default :
case R.id.nav_item_events:
    int weekTab=savedInstanceState != null ? savedInstanceState.getInt(EventsByWeekFragment.TAB,-1) : -1;
  fragment=EventsByWeekFragment.newInstance(mMaxCompYear - mCurrentSelectedYearPosition,weekTab);
break;
case R.id.nav_item_districts:
fragment=DistrictListFragment.newInstance(mMaxCompYear - mCurrentSelectedYearPosition);
break;
case R.id.nav_item_teams:
int teamTab=savedInstanceState != null ? savedInstanceState.getInt(AllTeamsListFragment.SELECTED_TAB,0) : 0;
fragment=AllTeamsListFragment.newInstance(teamTab);
break;
case R.id.nav_item_my_tba:
fragment=new MyTBAFragment();
break;
case R.id.nav_item_settings:
startActivity(new Intent(this,SettingsActivity.class));
return;
case R.id.nav_item_notifications:
fragment=new RecentNotificationsFragment();
break;
case R.id.nav_item_gameday:
startActivity(GamedayActivity.newInstance(this));
return;
}
fragment.setRetainInstance(true);
getSupportFragmentManager().beginTransaction().setCustomAnimations(R.anim.fade_in_support,R.anim.fade_out_support).replace(R.id.container,fragment,MAIN_FRAGMENT_TAG).commit();
mCurrentSelectedNavigationItemId=id;
invalidateOptionsMenu();
if (mCurrentSelectedNavigationItemId == R.id.nav_item_districts || mCurrentSelectedNavigationItemId == R.id.nav_item_notifications) {
ViewCompat.setElevation(mToolbar,getResources().getDimension(R.dimen.toolbar_elevation));
}
 else {
ViewCompat.setElevation(mToolbar,0);
}
}

Fixed version (ground truth):
private void switchToModeForId(int id,Bundle savedInstanceState){
  Fragment fragment;
switch (id) {
default :
case R.id.nav_item_events:
    int weekTab=savedInstanceState != null ? savedInstanceState.getInt(EventsByWeekFragment.TAB,-1) : -1;
  fragment=EventsByWeekFragment.newInstance(mMaxCompYear - mCurrentSelectedYearPosition,weekTab);
break;
case R.id.nav_item_districts:
fragment=DistrictListFragment.newInstance(mMaxCompYear - mCurrentSelectedYearPosition);
break;
case R.id.nav_item_teams:
int teamTab=savedInstanceState != null ? savedInstanceState.getInt(AllTeamsListFragment.SELECTED_TAB,0) : 0;
fragment=AllTeamsListFragment.newInstance(teamTab);
break;
case R.id.nav_item_my_tba:
fragment=new MyTBAFragment();
break;
case R.id.nav_item_settings:
startActivity(new Intent(this,SettingsActivity.class));
return;
case R.id.nav_item_notifications:
fragment=new RecentNotificationsFragment();
break;
case R.id.nav_item_gameday:
startActivity(GamedayActivity.newInstance(this));
return;
}
fragment.setRetainInstance(true);
getSupportFragmentManager().beginTransaction().setCustomAnimations(R.anim.fade_in_support,R.anim.fade_out_support).replace(R.id.container,fragment,MAIN_FRAGMENT_TAG).commit();
mCurrentSelectedNavigationItemId=id;
setupToolbarForCurrentMode();
if (mCurrentSelectedNavigationItemId == R.id.nav_item_districts || mCurrentSelectedNavigationItemId == R.id.nav_item_notifications) {
ViewCompat.setElevation(mToolbar,getResources().getDimension(R.dimen.toolbar_elevation));
}
 else {
ViewCompat.setElevation(mToolbar,0);
}
}
Program: 33587
Project: 33587
Buggy source:
@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  if (intent != null && intent.getExtras() != null) {
    int requestedMode=intent.getExtras().getInt(REQUESTED_MODE,R.id.nav_item_events);
    if (requestedMode == mCurrentSelectedNavigationItemId) {
      return;
    }
 else {
      switchToModeForId(requestedMode,null);
    }
  }
 else {
    switchToModeForId(mCurrentSelectedNavigationItemId,null);
    invalidateOptionsMenu();
  }
}

Fixed version (ground truth):
@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  if (intent != null && intent.getExtras() != null) {
    int requestedMode=intent.getExtras().getInt(REQUESTED_MODE,R.id.nav_item_events);
    if (requestedMode == mCurrentSelectedNavigationItemId) {
      return;
    }
 else {
      switchToModeForId(requestedMode,null);
    }
  }
 else {
    switchToModeForId(mCurrentSelectedNavigationItemId,null);
  }
}
Program: 33595
Project: 33595
Buggy source:
public static Intent newInstance(Context context,String teamKey,int year){
  Intent intent=new Intent(context,ViewTeamActivity.class);
  intent.putExtra(TEAM_KEY,teamKey);
  intent.putExtra(TEAM_YEAR,year);
  return intent;
}

Fixed version (ground truth):
public static Intent newInstance(Context context,String teamKey,int year){
  Intent intent=new Intent(context,ViewTeamActivity.class);
  intent.putExtra(EXTRA_TEAM_KEY,teamKey);
  intent.putExtra(TEAM_YEAR,year);
  return intent;
}
Program: 33596
Project: 33596
Buggy source:
@Override protected void onSaveInstanceState(Bundle outState){
  super.onSaveInstanceState(outState);
  outState.putInt(SELECTED_YEAR,mYear);
  outState.putInt(SELECTED_TAB,mSelectedTab);
}

Fixed version (ground truth):
@Override protected void onSaveInstanceState(Bundle outState){
  super.onSaveInstanceState(outState);
  outState.putInt(SELECTED_YEAR,mYear);
  outState.putInt(SELECTED_TAB,mSelectedTab);
  if (mCurrentPhotoUri != null) {
    outState.putString(CURRENT_PHOTO_URI,mCurrentPhotoUri);
  }
}
Program: 33597
Project: 33597
Buggy source:
@Override public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  List<Team> teams=mSubscriber.getApiData();
  if (teams == null) {
    return;
  }
  String teamKey=teams.get(position).getKey();
  Intent i=new Intent(mContext,ViewTeamActivity.class);
  i.putExtra(ViewTeamActivity.TEAM_KEY,teamKey);
  AnalyticsHelper.sendClickUpdate(mContext,"String_Node_Str",i.getDataString(),teamKey);
  mContext.startActivity(i);
}

Fixed version (ground truth):
@Override public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  List<Team> teams=mSubscriber.getApiData();
  if (teams == null) {
    return;
  }
  String teamKey=teams.get(position).getKey();
  Intent i=ViewTeamActivity.newInstance(mContext,teamKey);
  mContext.startActivity(i);
  AnalyticsHelper.sendClickUpdate(mContext,"String_Node_Str",i.getDataString(),teamKey);
}