nus-yam/ex-repair huggingface dataset:
Program: 188074
Project: 188074
Buggy source:
private void setLeftFragment(int containerId,Fragment frag){
  FragmentTransaction ft=getSupportFragmentManager().beginTransaction();
  removeFragment(ft,CONTROL_FRAGMENT_TAG);
  ft.replace(containerId,frag,LEFT_FRAGMENT_TAG);
  removeFragment(ft,RIGHT_FRAGMENT_TAG);
  ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN | FragmentTransaction.TRANSIT_FRAGMENT_CLOSE);
  ft.commitAllowingStateLoss();
}

Fixed version (ground truth):
private <F extends Fragment & ComparableFragment>void setLeftFragment(int containerId,F frag){
  if (!Objects.fragmentEquals(frag,getLeftComparableFragment())) {
    FragmentTransaction ft=getSupportFragmentManager().beginTransaction();
    removeFragment(ft,CONTROL_FRAGMENT_TAG);
    ft.replace(containerId,frag,LEFT_FRAGMENT_TAG);
    removeFragment(ft,RIGHT_FRAGMENT_TAG);
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN | FragmentTransaction.TRANSIT_FRAGMENT_CLOSE);
    ft.commitAllowingStateLoss();
  }
}
Program: 188075
Project: 188075
Buggy source:
private void setRightFragmentMultiPane(int containerId,ControlFragment controlFrag,ThingListFragment<?> rightFrag,boolean removeLeft){
  ThingListFragment<?> current=getThingListFragment();
  if (!Arguments.areEqual(current,rightFrag)) {
    safePopBackStackImmediate();
    FragmentTransaction ft=getSupportFragmentManager().beginTransaction();
    ft.add(controlFrag,CONTROL_FRAGMENT_TAG);
    if (removeLeft) {
      removeFragment(ft,LEFT_FRAGMENT_TAG);
    }
    ft.replace(containerId,rightFrag,RIGHT_FRAGMENT_TAG);
    removeFragment(ft,ThingFragment.TAG);
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN | FragmentTransaction.TRANSIT_FRAGMENT_CLOSE);
    ft.commitAllowingStateLoss();
  }
  refreshActionBar(controlFrag);
  refreshThingBodyWidthMeasurement();
  refreshViews(null);
}

Fixed version (ground truth):
private <F extends Fragment & ComparableFragment>void setRightFragmentMultiPane(int containerId,ControlFragment controlFrag,F frag,boolean removeLeft){
  if (!Objects.fragmentEquals(frag,getRightComparableFragment())) {
    safePopBackStackImmediate();
    FragmentTransaction ft=getSupportFragmentManager().beginTransaction();
    ft.add(controlFrag,CONTROL_FRAGMENT_TAG);
    if (removeLeft) {
      removeFragment(ft,LEFT_FRAGMENT_TAG);
    }
    ft.replace(containerId,frag,RIGHT_FRAGMENT_TAG);
    removeFragment(ft,ThingFragment.TAG);
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN | FragmentTransaction.TRANSIT_FRAGMENT_CLOSE);
    ft.commitAllowingStateLoss();
  }
  refreshActionBar(controlFrag);
  refreshThingBodyWidthMeasurement();
  refreshViews(null);
}
Program: 188076
Project: 188076
Buggy source:
private void bindMessageThingView(View view,Context context,Cursor cursor){
  final String author=cursor.getString(MessageThingLoader.INDEX_AUTHOR);
  final String body=cursor.getString(MessageThingLoader.INDEX_BODY);
  final long createdUtc=cursor.getLong(MessageThingLoader.INDEX_CREATED_UTC);
  final String destination=cursor.getString(MessageThingLoader.INDEX_DESTINATION);
  final String domain=null;
  final int downs=0;
  final boolean expanded=true;
  final int kind=cursor.getInt(MessageThingLoader.INDEX_KIND);
  final int likes=0;
  final boolean isNew=isNew(cursor.getPosition());
  final int nesting=0;
  final int numComments=0;
  final boolean over18=false;
  final int score=0;
  final String subject=cursor.getString(MessageThingLoader.INDEX_SUBJECT);
  final String subreddit=cursor.getString(MessageThingLoader.INDEX_SUBREDDIT);
  final String thingId=cursor.getString(MessageThingLoader.INDEX_THING_ID);
  final String title=null;
  final int ups=0;
  final boolean drawVotingArrows=false;
  final boolean showThumbnail=false;
  final boolean showStatusPoints=false;
  ThingView tv=(ThingView)view;
  tv.setBody(body,isNew,formatter);
  tv.setData(accountName,author,createdUtc,destination,domain,downs,expanded,kind,likes,subject,nesting,nowTimeMs,numComments,over18,null,score,subreddit,thingBodyWidth,thingId,title,ups,drawVotingArrows,showThumbnail,showStatusPoints);
  tv.setChosen(singleChoice && Objects.equals(selectedThingId,thingId));
  setThingDetails(tv,kind);
}

Fixed version (ground truth):
private void bindMessageThingView(View view,Context context,Cursor cursor){
  final String author=cursor.getString(MessageThingLoader.INDEX_AUTHOR);
  final String body=cursor.getString(MessageThingLoader.INDEX_BODY);
  final long createdUtc=cursor.getLong(MessageThingLoader.INDEX_CREATED_UTC);
  final String destination=cursor.getString(MessageThingLoader.INDEX_DESTINATION);
  final String domain=null;
  final int downs=0;
  final boolean expanded=true;
  final int kind=cursor.getInt(MessageThingLoader.INDEX_KIND);
  final int likes=0;
  final boolean isNew=isNew(cursor.getPosition());
  final int nesting=0;
  final int numComments=0;
  final boolean over18=false;
  final String parentSubreddit=null;
  final int score=0;
  final String subject=cursor.getString(MessageThingLoader.INDEX_SUBJECT);
  final String subreddit=cursor.getString(MessageThingLoader.INDEX_SUBREDDIT);
  final String thingId=cursor.getString(MessageThingLoader.INDEX_THING_ID);
  final String title=null;
  final int ups=0;
  final boolean drawVotingArrows=false;
  final boolean showThumbnail=false;
  final boolean showStatusPoints=false;
  ThingView tv=(ThingView)view;
  tv.setBody(body,isNew,formatter);
  tv.setData(accountName,author,createdUtc,destination,domain,downs,expanded,kind,likes,subject,nesting,nowTimeMs,numComments,over18,parentSubreddit,score,subreddit,thingBodyWidth,thingId,title,ups,drawVotingArrows,showThumbnail,showStatusPoints);
  tv.setChosen(singleChoice && Objects.equals(selectedThingId,thingId));
  setThingDetails(tv,kind);
}
Program: 188078
Project: 188078
Buggy source:
private void refreshCheckedItems(){
  ControlFragment cf=getControlFragment();
  SubredditListFragment<?,?> sf=getSubredditListFragment();
  if (sf != null) {
    sf.setSelectedSubreddit(cf.isRandom() ? Subreddits.NAME_RANDOM : cf.getSubreddit());
  }
  ThingListFragment<?> tf=getThingListFragment();
  if (tf != null) {
    ThingBundle thingBundle=cf.getThingBundle();
    if (thingBundle != null) {
      tf.setSelectedThing(thingBundle.getThingId(),thingBundle.getLinkId());
    }
  }
}

Fixed version (ground truth):
private void refreshCheckedItems(){
  ControlFragment cf=getControlFragment();
  SubredditListFragment<?,?> sf=getSubredditListFragment();
  if (sf != null) {
    sf.setSelectedSubreddit(cf.isRandom() ? Subreddits.NAME_RANDOM : cf.getSubreddit());
  }
  ThingListFragment<?> tf=getThingListFragment();
  if (tf != null) {
    ThingBundle thingBundle=cf.getThingBundle();
    if (thingBundle != null) {
      tf.setSelectedThing(thingBundle.getThingId(),thingBundle.getLinkId());
    }
 else {
      tf.setSelectedThing(null,null);
    }
  }
}
Program: 188079
Project: 188079
Buggy source:
@Override public void swapCursor(Cursor cursor){
  setMoreId(null);
  adapter.swapCursor(cursor);
  if (cursor != null && cursor.getExtras() != null) {
    Bundle extras=cursor.getExtras();
    setSessionId(extras.getLong(ThingProvider.EXTRA_SESSION_ID));
  }
}

Fixed version (ground truth):
@Override public boolean swapCursor(Cursor cursor){
  if (adapter.getCursor() != cursor) {
    setMoreId(null);
    adapter.swapCursor(cursor);
    if (cursor != null && cursor.getExtras() != null) {
      Bundle extras=cursor.getExtras();
      setSessionId(extras.getLong(ThingProvider.EXTRA_SESSION_ID));
    }
    return true;
  }
  return false;
}
Program: 188080
Project: 188080
Buggy source:
@Override public void swapCursor(Cursor cursor){
  adapter.swapCursor(cursor);
}

Fixed version (ground truth):
@Override public boolean swapCursor(Cursor cursor){
  if (adapter.getOriginalCursor() != cursor) {
    adapter.swapCursor(cursor);
    return true;
  }
  return false;
}
Program: 188081
Project: 188081
Buggy source:
@Override public void swapCursor(Cursor cursor){
  setMoreId(null);
  adapter.swapCursor(cursor);
  if (cursor != null && cursor.getExtras() != null) {
    Bundle extras=cursor.getExtras();
    setSessionId(extras.getLong(ThingProvider.EXTRA_SESSION_ID));
  }
}

Fixed version (ground truth):
@Override public boolean swapCursor(Cursor cursor){
  if (adapter.getCursor() != cursor) {
    setMoreId(null);
    adapter.swapCursor(cursor);
    if (cursor != null && cursor.getExtras() != null) {
      Bundle extras=cursor.getExtras();
      setSessionId(extras.getLong(ThingProvider.EXTRA_SESSION_ID));
    }
    return true;
  }
  return false;
}
Program: 188082
Project: 188082
Buggy source:
void swapCursor(Cursor cursor);

Fixed version (ground truth):
boolean swapCursor(Cursor cursor);
Program: 188083
Project: 188083
Buggy source:
public void onLoadFinished(Loader<Cursor> loader,Cursor cursor){
  super.onLoadFinished(loader,cursor);
  controller.swapCursor(cursor);
  setEmptyText(getEmptyText(cursor == null));
  setListShown(true);
  if (actionMode != null) {
    actionMode.invalidate();
  }
  if (listener != null) {
    if (cursor == null) {
      listener.onInitialSubredditSelected(null,true);
    }
 else     if (cursor.getCount() == 0) {
      listener.onInitialSubredditSelected(null,false);
    }
 else {
      listener.onInitialSubredditSelected(getSubreddit(0),false);
    }
  }
}

Fixed version (ground truth):
public void onLoadFinished(Loader<Cursor> loader,Cursor cursor){
  if (controller.swapCursor(cursor)) {
    if (BuildConfig.DEBUG) {
      Log.d(TAG,"String_Node_Str");
    }
    super.onLoadFinished(loader,cursor);
    setEmptyText(getEmptyText(cursor == null));
    setListShown(true);
    if (actionMode != null) {
      actionMode.invalidate();
    }
    if (listener != null) {
      if (cursor == null) {
        listener.onInitialSubredditSelected(null,true);
      }
 else       if (cursor.getCount() == 0) {
        listener.onInitialSubredditSelected(null,false);
      }
 else {
        listener.onInitialSubredditSelected(getSubreddit(0),false);
      }
    }
  }
}
Program: 188084
Project: 188084
Buggy source:
@Override public void swapCursor(Cursor cursor){
  adapter.swapCursor(cursor);
}

Fixed version (ground truth):
@Override public boolean swapCursor(Cursor cursor){
  if (adapter.getCursor() != cursor) {
    adapter.swapCursor(cursor);
    return true;
  }
  return false;
}
Program: 188085
Project: 188085
Buggy source:
void swapCursor(Cursor cursor);

Fixed version (ground truth):
boolean swapCursor(Cursor cursor);
Program: 188086
Project: 188086
Buggy source:
@Override public void onLoadFinished(Loader<Cursor> loader,Cursor cursor){
  super.onLoadFinished(loader,cursor);
  scrollLoading=false;
  controller.swapCursor(cursor);
  setEmptyText(getString(cursor != null ? R.string.empty_list : R.string.error));
  setListShown(true);
  getActivity().invalidateOptionsMenu();
}

Fixed version (ground truth):
@Override public void onLoadFinished(Loader<Cursor> loader,Cursor cursor){
  if (controller.swapCursor(cursor)) {
    if (BuildConfig.DEBUG) {
      Log.d(TAG,"String_Node_Str");
    }
    super.onLoadFinished(loader,cursor);
    scrollLoading=false;
    setEmptyText(getString(cursor != null ? R.string.empty_list : R.string.error));
    setListShown(true);
    getActivity().invalidateOptionsMenu();
  }
}
Program: 188087
Project: 188087
Buggy source:
public AccountSubredditListAdapter(Context context,boolean showPresets,boolean addFilter,boolean singleChoice){
  super(context,singleChoice);
  this.showPresets=showPresets;
  if (addFilter) {
    showPresets=false;
    final Context appContext=context.getApplicationContext();
    setFilterQueryProvider(new FilterQueryProvider(){
      public Cursor runQuery(      CharSequence constraint){
        return getFilterCursor(appContext,constraint);
      }
    }
);
  }
}

Fixed version (ground truth):
public AccountSubredditListAdapter(Context context,boolean showPresets,boolean addFilter,boolean singleChoice){
  super(context,singleChoice);
  this.showPresets=showPresets;
  if (addFilter) {
    final Context appContext=context.getApplicationContext();
    setFilterQueryProvider(new FilterQueryProvider(){
      public Cursor runQuery(      CharSequence constraint){
        return getFilterCursor(appContext,constraint);
      }
    }
);
  }
}
Program: 188088
Project: 188088
Buggy source:
@Override public Cursor swapCursor(Cursor newCursor){
  if (showPresets) {
    newCursor=new MergeCursor(new Cursor[]{PRESETS_CURSOR,newCursor});
  }
  return super.swapCursor(newCursor);
}

Fixed version (ground truth):
@Override public Cursor swapCursor(Cursor newCursor){
  originalCursor=newCursor;
  if (showPresets) {
    newCursor=new MergeCursor(new Cursor[]{PRESETS_CURSOR,newCursor});
  }
  return super.swapCursor(newCursor);
}
Program: 188089
Project: 188089
Buggy source:
@Override public Cursor loadInBackground(){
  if (BuildConfig.DEBUG) {
    Log.d(TAG,"String_Node_Str");
  }
  Bundle result=ThingProvider.getCommentsSession(getContext(),accountName,thingId,linkId,-1);
  long sessionId=result.getLong(ThingProvider.EXTRA_SESSION_ID);
  setUri(ThingProvider.COMMENTS_URI);
  setProjection(PROJECTION);
  setSelection(Comments.SELECT_VISIBLE_BY_SESSION_ID);
  setSelectionArgs(Array.of(sessionId));
  setSortOrder(Comments.SORT_BY_SEQUENCE_AND_ID);
  return new CursorExtrasWrapper(super.loadInBackground(),result);
}

Fixed version (ground truth):
@Override public Cursor loadInBackground(){
  if (BuildConfig.DEBUG) {
    Log.d(TAG,"String_Node_Str");
  }
  Bundle result=ThingProvider.getCommentsSession(getContext(),accountName,thingId,linkId,-1);
  long sessionId=result.getLong(ThingProvider.EXTRA_SESSION_ID);
  setSelectionArgs(Array.of(sessionId));
  return new CursorExtrasWrapper(super.loadInBackground(),result);
}
Program: 188090
Project: 188090
Buggy source:
public CommentLoader(Context context,String accountName,String thingId,String linkId){
  super(context);
  this.accountName=accountName;
  this.thingId=thingId;
  this.linkId=linkId;
}

Fixed version (ground truth):
public CommentLoader(Context context,String accountName,String thingId,String linkId){
  super(context);
  this.accountName=accountName;
  this.thingId=thingId;
  this.linkId=linkId;
  setUri(ThingProvider.getCommentsUri(true));
  setProjection(PROJECTION);
  setSelection(Comments.SELECT_VISIBLE_BY_SESSION_ID);
  setSortOrder(Comments.SORT_BY_SEQUENCE_AND_ID);
}
Program: 188091
Project: 188091
Buggy source:
public SubredditThingLoader(Context context,String accountName,String subreddit,int filter,String more){
  super(context);
  this.accountName=accountName;
  this.subreddit=subreddit;
  this.filter=filter;
  this.more=more;
  setUri(ThingProvider.THINGS_URI);
  setProjection(PROJECTION);
  setSelection(HideActions.SELECT_UNHIDDEN_BY_SESSION_ID);
}

Fixed version (ground truth):
public SubredditThingLoader(Context context,String accountName,String subreddit,int filter,String more){
  super(context);
  this.accountName=accountName;
  this.subreddit=subreddit;
  this.filter=filter;
  this.more=more;
  setUri(ThingProvider.getSubredditUri(true));
  setProjection(PROJECTION);
  setSelection(HideActions.SELECT_UNHIDDEN_BY_SESSION_ID);
}
Program: 188092
Project: 188092
Buggy source:
public void setThumbnail(Context context,ThingView v,String url){
  if (!TextUtils.isEmpty(url)) {
    Bitmap b=BITMAP_CACHE.get(url);
    v.setThumbnailBitmap(b);
    if (b == null) {
      LoadThumbnailTask task=(LoadThumbnailTask)v.getTag();
      if (task == null || !url.equals(task.url)) {
        if (task != null) {
          task.cancel(true);
        }
        task=new LoadThumbnailTask(v,url);
        v.setTag(task);
        task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
      }
    }
  }
 else {
    LoadThumbnailTask task=(LoadThumbnailTask)v.getTag();
    if (task != null) {
      task.cancel(true);
      v.setTag(null);
    }
    v.setThumbnailBitmap(null);
  }
}

Fixed version (ground truth):
public void setThumbnail(Context context,ThingView v,String url){
  if (!TextUtils.isEmpty(url)) {
    Bitmap b=BITMAP_CACHE.get(url);
    v.setThumbnailBitmap(b);
    if (b != null) {
      clearLoadThumbnailTask(v);
    }
 else {
      LoadThumbnailTask task=(LoadThumbnailTask)v.getTag();
      if (task == null || !url.equals(task.url)) {
        if (task != null) {
          task.cancel(true);
        }
        task=new LoadThumbnailTask(v,url);
        v.setTag(task);
        task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
      }
      ;
    }
  }
 else {
    v.setThumbnailBitmap(null);
    clearLoadThumbnailTask(v);
  }
}
Program: 188093
Project: 188093
Buggy source:
private boolean insertThing(String actionAccountName,String replyId,String body){
  int size=values.size();
  for (int i=0; i < size; i++) {
    ContentValues v=values.get(i);
    String id=v.getAsString(Things.COLUMN_THING_ID);
    if (TextUtils.isEmpty(id)) {
      continue;
    }
    if (id.equals(replyId)) {
      ContentValues p=new ContentValues(8);
      p.put(Things.COLUMN_ACCOUNT,actionAccountName);
      p.put(Things.COLUMN_AUTHOR,actionAccountName);
      p.put(Things.COLUMN_BODY,body);
      p.put(Things.COLUMN_KIND,Kinds.KIND_COMMENT);
      p.put(Things.COLUMN_NESTING,CommentLogic.getInsertNesting(this,i));
      p.put(Things.COLUMN_SEQUENCE,CommentLogic.getInsertSequence(this,i));
      values.add(CommentLogic.getInsertPosition(this,i),p);
      size++;
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean insertThing(long actionId,String actionAccountName,String body,String actionThingId){
  int size=values.size();
  for (int i=0; i < size; i++) {
    ContentValues v=values.get(i);
    String id=v.getAsString(Things.COLUMN_THING_ID);
    if (TextUtils.isEmpty(id)) {
      continue;
    }
    if (id.equals(actionThingId)) {
      ContentValues p=new ContentValues(7 + 1);
      p.put(Things.COLUMN_ACCOUNT,actionAccountName);
      p.put(Things.COLUMN_AUTHOR,actionAccountName);
      p.put(Things.COLUMN_BODY,body);
      p.put(Things.COLUMN_COMMENT_ACTION_ID,actionId);
      p.put(Things.COLUMN_KIND,Kinds.KIND_COMMENT);
      p.put(Things.COLUMN_NESTING,CommentLogic.getInsertNesting(this,i));
      p.put(Things.COLUMN_SEQUENCE,CommentLogic.getInsertSequence(this,i));
      values.add(CommentLogic.getInsertPosition(this,i),p);
      size++;
      return true;
    }
  }
  return false;
}
Program: 188094
Project: 188094
Buggy source:
private void mergeActions(){
  int delta=0;
  SQLiteDatabase db=dbHelper.getReadableDatabase();
  Cursor c=db.query(CommentActions.TABLE_NAME,PROJECTION,CommentActions.SELECT_BY_ACCOUNT_AND_PARENT_THING_ID,Array.of(accountName,thingId),null,null,CommentActions.SORT_BY_ID);
  try {
    while (c.moveToNext()) {
      String actionAccountName=c.getString(INDEX_ACCOUNT_NAME);
      int action=c.getInt(INDEX_ACTION);
      String id=c.getString(INDEX_THING_ID);
      String text=c.getString(INDEX_TEXT);
switch (action) {
case CommentActions.ACTION_INSERT:
        if (insertThing(actionAccountName,id,text)) {
          delta++;
        }
      break;
case CommentActions.ACTION_DELETE:
    if (deleteThing(id)) {
      delta--;
    }
  break;
default :
throw new IllegalStateException();
}
}
}
  finally {
c.close();
}
if (!values.isEmpty()) {
Integer numComments=(Integer)values.get(0).get(Things.COLUMN_NUM_COMMENTS);
values.get(0).put(Things.COLUMN_NUM_COMMENTS,numComments.intValue() + delta);
}
}

Fixed version (ground truth):
private void mergeActions(){
  int delta=0;
  SQLiteDatabase db=dbHelper.getReadableDatabase();
  Cursor c=db.query(CommentActions.TABLE_NAME,PROJECTION,CommentActions.SELECT_BY_ACCOUNT_AND_PARENT_THING_ID,Array.of(accountName,thingId),null,null,CommentActions.SORT_BY_ID);
  try {
    while (c.moveToNext()) {
      long actionId=c.getLong(INDEX_ID);
      String actionAccountName=c.getString(INDEX_ACCOUNT_NAME);
      int action=c.getInt(INDEX_ACTION);
      String text=c.getString(INDEX_TEXT);
      String actionThingId=c.getString(INDEX_THING_ID);
switch (action) {
case CommentActions.ACTION_INSERT:
        if (insertThing(actionId,actionAccountName,text,actionThingId)) {
          delta++;
        }
      break;
case CommentActions.ACTION_DELETE:
    if (deleteThing(actionThingId)) {
      delta--;
    }
  break;
default :
throw new IllegalStateException();
}
}
}
  finally {
c.close();
}
if (!values.isEmpty()) {
Integer numComments=(Integer)values.get(0).get(Things.COLUMN_NUM_COMMENTS);
values.get(0).put(Things.COLUMN_NUM_COMMENTS,numComments.intValue() + delta);
}
}
Program: 188095
Project: 188095
Buggy source:
private void setDetailsText(String domain,int downs,int ups){
  Resources r=getResources();
  longDetailsText.clear();
  longDetailsText.append(r.getQuantityString(R.plurals.votes_up,ups,ups)).append("String_Node_Str");
  longDetailsText.append(r.getQuantityString(R.plurals.votes_down,downs,downs)).append("String_Node_Str");
  if (!TextUtils.isEmpty(domain)) {
    longDetailsText.append(domain);
    shortDetailsText=domain;
  }
 else {
    shortDetailsText="String_Node_Str";
  }
}

Fixed version (ground truth):
private void setDetailsText(boolean showPoints,String domain,int downs,int ups){
  Resources r=getResources();
  if (showPoints) {
    longDetailsText.clear();
    longDetailsText.append(r.getQuantityString(R.plurals.votes_up,ups,ups)).append("String_Node_Str");
    longDetailsText.append(r.getQuantityString(R.plurals.votes_down,downs,downs)).append("String_Node_Str");
  }
  if (!TextUtils.isEmpty(domain)) {
    longDetailsText.append(domain);
    shortDetailsText=domain;
  }
 else {
    shortDetailsText="String_Node_Str";
  }
}
Program: 188096
Project: 188096
Buggy source:
public void setData(String accountName,String author,String body,long createdUtc,String domain,int downs,int kind,int likes,String linkTitle,long nowTimeMs,int numComments,boolean over18,String parentSubreddit,int score,String subreddit,int thingBodyWidth,String thingId,String thumbnailUrl,String title,int ups){
  this.kind=kind;
  this.likes=likes;
  this.linkTitle=linkTitle;
  this.thingBodyWidth=thingBodyWidth;
  this.thingId=thingId;
  this.thumbnailUrl=thumbnailUrl;
  this.title=title;
  drawVotingArrows=AccountUtils.isAccount(accountName);
  drawScore=drawVotingArrows && kind == Things.KIND_LINK;
  if (drawScore) {
    if (scoreBounds == null) {
      scoreBounds=new Rect();
    }
    scoreText=VotingArrows.getScoreText(score);
  }
  setStatusText(author,createdUtc,kind,nowTimeMs,numComments,over18,parentSubreddit,score,subreddit,drawVotingArrows);
  setDetailsText(domain,downs,ups);
  if (!TextUtils.isEmpty(body)) {
    bodyText=FORMATTER.formatSpans(getContext(),body);
    if (bodyBounds == null) {
      bodyBounds=new RectF();
    }
  }
 else {
    bodyText=null;
  }
  requestLayout();
}

Fixed version (ground truth):
public void setData(String accountName,String author,String body,long createdUtc,String domain,int downs,int kind,int likes,String linkTitle,long nowTimeMs,int numComments,boolean over18,String parentSubreddit,int score,String subreddit,int thingBodyWidth,String thingId,String thumbnailUrl,String title,int ups){
  this.kind=kind;
  this.likes=likes;
  this.linkTitle=linkTitle;
  this.thingBodyWidth=thingBodyWidth;
  this.thingId=thingId;
  this.thumbnailUrl=thumbnailUrl;
  this.title=title;
  drawVotingArrows=AccountUtils.isAccount(accountName) && kind != Things.KIND_MESSAGE;
  drawScore=drawVotingArrows && kind == Things.KIND_LINK;
  if (drawScore) {
    if (scoreBounds == null) {
      scoreBounds=new Rect();
    }
    scoreText=VotingArrows.getScoreText(score);
  }
  boolean showSubreddit=!TextUtils.isEmpty(subreddit) && !subreddit.equalsIgnoreCase(parentSubreddit);
  boolean showPoints=!drawVotingArrows && kind != Things.KIND_MESSAGE;
  boolean showNumComments=kind == Things.KIND_LINK;
  setStatusText(over18,showSubreddit,showPoints,showNumComments,author,createdUtc,nowTimeMs,numComments,score,subreddit);
  setDetailsText(showPoints,domain,downs,ups);
  if (!TextUtils.isEmpty(body)) {
    bodyText=FORMATTER.formatSpans(getContext(),body);
    if (bodyBounds == null) {
      bodyBounds=new RectF();
    }
  }
 else {
    bodyText=null;
  }
  requestLayout();
}
Program: 188097
Project: 188097
Buggy source:
private void setStatusText(String author,long createdUtc,int kind,long nowTimeMs,int numComments,boolean over18,String parentSubreddit,int score,String subreddit,boolean votable){
  Context c=getContext();
  Resources r=getResources();
  statusText.clear();
  statusText.clearSpans();
  if (over18) {
    String nsfw=c.getString(R.string.nsfw);
    statusText.append(nsfw).append("String_Node_Str");
    statusText.setSpan(new ForegroundColorSpan(Color.RED),0,nsfw.length(),0);
  }
  if (!subreddit.equalsIgnoreCase(parentSubreddit)) {
    statusText.append(subreddit).append("String_Node_Str");
  }
  statusText.append(author).append("String_Node_Str");
  if (!votable) {
    statusText.append(r.getQuantityString(R.plurals.points,score,score)).append("String_Node_Str");
  }
  statusText.append(RelativeTime.format(c,nowTimeMs,createdUtc)).append("String_Node_Str");
  if (kind == Things.KIND_LINK) {
    statusText.append(r.getQuantityString(R.plurals.comments,numComments,numComments));
  }
}

Fixed version (ground truth):
private void setStatusText(boolean showNsfw,boolean showSubreddit,boolean showPoints,boolean showNumComments,String author,long createdUtc,long nowTimeMs,int numComments,int score,String subreddit){
  Context c=getContext();
  Resources r=getResources();
  statusText.clear();
  statusText.clearSpans();
  if (showNsfw) {
    String nsfw=c.getString(R.string.nsfw);
    statusText.append(nsfw).append("String_Node_Str");
    statusText.setSpan(new ForegroundColorSpan(Color.RED),0,nsfw.length(),0);
  }
  if (showSubreddit) {
    statusText.append(subreddit).append("String_Node_Str");
  }
  statusText.append(author).append("String_Node_Str");
  if (showPoints) {
    statusText.append(r.getQuantityString(R.plurals.points,score,score)).append("String_Node_Str");
  }
  statusText.append(RelativeTime.format(c,nowTimeMs,createdUtc)).append("String_Node_Str");
  if (showNumComments) {
    statusText.append(r.getQuantityString(R.plurals.comments,numComments,numComments));
  }
}
Program: 188098
Project: 188098
Buggy source:
private void setDetailsText(boolean showPoints,String domain,int downs,int ups){
  Resources r=getResources();
  if (showPoints) {
    longDetailsText.clear();
    longDetailsText.append(r.getQuantityString(R.plurals.votes_up,ups,ups)).append("String_Node_Str");
    longDetailsText.append(r.getQuantityString(R.plurals.votes_down,downs,downs)).append("String_Node_Str");
  }
  if (!TextUtils.isEmpty(domain)) {
    longDetailsText.append(domain);
    shortDetailsText=domain;
  }
 else {
    shortDetailsText="String_Node_Str";
  }
}

Fixed version (ground truth):
private void setDetailsText(boolean showUpsDowns,String domain,int downs,int ups){
  Resources r=getResources();
  longDetailsText.clear();
  if (showUpsDowns) {
    longDetailsText.append(r.getQuantityString(R.plurals.votes_up,ups,ups)).append("String_Node_Str");
    longDetailsText.append(r.getQuantityString(R.plurals.votes_down,downs,downs)).append("String_Node_Str");
  }
  if (!TextUtils.isEmpty(domain)) {
    longDetailsText.append(domain);
    shortDetailsText=domain;
  }
 else {
    shortDetailsText="String_Node_Str";
  }
}
Program: 188099
Project: 188099
Buggy source:
public void setData(String accountName,String author,String body,long createdUtc,String domain,int downs,int kind,int likes,String linkTitle,long nowTimeMs,int numComments,boolean over18,String parentSubreddit,int score,String subreddit,int thingBodyWidth,String thingId,String thumbnailUrl,String title,int ups){
  this.kind=kind;
  this.likes=likes;
  this.linkTitle=linkTitle;
  this.thingBodyWidth=thingBodyWidth;
  this.thingId=thingId;
  this.thumbnailUrl=thumbnailUrl;
  this.title=title;
  drawVotingArrows=AccountUtils.isAccount(accountName) && kind != Things.KIND_MESSAGE;
  drawScore=drawVotingArrows && kind == Things.KIND_LINK;
  if (drawScore) {
    if (scoreBounds == null) {
      scoreBounds=new Rect();
    }
    scoreText=VotingArrows.getScoreText(score);
  }
  boolean showSubreddit=!TextUtils.isEmpty(subreddit) && !subreddit.equalsIgnoreCase(parentSubreddit);
  boolean showPoints=!drawVotingArrows && kind != Things.KIND_MESSAGE;
  boolean showNumComments=kind == Things.KIND_LINK;
  setStatusText(over18,showSubreddit,showPoints,showNumComments,author,createdUtc,nowTimeMs,numComments,score,subreddit);
  setDetailsText(showPoints,domain,downs,ups);
  if (!TextUtils.isEmpty(body)) {
    bodyText=FORMATTER.formatSpans(getContext(),body);
    if (bodyBounds == null) {
      bodyBounds=new RectF();
    }
  }
 else {
    bodyText=null;
  }
  requestLayout();
}

Fixed version (ground truth):
public void setData(String accountName,String author,String body,long createdUtc,String domain,int downs,int kind,int likes,String linkTitle,long nowTimeMs,int numComments,boolean over18,String parentSubreddit,int score,String subreddit,int thingBodyWidth,String thingId,String thumbnailUrl,String title,int ups){
  this.kind=kind;
  this.likes=likes;
  this.linkTitle=linkTitle;
  this.thingBodyWidth=thingBodyWidth;
  this.thingId=thingId;
  this.thumbnailUrl=thumbnailUrl;
  this.title=title;
  drawVotingArrows=AccountUtils.isAccount(accountName) && kind != Things.KIND_MESSAGE;
  drawScore=drawVotingArrows && kind == Things.KIND_LINK;
  if (drawScore) {
    if (scoreBounds == null) {
      scoreBounds=new Rect();
    }
    scoreText=VotingArrows.getScoreText(score);
  }
  boolean showSubreddit=!TextUtils.isEmpty(subreddit) && !subreddit.equalsIgnoreCase(parentSubreddit);
  boolean showPoints=!drawVotingArrows && kind != Things.KIND_MESSAGE;
  boolean showNumComments=kind == Things.KIND_LINK;
  setStatusText(over18,showSubreddit,showPoints,showNumComments,author,createdUtc,nowTimeMs,numComments,score,subreddit);
  boolean showUpsDowns=kind == Things.KIND_LINK;
  setDetailsText(showUpsDowns,domain,downs,ups);
  if (!TextUtils.isEmpty(body)) {
    bodyText=FORMATTER.formatSpans(getContext(),body);
    if (bodyBounds == null) {
      bodyBounds=new RectF();
    }
  }
 else {
    bodyText=null;
  }
  requestLayout();
}
Program: 188100
Project: 188100
Buggy source:
private void insertThing(String replyId,String body){
  int size=values.size();
  for (int i=0; i < size; i++) {
    ContentValues v=values.get(i);
    String id=v.getAsString(Comments.COLUMN_THING_ID);
    if (TextUtils.isEmpty(id)) {
      continue;
    }
    if (id.equals(replyId)) {
      ContentValues p=new ContentValues(8);
      p.put(Comments.COLUMN_ACCOUNT,accountName);
      p.put(Comments.COLUMN_AUTHOR,accountName);
      p.put(Comments.COLUMN_BODY,body);
      p.put(Comments.COLUMN_KIND,Comments.KIND_COMMENT);
      p.put(Comments.COLUMN_NESTING,CommentLogic.getInsertNesting(this,i));
      p.put(Comments.COLUMN_SEQUENCE,CommentLogic.getInsertSequence(this,i));
      p.put(Comments.COLUMN_SESSION_ID,sessionId);
      p.put(Comments.COLUMN_SESSION_TIMESTAMP,sessionTimestamp);
      values.add(CommentLogic.getInsertPosition(this,i),p);
      size++;
      break;
    }
  }
}

Fixed version (ground truth):
private void insertThing(String actionAccountName,String replyId,String body){
  int size=values.size();
  for (int i=0; i < size; i++) {
    ContentValues v=values.get(i);
    String id=v.getAsString(Comments.COLUMN_THING_ID);
    if (TextUtils.isEmpty(id)) {
      continue;
    }
    if (id.equals(replyId)) {
      ContentValues p=new ContentValues(8);
      p.put(Comments.COLUMN_ACCOUNT,actionAccountName);
      p.put(Comments.COLUMN_AUTHOR,actionAccountName);
      p.put(Comments.COLUMN_BODY,body);
      p.put(Comments.COLUMN_KIND,Comments.KIND_COMMENT);
      p.put(Comments.COLUMN_NESTING,CommentLogic.getInsertNesting(this,i));
      p.put(Comments.COLUMN_SEQUENCE,CommentLogic.getInsertSequence(this,i));
      p.put(Comments.COLUMN_SESSION_ID,sessionId);
      p.put(Comments.COLUMN_SESSION_TIMESTAMP,sessionTimestamp);
      values.add(CommentLogic.getInsertPosition(this,i),p);
      size++;
      break;
    }
  }
}
Program: 188101
Project: 188101
Buggy source:
private void mergeActions(){
  SQLiteDatabase db=dbHelper.getReadableDatabase();
  Cursor c=db.query(CommentActions.TABLE_NAME,PROJECTION,CommentActions.SELECT_BY_ACCOUNT_AND_PARENT_THING_ID,Array.of(accountName,thingId),null,null,CommentActions.SORT_BY_ID);
  try {
    while (c.moveToNext()) {
      int action=c.getInt(INDEX_ACTION);
      String id=c.getString(INDEX_THING_ID);
      String text=c.getString(INDEX_TEXT);
switch (action) {
case CommentActions.ACTION_INSERT:
        insertThing(id,text);
      break;
case CommentActions.ACTION_DELETE:
    deleteThing(id);
  break;
default :
throw new IllegalStateException();
}
}
}
  finally {
c.close();
}
}

Fixed version (ground truth):
private void mergeActions(){
  SQLiteDatabase db=dbHelper.getReadableDatabase();
  Cursor c=db.query(CommentActions.TABLE_NAME,PROJECTION,CommentActions.SELECT_BY_PARENT_THING_ID,Array.of(thingId),null,null,CommentActions.SORT_BY_ID);
  try {
    while (c.moveToNext()) {
      String actionAccountName=c.getString(INDEX_ACCOUNT_NAME);
      int action=c.getInt(INDEX_ACTION);
      String id=c.getString(INDEX_THING_ID);
      String text=c.getString(INDEX_TEXT);
switch (action) {
case CommentActions.ACTION_INSERT:
        insertThing(actionAccountName,id,text);
      break;
case CommentActions.ACTION_DELETE:
    deleteThing(id);
  break;
default :
throw new IllegalStateException();
}
}
}
  finally {
c.close();
}
}
Program: 188103
Project: 188103
Buggy source:
private void handleFetch(Uri uri,SQLiteDatabase db){
  try {
    long sessionTimestamp=System.currentTimeMillis();
    String accountName=uri.getQueryParameter(PARAM_ACCOUNT);
    String sessionId=uri.getQueryParameter(PARAM_SESSION_ID);
    String query=uri.getQueryParameter(PARAM_QUERY);
    Context context=getContext();
    String cookie=AccountUtils.getCookie(context,accountName);
    SubredditSearchListing listing=SubredditSearchListing.get(context,accountName,sessionId,sessionTimestamp,query,cookie);
    long cleaned;
    db.beginTransaction();
    try {
      cleaned=db.delete(SubredditSearches.TABLE_NAME,SubredditSearches.SELECT_BEFORE_TIMESTAMP,Array.of(sessionTimestamp));
      InsertHelper insertHelper=new InsertHelper(db,SubredditSearches.TABLE_NAME);
      int count=listing.values.size();
      for (int i=0; i < count; i++) {
        insertHelper.insert(listing.values.get(i));
      }
      db.setTransactionSuccessful();
    }
  finally {
      db.endTransaction();
    }
    if (BuildConfig.DEBUG) {
      Log.d(TAG,"String_Node_Str" + cleaned);
    }
  }
 catch (  OperationCanceledException e) {
    Log.e(TAG,e.getMessage(),e);
  }
catch (  AuthenticatorException e) {
    Log.e(TAG,e.getMessage(),e);
  }
catch (  IOException e) {
    Log.e(TAG,e.getMessage(),e);
  }
}

Fixed version (ground truth):
private void handleFetch(Uri uri,SQLiteDatabase db){
  try {
    long sessionTimestamp=getSessionTimestamp();
    String accountName=uri.getQueryParameter(PARAM_ACCOUNT);
    String sessionId=uri.getQueryParameter(PARAM_SESSION_ID);
    String query=uri.getQueryParameter(PARAM_QUERY);
    Context context=getContext();
    String cookie=AccountUtils.getCookie(context,accountName);
    SubredditSearchListing listing=SubredditSearchListing.get(context,accountName,sessionId,sessionTimestamp,query,cookie);
    long cleaned;
    db.beginTransaction();
    try {
      cleaned=db.delete(SubredditSearches.TABLE_NAME,SubredditSearches.SELECT_BEFORE_TIMESTAMP,Array.of(sessionTimestamp));
      InsertHelper insertHelper=new InsertHelper(db,SubredditSearches.TABLE_NAME);
      int count=listing.values.size();
      for (int i=0; i < count; i++) {
        insertHelper.insert(listing.values.get(i));
      }
      db.setTransactionSuccessful();
    }
  finally {
      db.endTransaction();
    }
    if (BuildConfig.DEBUG) {
      Log.d(TAG,"String_Node_Str" + cleaned);
    }
  }
 catch (  OperationCanceledException e) {
    Log.e(TAG,e.getMessage(),e);
  }
catch (  AuthenticatorException e) {
    Log.e(TAG,e.getMessage(),e);
  }
catch (  IOException e) {
    Log.e(TAG,e.getMessage(),e);
  }
}
Program: 188104
Project: 188104
Buggy source:
public static CommentListing get(Context context,SQLiteOpenHelper dbHelper,String accountName,String sessionId,String thingId,String cookie) throws IOException {
  long t1=System.currentTimeMillis();
  URL url=Urls.commentsUrl(thingId);
  HttpURLConnection conn=RedditApi.connect(url,cookie,false);
  InputStream input=new BufferedInputStream(conn.getInputStream());
  long t2=System.currentTimeMillis();
  try {
    JsonReader reader=new JsonReader(new InputStreamReader(input));
    CommentListing listing=new CommentListing(context,dbHelper,accountName,sessionId,t1,thingId);
    listing.parseListingArray(reader);
    if (BuildConfig.DEBUG) {
      long t3=System.currentTimeMillis();
      listing.networkTimeMs=t2 - t1;
      listing.parseTimeMs=t3 - t2;
    }
    return listing;
  }
  finally {
    input.close();
    conn.disconnect();
  }
}

Fixed version (ground truth):
public static CommentListing get(Context context,SQLiteOpenHelper dbHelper,String accountName,String sessionId,long sessionTimestamp,String thingId,String cookie) throws IOException {
  long t1=System.currentTimeMillis();
  URL url=Urls.commentsUrl(thingId);
  HttpURLConnection conn=RedditApi.connect(url,cookie,false);
  InputStream input=new BufferedInputStream(conn.getInputStream());
  long t2=System.currentTimeMillis();
  try {
    JsonReader reader=new JsonReader(new InputStreamReader(input));
    CommentListing listing=new CommentListing(context,dbHelper,accountName,sessionId,sessionTimestamp,thingId);
    listing.parseListingArray(reader);
    if (BuildConfig.DEBUG) {
      long t3=System.currentTimeMillis();
      listing.networkTimeMs=t2 - t1;
      listing.parseTimeMs=t3 - t2;
    }
    return listing;
  }
  finally {
    input.close();
    conn.disconnect();
  }
}
Program: 188105
Project: 188105
Buggy source:
private void sync(Uri uri,String sessionId){
  Cursor c=null;
  try {
    String accountName=uri.getQueryParameter(PARAM_ACCOUNT_NAME);
    String thingId=uri.getQueryParameter(PARAM_THING_ID);
    Context context=getContext();
    String cookie=AccountUtils.getCookie(context,accountName);
    CommentListing listing=CommentListing.get(context,helper,accountName,sessionId,thingId,cookie);
    long cleaned;
    long t1=System.currentTimeMillis();
    SQLiteDatabase db=helper.getWritableDatabase();
    db.beginTransaction();
    try {
      cleaned=db.delete(Comments.TABLE_NAME,Comments.SELECTION_BEFORE_TIMESTAMP,Array.of(getCreationTimeCutoff()));
      InsertHelper insertHelper=new InsertHelper(db,Comments.TABLE_NAME);
      int count=listing.values.size();
      for (int i=0; i < count; i++) {
        insertHelper.insert(listing.values.get(i));
      }
      db.setTransactionSuccessful();
    }
  finally {
      db.endTransaction();
    }
    if (BuildConfig.DEBUG) {
      long t2=System.currentTimeMillis();
      Log.d(TAG,"String_Node_Str" + listing.networkTimeMs + "String_Node_Str"+ listing.parseTimeMs+ "String_Node_Str"+ (t2 - t1)+ "String_Node_Str"+ cleaned);
    }
  }
 catch (  OperationCanceledException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
catch (  AuthenticatorException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
catch (  IOException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
 finally {
    if (c != null) {
      c.close();
    }
  }
}

Fixed version (ground truth):
private void sync(Uri uri,String sessionId){
  try {
    long timestampCutoff=getSessionTimestampCutoff();
    long sessionTimestamp=System.currentTimeMillis();
    String accountName=uri.getQueryParameter(PARAM_ACCOUNT_NAME);
    String thingId=uri.getQueryParameter(PARAM_THING_ID);
    Context context=getContext();
    String cookie=AccountUtils.getCookie(context,accountName);
    CommentListing listing=CommentListing.get(context,helper,accountName,sessionId,sessionTimestamp,thingId,cookie);
    long cleaned;
    long t1=System.currentTimeMillis();
    SQLiteDatabase db=helper.getWritableDatabase();
    db.beginTransaction();
    try {
      cleaned=db.delete(Comments.TABLE_NAME,Comments.SELECTION_BEFORE_TIMESTAMP,Array.of(timestampCutoff));
      InsertHelper insertHelper=new InsertHelper(db,Comments.TABLE_NAME);
      int count=listing.values.size();
      for (int i=0; i < count; i++) {
        insertHelper.insert(listing.values.get(i));
      }
      db.setTransactionSuccessful();
    }
  finally {
      db.endTransaction();
    }
    if (BuildConfig.DEBUG) {
      long t2=System.currentTimeMillis();
      Log.d(TAG,"String_Node_Str" + listing.networkTimeMs + "String_Node_Str"+ listing.parseTimeMs+ "String_Node_Str"+ (t2 - t1)+ "String_Node_Str"+ cleaned);
    }
  }
 catch (  OperationCanceledException e) {
    Log.e(TAG,e.getMessage(),e);
  }
catch (  AuthenticatorException e) {
    Log.e(TAG,e.getMessage(),e);
  }
catch (  IOException e) {
    Log.e(TAG,e.getMessage(),e);
  }
}
Program: 188106
Project: 188106
Buggy source:
public static SubredditSearchListing get(Context context,String accountName,String sessionId,String query,String cookie) throws IOException {
  long t1=System.currentTimeMillis();
  URL url=Urls.subredditSearchUrl(query,null);
  HttpURLConnection conn=RedditApi.connect(url,cookie,false);
  InputStream input=new BufferedInputStream(conn.getInputStream());
  try {
    JsonReader reader=new JsonReader(new InputStreamReader(input));
    SubredditSearchListing listing=new SubredditSearchListing(accountName,sessionId,t1);
    listing.parseListingObject(reader);
    if (BuildConfig.DEBUG) {
      Log.d(TAG,"String_Node_Str" + url + "String_Node_Str"+ listing.values.size());
    }
    return listing;
  }
  finally {
    input.close();
    conn.disconnect();
  }
}

Fixed version (ground truth):
public static SubredditSearchListing get(Context context,String accountName,String sessionId,long sessionTimestamp,String query,String cookie) throws IOException {
  URL url=Urls.subredditSearchUrl(query,null);
  HttpURLConnection conn=RedditApi.connect(url,cookie,false);
  InputStream input=new BufferedInputStream(conn.getInputStream());
  try {
    JsonReader reader=new JsonReader(new InputStreamReader(input));
    SubredditSearchListing listing=new SubredditSearchListing(accountName,sessionId,sessionTimestamp);
    listing.parseListingObject(reader);
    if (BuildConfig.DEBUG) {
      Log.d(TAG,"String_Node_Str" + url + "String_Node_Str"+ listing.values.size());
    }
    return listing;
  }
  finally {
    input.close();
    conn.disconnect();
  }
}
Program: 188107
Project: 188107
Buggy source:
private void sync(Uri uri){
  try {
    String accountName=uri.getQueryParameter(SYNC_ACCOUNT);
    String sessionId=uri.getQueryParameter(SYNC_SESSION_ID);
    String query=uri.getQueryParameter(SYNC_QUERY);
    Context context=getContext();
    String cookie=AccountUtils.getCookie(context,accountName);
    SubredditSearchListing listing=SubredditSearchListing.get(context,accountName,sessionId,query,cookie);
    long cleaned;
    SQLiteDatabase db=helper.getWritableDatabase();
    db.beginTransaction();
    try {
      cleaned=db.delete(SubredditSearches.TABLE_NAME,SubredditSearches.SELECTION_BEFORE_TIMESTAMP,Array.of(getCreationTimeCutoff()));
      InsertHelper insertHelper=new InsertHelper(db,SubredditSearches.TABLE_NAME);
      int count=listing.values.size();
      for (int i=0; i < count; i++) {
        insertHelper.insert(listing.values.get(i));
      }
      db.setTransactionSuccessful();
    }
  finally {
      db.endTransaction();
    }
    if (BuildConfig.DEBUG) {
      Log.d(TAG,"String_Node_Str" + cleaned);
    }
  }
 catch (  OperationCanceledException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
catch (  AuthenticatorException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
catch (  IOException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void sync(Uri uri){
  try {
    long timestampCutoff=getSessionTimestampCutoff();
    long sessionTimestamp=System.currentTimeMillis();
    String accountName=uri.getQueryParameter(SYNC_ACCOUNT);
    String sessionId=uri.getQueryParameter(SYNC_SESSION_ID);
    String query=uri.getQueryParameter(SYNC_QUERY);
    Context context=getContext();
    String cookie=AccountUtils.getCookie(context,accountName);
    SubredditSearchListing listing=SubredditSearchListing.get(context,accountName,sessionId,sessionTimestamp,query,cookie);
    long cleaned;
    SQLiteDatabase db=helper.getWritableDatabase();
    db.beginTransaction();
    try {
      cleaned=db.delete(SubredditSearches.TABLE_NAME,SubredditSearches.SELECTION_BEFORE_TIMESTAMP,Array.of(timestampCutoff));
      InsertHelper insertHelper=new InsertHelper(db,SubredditSearches.TABLE_NAME);
      int count=listing.values.size();
      for (int i=0; i < count; i++) {
        insertHelper.insert(listing.values.get(i));
      }
      db.setTransactionSuccessful();
    }
  finally {
      db.endTransaction();
    }
    if (BuildConfig.DEBUG) {
      Log.d(TAG,"String_Node_Str" + cleaned);
    }
  }
 catch (  OperationCanceledException e) {
    Log.e(TAG,e.getMessage(),e);
  }
catch (  AuthenticatorException e) {
    Log.e(TAG,e.getMessage(),e);
  }
catch (  IOException e) {
    Log.e(TAG,e.getMessage(),e);
  }
}
Program: 188108
Project: 188108
Buggy source:
public static ThingListing get(Context context,String accountName,String sessionId,String subredditName,int filter,String more,String query,String cookie) throws IOException {
  long t1=System.currentTimeMillis();
  URL url;
  if (!TextUtils.isEmpty(query)) {
    url=Urls.searchUrl(query,more);
  }
 else {
    url=Urls.subredditUrl(subredditName,filter,more);
  }
  HttpURLConnection conn=RedditApi.connect(url,cookie,false);
  InputStream input=new BufferedInputStream(conn.getInputStream());
  long t2=System.currentTimeMillis();
  try {
    JsonReader reader=new JsonReader(new InputStreamReader(input));
    ThingListing listing=new ThingListing(context,accountName,sessionId,t1);
    listing.parseListingObject(reader);
    if (BuildConfig.DEBUG) {
      long t3=System.currentTimeMillis();
      listing.networkTimeMs=t2 - t1;
      listing.parseTimeMs=t3 - t2;
    }
    return listing;
  }
  finally {
    input.close();
    conn.disconnect();
  }
}

Fixed version (ground truth):
public static ThingListing get(Context context,String accountName,String sessionId,long sessionTimestamp,String subredditName,int filter,String more,String query,String cookie) throws IOException {
  long t1=System.currentTimeMillis();
  URL url;
  if (!TextUtils.isEmpty(query)) {
    url=Urls.searchUrl(query,more);
  }
 else {
    url=Urls.subredditUrl(subredditName,filter,more);
  }
  HttpURLConnection conn=RedditApi.connect(url,cookie,false);
  InputStream input=new BufferedInputStream(conn.getInputStream());
  long t2=System.currentTimeMillis();
  try {
    JsonReader reader=new JsonReader(new InputStreamReader(input));
    ThingListing listing=new ThingListing(context,accountName,sessionId,sessionTimestamp);
    listing.parseListingObject(reader);
    if (BuildConfig.DEBUG) {
      long t3=System.currentTimeMillis();
      listing.networkTimeMs=t2 - t1;
      listing.parseTimeMs=t3 - t2;
    }
    return listing;
  }
  finally {
    input.close();
    conn.disconnect();
  }
}