nus-yam/ex-repair huggingface dataset:
Program: 188110
Project: 188110
Buggy source:
@Override public void bindView(View view,Context context,Cursor cursor){
  String author=cursor.getString(INDEX_AUTHOR);
  String body=cursor.getString(INDEX_BODY);
  long createdUtc=cursor.getLong(INDEX_CREATED_UTC);
  int downs=cursor.getInt(INDEX_DOWNS);
  int kind=cursor.getInt(INDEX_KIND);
  int nesting=cursor.getInt(INDEX_NESTING);
  int numComments=cursor.getInt(INDEX_NUM_COMMENTS);
  String title=cursor.getString(INDEX_TITLE);
  String thingId=cursor.getString(INDEX_THING_ID);
  int ups=cursor.getInt(INDEX_UPS);
  int likes=cursor.getInt(INDEX_LIKES);
  int vote=cursor.getInt(INDEX_VOTE);
  if (likes != vote) {
    likes=vote;
  }
  CommentView cv=(CommentView)view;
  cv.setOnVoteListener(listener);
  cv.setData(author,body,createdUtc,downs,kind,likes,nesting,nowTimeMs,numComments,title,thingId,ups);
}

Fixed version (ground truth):
@Override public void bindView(View view,Context context,Cursor cursor){
  String author=cursor.getString(INDEX_AUTHOR);
  String body=cursor.getString(INDEX_BODY);
  long createdUtc=cursor.getLong(INDEX_CREATED_UTC);
  int downs=cursor.getInt(INDEX_DOWNS);
  int kind=cursor.getInt(INDEX_KIND);
  int nesting=cursor.getInt(INDEX_NESTING);
  int numComments=cursor.getInt(INDEX_NUM_COMMENTS);
  String title=cursor.getString(INDEX_TITLE);
  String thingId=cursor.getString(INDEX_THING_ID);
  int ups=cursor.getInt(INDEX_UPS);
  int score=ups - downs;
  int likes=cursor.getInt(INDEX_LIKES);
  if (!cursor.isNull(INDEX_VOTE)) {
    likes=cursor.getInt(INDEX_VOTE);
    score=Math.max(0,score + likes);
  }
  CommentView cv=(CommentView)view;
  cv.setOnVoteListener(listener);
  cv.setData(author,body,createdUtc,kind,likes,nesting,nowTimeMs,numComments,score,title,thingId);
}
Program: 188111
Project: 188111
Buggy source:
public void setData(String author,String body,long createdUtc,int downs,int kind,int likes,int nesting,long nowTimeMs,int numComments,String title,String thingId,int ups){
  this.likes=likes;
  this.nesting=nesting;
  this.title=title;
  this.thingId=thingId;
  this.scoreText=VotingArrows.getScoreText(ups - downs + likes);
  this.bodyText=FORMATTER.formatSpans(getContext(),body);
  this.statusText=getStatus(getContext(),author,createdUtc,kind,nowTimeMs,numComments);
  requestLayout();
}

Fixed version (ground truth):
public void setData(String author,String body,long createdUtc,int kind,int likes,int nesting,long nowTimeMs,int numComments,int score,String title,String thingId){
  this.likes=likes;
  this.nesting=nesting;
  this.title=title;
  this.thingId=thingId;
  this.scoreText=VotingArrows.getScoreText(score);
  this.bodyText=FORMATTER.formatSpans(getContext(),body);
  this.statusText=getStatus(getContext(),author,createdUtc,kind,nowTimeMs,numComments);
  requestLayout();
}
Program: 188112
Project: 188112
Buggy source:
@Override public void bindView(View view,Context context,Cursor cursor){
  if (view instanceof ThingView) {
    String author=cursor.getString(INDEX_AUTHOR);
    long createdUtc=cursor.getLong(INDEX_CREATED_UTC);
    String domain=cursor.getString(INDEX_DOMAIN);
    int downs=cursor.getInt(INDEX_DOWNS);
    int numComments=cursor.getInt(INDEX_NUM_COMMENTS);
    boolean over18=cursor.getInt(INDEX_OVER_18) == 1;
    int score=cursor.getInt(INDEX_SCORE);
    String subreddit=cursor.getString(INDEX_SUBREDDIT);
    String thingId=cursor.getString(INDEX_THING_ID);
    String thumbnailUrl=cursor.getString(INDEX_THUMBNAIL_URL);
    String title=cursor.getString(INDEX_TITLE);
    int ups=cursor.getInt(INDEX_UPS);
    int likes=cursor.getInt(INDEX_LIKES);
    int vote=cursor.getInt(INDEX_VOTE);
    if (likes != vote) {
      likes=vote;
    }
    ThingView tv=(ThingView)view;
    tv.setData(author,createdUtc,domain,downs,likes,nowTimeMs,numComments,over18,parentSubreddit,score,subreddit,thingBodyWidth,thingId,thumbnailUrl,title,ups);
    tv.setChosen(singleChoice && Objects.equals(selectedThingId,thingId));
    tv.setOnVoteListener(listener);
    thumbnailLoader.setThumbnail(context,tv,thumbnailUrl);
  }
}

Fixed version (ground truth):
@Override public void bindView(View view,Context context,Cursor cursor){
  if (view instanceof ThingView) {
    String author=cursor.getString(INDEX_AUTHOR);
    long createdUtc=cursor.getLong(INDEX_CREATED_UTC);
    String domain=cursor.getString(INDEX_DOMAIN);
    int downs=cursor.getInt(INDEX_DOWNS);
    int numComments=cursor.getInt(INDEX_NUM_COMMENTS);
    boolean over18=cursor.getInt(INDEX_OVER_18) == 1;
    int score=cursor.getInt(INDEX_SCORE);
    String subreddit=cursor.getString(INDEX_SUBREDDIT);
    String thingId=cursor.getString(INDEX_THING_ID);
    String thumbnailUrl=cursor.getString(INDEX_THUMBNAIL_URL);
    String title=cursor.getString(INDEX_TITLE);
    int ups=cursor.getInt(INDEX_UPS);
    int likes=cursor.getInt(INDEX_LIKES);
    if (!cursor.isNull(INDEX_VOTE)) {
      likes=cursor.getInt(INDEX_VOTE);
      score=Math.max(0,score + likes);
    }
    ThingView tv=(ThingView)view;
    tv.setData(author,createdUtc,domain,downs,likes,nowTimeMs,numComments,over18,parentSubreddit,score,subreddit,thingBodyWidth,thingId,thumbnailUrl,title,ups);
    tv.setChosen(singleChoice && Objects.equals(selectedThingId,thingId));
    tv.setOnVoteListener(listener);
    thumbnailLoader.setThumbnail(context,tv,thumbnailUrl);
  }
}
Program: 188113
Project: 188113
Buggy source:
public void setData(String author,long createdUtc,String domain,int downs,int likes,long nowTimeMs,int numComments,boolean over18,String parentSubreddit,int score,String subreddit,int thingBodyWidth,String thingId,String thumbnailUrl,String title,int ups){
  this.likes=likes;
  this.thingBodyWidth=thingBodyWidth;
  this.thingId=thingId;
  this.thumbnailUrl=thumbnailUrl;
  this.title=title;
  this.scoreText=VotingArrows.getScoreText(score + likes);
  this.statusText=getStatusText(getContext(),author,createdUtc,nowTimeMs,numComments,over18,parentSubreddit,subreddit);
  this.longDetailsText=getContext().getString(R.string.thing_details,ups,downs,domain);
  this.shortDetailsText=domain;
  requestLayout();
}

Fixed version (ground truth):
public void setData(String author,long createdUtc,String domain,int downs,int likes,long nowTimeMs,int numComments,boolean over18,String parentSubreddit,int score,String subreddit,int thingBodyWidth,String thingId,String thumbnailUrl,String title,int ups){
  this.likes=likes;
  this.thingBodyWidth=thingBodyWidth;
  this.thingId=thingId;
  this.thumbnailUrl=thumbnailUrl;
  this.title=title;
  this.scoreText=VotingArrows.getScoreText(score);
  this.statusText=getStatusText(getContext(),author,createdUtc,nowTimeMs,numComments,over18,parentSubreddit,subreddit);
  this.longDetailsText=getContext().getString(R.string.thing_details,ups,downs,domain);
  this.shortDetailsText=domain;
  requestLayout();
}
Program: 188114
Project: 188114
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (savedInstanceState == null) {
    accountName=getArguments().getString(ARG_ACCOUNT_NAME);
    selectedSubreddit=getArguments().getString(ARG_SELECTED_SUBREDDIT);
    if (!TextUtils.isEmpty(query)) {
      sessionId=query + "String_Node_Str" + System.currentTimeMillis();
    }
  }
 else {
    accountName=savedInstanceState.getString(STATE_ACCOUNT_NAME);
    selectedSubreddit=savedInstanceState.getString(STATE_SELECTED_SUBREDDIT);
    sessionId=savedInstanceState.getString(STATE_SESSION_ID);
  }
  query=getArguments().getString(ARG_QUERY);
  sync=savedInstanceState == null;
  int flags=getArguments().getInt(ARG_FLAGS);
  singleChoice=Flag.isEnabled(flags,FLAG_SINGLE_CHOICE);
  adapter=new SubredditAdapter(getActivity(),query,singleChoice);
  adapter.setSelectedSubreddit(selectedSubreddit);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  query=getArguments().getString(ARG_QUERY);
  sync=savedInstanceState == null;
  if (savedInstanceState == null) {
    accountName=getArguments().getString(ARG_ACCOUNT_NAME);
    selectedSubreddit=getArguments().getString(ARG_SELECTED_SUBREDDIT);
    if (!TextUtils.isEmpty(query)) {
      sessionId=query + "String_Node_Str" + System.currentTimeMillis();
    }
  }
 else {
    accountName=savedInstanceState.getString(STATE_ACCOUNT_NAME);
    selectedSubreddit=savedInstanceState.getString(STATE_SELECTED_SUBREDDIT);
    sessionId=savedInstanceState.getString(STATE_SESSION_ID);
  }
  int flags=getArguments().getInt(ARG_FLAGS);
  singleChoice=Flag.isEnabled(flags,FLAG_SINGLE_CHOICE);
  adapter=new SubredditAdapter(getActivity(),query,singleChoice);
  adapter.setSelectedSubreddit(selectedSubreddit);
}
Program: 188115
Project: 188115
Buggy source:
public void loadIfPossible(){
  if (accountName != null && (subreddit != null || query != null)) {
    getLoaderManager().initLoader(0,null,this);
  }
}

Fixed version (ground truth):
public void loadIfPossible(){
  if (accountName != null && sessionId != null && (subreddit != null || query != null)) {
    getLoaderManager().initLoader(0,null,this);
  }
}
Program: 188116
Project: 188116
Buggy source:
public void setSubreddit(String subreddit){
  this.subreddit=subreddit;
}

Fixed version (ground truth):
public void setSubreddit(String subreddit){
  if (!Objects.equalsIgnoreCase(this.subreddit,subreddit)) {
    this.subreddit=subreddit;
    this.sessionId=createSessionId();
  }
}
Program: 188117
Project: 188117
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (savedInstanceState == null) {
    accountName=getArguments().getString(ARG_ACCOUNT_NAME);
    subreddit=getArguments().getString(ARG_SUBREDDIT);
    if (!TextUtils.isEmpty(query)) {
      sessionId=query + "String_Node_Str" + System.currentTimeMillis();
    }
 else {
      sessionId=subreddit + "String_Node_Str" + System.currentTimeMillis();
    }
  }
 else {
    accountName=savedInstanceState.getString(STATE_ACCOUNT_NAME);
    subreddit=savedInstanceState.getString(STATE_SUBREDDIT);
    selectedThingId=savedInstanceState.getString(STATE_SELECTED_THING_ID);
    sessionId=savedInstanceState.getString(STATE_SESSION_ID);
  }
  filter=getArguments().getInt(ARG_FILTER);
  query=getArguments().getString(ARG_QUERY);
  sync=savedInstanceState == null;
  int flags=getArguments().getInt(ARG_FLAGS);
  boolean singleChoice=Flag.isEnabled(flags,FLAG_SINGLE_CHOICE);
  adapter=new ThingAdapter(getActivity(),subreddit,this,singleChoice);
  adapter.setSelectedThing(selectedThingId);
  setHasOptionsMenu(true);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  filter=getArguments().getInt(ARG_FILTER);
  query=getArguments().getString(ARG_QUERY);
  sync=savedInstanceState == null;
  if (savedInstanceState == null) {
    accountName=getArguments().getString(ARG_ACCOUNT_NAME);
    subreddit=getArguments().getString(ARG_SUBREDDIT);
    sessionId=createSessionId();
  }
 else {
    accountName=savedInstanceState.getString(STATE_ACCOUNT_NAME);
    subreddit=savedInstanceState.getString(STATE_SUBREDDIT);
    selectedThingId=savedInstanceState.getString(STATE_SELECTED_THING_ID);
    sessionId=savedInstanceState.getString(STATE_SESSION_ID);
  }
  int flags=getArguments().getInt(ARG_FLAGS);
  boolean singleChoice=Flag.isEnabled(flags,FLAG_SINGLE_CHOICE);
  adapter=new ThingAdapter(getActivity(),subreddit,this,singleChoice);
  adapter.setSelectedThing(selectedThingId);
  setHasOptionsMenu(true);
}
Program: 188118
Project: 188118
Buggy source:
public static Uri createUri(String accountName,String sessionId,String subredditName,int filter,String more,String query,boolean sync){
  Uri.Builder b=ThingProvider.CONTENT_URI.buildUpon().appendQueryParameter(ThingProvider.PARAM_ACCOUNT,accountName).appendQueryParameter(ThingProvider.PARAM_SESSION_ID,sessionId).appendQueryParameter(ThingProvider.PARAM_SUBREDDIT,subredditName).appendQueryParameter(ThingProvider.PARAM_FILTER,Integer.toString(filter)).appendQueryParameter(ThingProvider.PARAM_QUERY,query).appendQueryParameter(ThingProvider.PARAM_SYNC,Boolean.toString(sync));
  if (!TextUtils.isEmpty(more)) {
    b.appendQueryParameter(ThingProvider.PARAM_MORE,more);
  }
  return b.build();
}

Fixed version (ground truth):
public static Uri createUri(String accountName,String sessionId,String subredditName,int filter,String more,String query,boolean sync){
  Uri.Builder b=ThingProvider.CONTENT_URI.buildUpon().appendQueryParameter(ThingProvider.PARAM_SYNC,Boolean.toString(sync)).appendQueryParameter(ThingProvider.PARAM_ACCOUNT,accountName).appendQueryParameter(ThingProvider.PARAM_SESSION_ID,sessionId).appendQueryParameter(ThingProvider.PARAM_SUBREDDIT,subredditName).appendQueryParameter(ThingProvider.PARAM_FILTER,Integer.toString(filter));
  if (!TextUtils.isEmpty(query)) {
    b.appendQueryParameter(ThingProvider.PARAM_QUERY,query);
  }
  if (!TextUtils.isEmpty(more)) {
    b.appendQueryParameter(ThingProvider.PARAM_MORE,more);
  }
  return b.build();
}
Program: 188119
Project: 188119
Buggy source:
public String getMoreThingId(){
  Cursor c=getCursor();
  if (c != null && c.moveToLast()) {
    initColumnIndices(c);
    return c.getString(INDEX_THING_ID);
  }
  return null;
}

Fixed version (ground truth):
public String getMoreThingId(){
  Cursor c=getCursor();
  if (c != null && c.moveToLast()) {
    initColumnIndices(c);
    if (c.getInt(INDEX_KIND) == Things.KIND_MORE) {
      return c.getString(INDEX_THING_ID);
    }
  }
  return null;
}
Program: 188121
Project: 188121
Buggy source:
@Override protected void onDraw(Canvas c){
  boolean hasThumb=!TextUtils.isEmpty(thumbnailUrl);
  c.translate(PADDING,PADDING);
  VotingArrows.draw(c,bitmap,hasThumb,scoreText,scoreBounds,likes);
  c.translate(VotingArrows.getWidth() + PADDING,0);
  if (hasThumb) {
    Thumbnail.draw(c,bitmap);
    c.translate(Thumbnail.getWidth() + PADDING,0);
  }
  int tdy=(minHeight - rightHeight) / 2;
  c.translate(0,-PADDING + tdy);
  titleLayout.draw(c);
  int sdy=titleLayout.getHeight() + ELEMENT_PADDING;
  c.translate(0,sdy);
  statusLayout.draw(c);
  c.translate(0,-sdy - tdy);
  if (detailsLayout != null) {
    int dx=c.getWidth() - PADDING - detailsLayout.getWidth();
    int dy=(c.getHeight() - detailsLayout.getHeight()) / 2;
    c.translate(dx,dy);
    detailsLayout.draw(c);
    c.translate(-dx,-dy);
  }
}

Fixed version (ground truth):
@Override protected void onDraw(Canvas c){
  if (detailsLayout != null) {
    int dx=c.getWidth() - PADDING - detailsLayout.getWidth();
    int dy=(c.getHeight() - detailsLayout.getHeight()) / 2;
    c.translate(dx,dy);
    detailsLayout.draw(c);
    c.translate(-dx,-dy);
  }
  boolean hasThumb=!TextUtils.isEmpty(thumbnailUrl);
  c.translate(PADDING,PADDING);
  VotingArrows.draw(c,bitmap,hasThumb,scoreText,scoreBounds,likes);
  c.translate(VotingArrows.getWidth() + PADDING,0);
  if (hasThumb) {
    Thumbnail.draw(c,bitmap);
    c.translate(Thumbnail.getWidth() + PADDING,0);
  }
  int tdy=(minHeight - rightHeight) / 2;
  c.translate(0,-PADDING + tdy);
  titleLayout.draw(c);
  int sdy=titleLayout.getHeight() + ELEMENT_PADDING;
  c.translate(0,sdy);
  statusLayout.draw(c);
  c.translate(0,-sdy - tdy);
}
Program: 188122
Project: 188122
Buggy source:
protected void selectThingMultiPane(Thing thing,int thingPosition){
  getFragmentManager().popBackStack();
  ControlFragment cf=getControlFragment();
  cf=ControlFragment.newInstance(cf.getSubreddit(),thing,thingPosition,0);
  ThingMenuFragment tf=ThingMenuFragment.newInstance(thing);
  FragmentTransaction ft=getFragmentManager().beginTransaction();
  ft.add(cf,ControlFragment.TAG);
  ft.add(tf,ThingMenuFragment.TAG);
  ft.addToBackStack(null);
  ft.commit();
  ThingPagerAdapter adapter=new ThingPagerAdapter(getFragmentManager(),thing);
  thingPager.setAdapter(adapter);
}

Fixed version (ground truth):
protected void selectThingMultiPane(Thing thing,int thingPosition){
  getFragmentManager().popBackStack();
  ControlFragment cf=getControlFragment();
  cf=ControlFragment.newInstance(cf.getSubreddit(),thing,thingPosition,0);
  ThingMenuFragment tf=ThingMenuFragment.newInstance(thing);
  FragmentTransaction ft=getFragmentManager().beginTransaction();
  ft.add(cf,ControlFragment.TAG);
  ft.add(tf,ThingMenuFragment.TAG);
  ft.addToBackStack(null);
  ft.commit();
  refreshThingPager(thing);
}
Program: 188123
Project: 188123
Buggy source:
public void onBackStackChanged(){
  boolean hasThing=getThingMenuFragment() != null;
  bar.setDisplayHomeAsUpEnabled(hasThing);
  thingPager.setVisibility(hasThing ? View.VISIBLE : View.GONE);
  ControlFragment cf=getControlFragment();
  ThingListFragment tlf=getThingListFragment();
  tlf.setSelectedThing(cf.getThing(),cf.getThingPosition());
}

Fixed version (ground truth):
public void onBackStackChanged(){
  refresh();
}
Program: 188124
Project: 188124
Buggy source:
public void onLoadFinished(Loader<AccountResult> loader,AccountResult result){
  if (Debug.DEBUG_LOADERS) {
    Log.d(TAG,"String_Node_Str" + result.selectedAccount);
  }
  adapter.setAccountNames(result.accountNames);
  bar.setSelectedNavigationItem(result.selectedAccount);
}

Fixed version (ground truth):
public void onLoadFinished(Loader<AccountResult> loader,AccountResult result){
  adapter.setAccountNames(result.accountNames);
  prefs=result.prefs;
  int index=AccountLoader.getLastAccountIndex(prefs,result.accountNames);
  bar.setSelectedNavigationItem(index);
}
Program: 188125
Project: 188125
Buggy source:
public void onLoaderReset(Loader<AccountResult> loader){
  if (Debug.DEBUG_LOADERS) {
    Log.d(TAG,"String_Node_Str" + loader.getId() + "String_Node_Str");
  }
  adapter.setAccountNames(null);
}

Fixed version (ground truth):
public void onLoaderReset(Loader<AccountResult> loader){
  adapter.setAccountNames(null);
}
Program: 188126
Project: 188126
Buggy source:
public boolean onNavigationItemSelected(int itemPosition,long itemId){
  if (Debug.DEBUG_ACTIVITY) {
    Log.d(TAG,"String_Node_Str" + itemPosition + "String_Node_Str");
  }
  String accountName=adapter.getItem(itemPosition);
  AccountLoader.setLastAccount(this,accountName);
  SubredditListFragment slf=SubredditListFragment.newInstance(null,accountName,0);
  FragmentTransaction ft=getFragmentManager().beginTransaction();
  ft.replace(R.id.single_container,slf,SubredditListFragment.TAG);
  ft.commit();
  return true;
}

Fixed version (ground truth):
public boolean onNavigationItemSelected(int itemPosition,long itemId){
  if (Debug.DEBUG_ACTIVITY) {
    Log.d(TAG,"String_Node_Str" + itemPosition);
  }
  String accountName=adapter.getItem(itemPosition);
  AccountLoader.setLastAccount(prefs,accountName);
  SubredditListFragment slf=SubredditListFragment.newInstance(null,accountName,0);
  FragmentTransaction ft=getFragmentManager().beginTransaction();
  ft.replace(R.id.single_container,slf,SubredditListFragment.TAG);
  ft.commit();
  return true;
}
Program: 188127
Project: 188127
Buggy source:
@Override public AccountResult loadInBackground(){
  if (Debug.DEBUG_LOADERS) {
    Log.d(TAG,"String_Node_Str" + getId());
  }
  Context context=getContext();
  Account[] accounts=manager.getAccountsByType(AccountAuthenticator.getAccountType(context));
  Arrays.sort(accounts,ACCOUNT_COMPARATOR);
  String[] accountNames=new String[accounts.length + 1];
  accountNames[0]=Subreddits.ACCOUNT_NONE;
  for (int i=0; i < accounts.length; i++) {
    accountNames[i + 1]=accounts[i].name;
  }
  int selectedAccount=0;
  String lastAccount=prefs.getString(PREF_LAST_ACCOUNT,null);
  Log.d(TAG,"String_Node_Str" + lastAccount);
  for (int i=0; i < accountNames.length; i++) {
    if (accountNames[i].equals(lastAccount)) {
      selectedAccount=i;
      break;
    }
  }
  return new AccountResult(accountNames,selectedAccount);
}

Fixed version (ground truth):
@Override public AccountResult loadInBackground(){
  if (Debug.DEBUG_LOADERS) {
    Log.d(TAG,"String_Node_Str" + getId());
  }
  Context context=getContext();
  Account[] accounts=manager.getAccountsByType(AccountAuthenticator.getAccountType(context));
  Arrays.sort(accounts,ACCOUNT_COMPARATOR);
  String[] accountNames=new String[accounts.length + 1];
  accountNames[0]=Subreddits.ACCOUNT_NONE;
  for (int i=0; i < accounts.length; i++) {
    accountNames[i + 1]=accounts[i].name;
  }
  prefs.getString(PREF_LAST_ACCOUNT,null);
  return new AccountResult(accountNames,prefs);
}
Program: 188128
Project: 188128
Buggy source:
private AccountResult(String[] accountNames,int selectedAccount){
  this.accountNames=accountNames;
  this.selectedAccount=selectedAccount;
}

Fixed version (ground truth):
private AccountResult(String[] accountNames,SharedPreferences prefs){
  this.accountNames=accountNames;
  this.prefs=prefs;
}
Program: 188129
Project: 188129
Buggy source:
public static void setLastAccount(Context context,String name){
  SharedPreferences prefs=context.getSharedPreferences(PREFS,0);
  Editor editor=prefs.edit();
  editor.putString(AccountLoader.PREF_LAST_ACCOUNT,name);
  editor.apply();
}

Fixed version (ground truth):
public static void setLastAccount(SharedPreferences prefs,String accountName){
  Editor editor=prefs.edit();
  editor.putString(AccountLoader.PREF_LAST_ACCOUNT,accountName);
  editor.apply();
}
Program: 188130
Project: 188130
Buggy source:
private static void deleteSubreddit(ArrayList<Subreddit> subreddits,String name){
  int count=subreddits.size();
  for (int i=0; i < count; i++) {
    String subreddit=subreddits.get(i).name;
    if (name.equalsIgnoreCase(subreddit)) {
      subreddits.remove(i);
      return;
    }
  }
}

Fixed version (ground truth):
private static boolean deleteSubreddit(ArrayList<Subreddit> subreddits,String name){
  int count=subreddits.size();
  for (int i=0; i < count; i++) {
    String subreddit=subreddits.get(i).name;
    if (name.equalsIgnoreCase(subreddit)) {
      subreddits.remove(i);
      return true;
    }
  }
  return false;
}
Program: 188131
Project: 188131
Buggy source:
static Cursor query(SQLiteDatabase db,long accountId){
  String[] credentials=getCredentials(db,accountId);
  ArrayList<Subreddit> subreddits=null;
  try {
    subreddits=NetApi.query(credentials[INDEX_COOKIE]);
  }
 catch (  IOException e) {
    Log.e(TAG,"String_Node_Str",e);
    return null;
  }
  Cursor c=db.query(AccountSubreddits.TABLE_NAME,ACCOUNT_SUBREDDITS_PROJECTION,AccountSubreddits.ACCOUNT_ID_SELECTION,new String[]{Long.toString(accountId)},null,null,null);
  while (c.moveToNext()) {
    String name=c.getString(INDEX_NAME);
switch (c.getInt(INDEX_TYPE)) {
case AccountSubreddits.TYPE_INSERT:
      insertSubreddit(subreddits,name);
    break;
case AccountSubreddits.TYPE_DELETE:
  deleteSubreddit(subreddits,name);
break;
default :
throw new IllegalStateException();
}
}
c.close();
return new SubredditCursor(subreddits);
}

Fixed version (ground truth):
static Cursor query(Uri uri,SQLiteDatabase db){
  List<String> segments=uri.getPathSegments();
  long accountId=Long.parseLong(segments.get(1));
  String[] credentials=Credentials.getCredentials(db,accountId);
  ArrayList<Subreddit> subreddits=null;
  try {
    subreddits=NetApi.query(credentials[0]);
  }
 catch (  IOException e) {
    Log.e(TAG,"String_Node_Str",e);
    return null;
  }
  Cursor c=db.query(SyncTasks.TABLE_NAME,SYNC_TASKS_PROJECTION,SELECTION,new String[]{Long.toString(accountId)},null,null,SORT);
  boolean modified=false;
  while (c.moveToNext()) {
    String name=c.getString(INDEX_NAME);
switch (c.getInt(INDEX_TYPE)) {
case SyncTasks.TYPE_INSERT:
      modified|=insertSubreddit(subreddits,name);
    break;
case SyncTasks.TYPE_DELETE:
  deleteSubreddit(subreddits,name);
break;
default :
throw new IllegalStateException();
}
}
c.close();
if (modified) {
Collections.sort(subreddits);
}
return new SubredditCursor(subreddits);
}
Program: 188132
Project: 188132
Buggy source:
private static void queueSubscription(Context context,SQLiteDatabase db,long accountId,String subreddit,boolean subscribe){
  String[] credentials=getCredentials(db,accountId);
  Intent intent=new Intent(context,SyncService.class);
  intent.putExtra(SyncService.EXTRA_COOKIE,credentials[INDEX_COOKIE]);
  intent.putExtra(SyncService.EXTRA_MODHASH,credentials[INDEX_MODHASH]);
  intent.putExtra(SyncService.EXTRA_SUBREDDIT,subreddit);
  intent.putExtra(SyncService.EXTRA_SUBSCRIBE,subscribe);
  context.startService(intent);
}

Fixed version (ground truth):
private static void queueSubscription(Context context,long accountId,String subreddit,boolean subscribe){
  ContentValues values=new ContentValues(3);
  values.put(SyncTasks.COLUMN_ACCOUNT_ID,accountId);
  values.put(SyncTasks.COLUMN_NAME,subreddit);
  values.put(SyncTasks.COLUMN_TYPE,subscribe ? SyncTasks.TYPE_INSERT : SyncTasks.TYPE_DELETE);
  ContentResolver cr=context.getContentResolver();
  Uri taskUri=cr.insert(SyncTasks.CONTENT_URI,values);
  Intent intent=new Intent(context,SyncService.class);
  intent.setData(taskUri);
  context.startService(intent);
}
Program: 188133
Project: 188133
Buggy source:
static int insert(Context context,SQLiteDatabase db,long accountId,String subreddit){
  ContentValues values=new ContentValues(4);
  values.put(AccountSubreddits.COLUMN_ACCOUNT_ID,accountId);
  values.put(AccountSubreddits.COLUMN_NAME,subreddit);
  values.put(AccountSubreddits.COLUMN_TYPE,AccountSubreddits.TYPE_INSERT);
  values.put(AccountSubreddits.COLUMN_CREATION_TIME,System.currentTimeMillis());
  db.insert(AccountSubreddits.TABLE_NAME,null,values);
  queueSubscription(context,db,accountId,subreddit,true);
  return 0;
}

Fixed version (ground truth):
static int insert(Context context,long accountId,String subreddit){
  queueSubscription(context,accountId,subreddit,true);
  return 0;
}
Program: 188134
Project: 188134
Buggy source:
private static void insertSubreddit(ArrayList<Subreddit> subreddits,String name){
  int count=subreddits.size();
  for (int i=0; i < count; i++) {
    String subreddit=subreddits.get(i).name;
    if (name.equalsIgnoreCase(subreddit)) {
      return;
    }
  }
  subreddits.add(Subreddit.newInstance(name));
}

Fixed version (ground truth):
private static boolean insertSubreddit(ArrayList<Subreddit> subreddits,String name){
  int count=subreddits.size();
  for (int i=0; i < count; i++) {
    String subreddit=subreddits.get(i).name;
    if (name.equalsIgnoreCase(subreddit)) {
      return false;
    }
  }
  subreddits.add(Subreddit.newInstance(name));
  return true;
}
Program: 188135
Project: 188135
Buggy source:
static int delete(Context context,SQLiteDatabase db,long accountId,String subreddit){
  ContentValues values=new ContentValues(4);
  values.put(AccountSubreddits.COLUMN_ACCOUNT_ID,accountId);
  values.put(AccountSubreddits.COLUMN_NAME,subreddit);
  values.put(AccountSubreddits.COLUMN_TYPE,AccountSubreddits.TYPE_DELETE);
  values.put(AccountSubreddits.COLUMN_CREATION_TIME,System.currentTimeMillis());
  db.insert(AccountSubreddits.TABLE_NAME,null,values);
  queueSubscription(context,db,accountId,subreddit,false);
  return 1;
}

Fixed version (ground truth):
static int delete(Context context,long accountId,String subreddit){
  queueSubscription(context,accountId,subreddit,false);
  return 1;
}
Program: 188136
Project: 188136
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.thing_list);
  bar=getActionBar();
  bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
  bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
  subreddit=getIntent().getParcelableExtra(EXTRA_SUBREDDIT);
  int flags=getIntent().getIntExtra(EXTRA_FLAGS,0);
  insertHome=Flag.isEnabled(flags,FLAG_INSERT_HOME);
  if (Flag.isEnabled(flags,FLAG_SHOW_ADD_ACTION)) {
    tlfFlags|=ThingListFragment.FLAG_SHOW_ADD_ACTION;
  }
  navigationListenerDisabled=true;
  FilterAdapter adapter=new FilterAdapter(this);
  adapter.setTitle(subreddit.getTitle(this));
  bar.setListNavigationCallbacks(adapter,this);
  if (savedInstanceState != null) {
    bar.setSelectedNavigationItem(savedInstanceState.getInt(STATE_FILTER));
  }
  navigationListenerDisabled=false;
  if (savedInstanceState == null) {
    updateFragments(FilterAdapter.FILTER_HOT,true);
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.thing_list);
  bar=getActionBar();
  bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
  bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
  subreddit=getIntent().getParcelableExtra(EXTRA_SUBREDDIT);
  int flags=getIntent().getIntExtra(EXTRA_FLAGS,0);
  insertHome=Flag.isEnabled(flags,FLAG_INSERT_HOME);
  if (Flag.isEnabled(flags,FLAG_SHOW_ADD_ACTION)) {
    tlfFlags|=ThingListFragment.FLAG_SHOW_ADD_ACTION;
  }
  FilterAdapter adapter=new FilterAdapter(this);
  adapter.setTitle(subreddit.getTitle(this));
  bar.setListNavigationCallbacks(adapter,this);
  if (savedInstanceState != null) {
    restoringState=true;
    bar.setSelectedNavigationItem(savedInstanceState.getInt(STATE_FILTER));
  }
}
Program: 188137
Project: 188137
Buggy source:
public boolean onNavigationItemSelected(int itemPosition,long itemId){
  if (navigationListenerDisabled) {
    return true;
  }
  updateFragments((int)itemId,false);
  return true;
}

Fixed version (ground truth):
public boolean onNavigationItemSelected(int itemPosition,long itemId){
  if (restoringState) {
    restoringState=false;
    return true;
  }
  replaceFragments((int)itemId,false);
  return true;
}
Program: 188138
Project: 188138
Buggy source:
private void updateThingPager(Thing thing){
  if (thing != null) {
    FragmentManager fm=getFragmentManager();
    ThingPagerAdapter adapter=new ThingPagerAdapter(fm,thing);
    thingPager.setAdapter(adapter);
    thingPager.setCurrentItem(0);
  }
 else {
    thingPager.setAdapter(null);
  }
}

Fixed version (ground truth):
private void updateThingPager(Thing thing){
  if (thing != null) {
    FragmentManager fm=getFragmentManager();
    ThingPagerAdapter adapter=new ThingPagerAdapter(fm,thing);
    thingPager.setAdapter(adapter);
  }
 else {
    thingPager.setAdapter(null);
  }
}
Program: 188139
Project: 188139
Buggy source:
private static int findOpeningParen(CharSequence s,char c,int start){
  boolean spaceFound=false;
  int len=s.length();
  for (int i=start; i < len; i++) {
    char ch=s.charAt(i);
    if (ch == c) {
      return i;
    }
 else     if (ch == ' ') {
      if (spaceFound) {
        break;
      }
      spaceFound=true;
    }
 else {
      break;
    }
  }
  return -1;
}

Fixed version (ground truth):
private static int findOpeningParen(CharSequence s,char c,int start){
  boolean spaceFound=false;
  int len=s.length();
  for (int i=start; i < len; i++) {
    char ch=s.charAt(i);
    if (ch == c) {
      return i;
    }
 else     if (ch == ' ' || ch == '\n') {
      if (spaceFound) {
        break;
      }
      spaceFound=true;
    }
 else {
      break;
    }
  }
  return -1;
}
Program: 188140
Project: 188140
Buggy source:
public void testFormat_nestedBrackets(){
  CharSequence cs=assertNamedLinksFormat("String_Node_Str","String_Node_Str");
  assertUrlSpan(cs,0,6,"String_Node_Str");
}

Fixed version (ground truth):
public void testFormat_nestedBrackets(){
  CharSequence cs=assertNamedLinksFormat("String_Node_Str","String_Node_Str");
  assertUrlSpan(cs,0,6,"String_Node_Str");
  cs=assertNamedLinksFormat("String_Node_Str","String_Node_Str");
  assertUrlSpan(cs,0,3,"String_Node_Str");
  assertUrlSpan(cs,4,7,"String_Node_Str");
}
Program: 188141
Project: 188141
Buggy source:
public void testFormat(){
  CharSequence cs=assertNamedLinksFormat("String_Node_Str","String_Node_Str");
  assertUrlSpan(cs,0,3,"String_Node_Str");
  cs=assertNamedLinksFormat("String_Node_Str","String_Node_Str");
  assertUrlSpan(cs,0,3,"String_Node_Str");
  cs=assertNamedLinksFormat("String_Node_Str","String_Node_Str");
  assertUrlSpan(cs,0,3,"String_Node_Str");
}

Fixed version (ground truth):
public void testFormat(){
  CharSequence cs=assertNamedLinksFormat("String_Node_Str","String_Node_Str");
  assertUrlSpan(cs,0,3,"String_Node_Str");
  cs=assertNamedLinksFormat("String_Node_Str","String_Node_Str");
  assertUrlSpan(cs,0,3,"String_Node_Str");
  cs=assertNamedLinksFormat("String_Node_Str","String_Node_Str");
  assertUrlSpan(cs,0,3,"String_Node_Str");
  cs=assertNamedLinksFormat("String_Node_Str","String_Node_Str");
  assertUrlSpan(cs,0,3,"String_Node_Str");
}
Program: 188142
Project: 188142
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.add_subreddits);
  manager=getFragmentManager();
  manager.addOnBackStackChangedListener(this);
  bar=getActionBar();
  bar.setDisplayHomeAsUpEnabled(true);
  bar.setDisplayShowTitleEnabled(false);
  bar.setDisplayShowCustomEnabled(true);
  bar.setCustomView(R.layout.subreddits_search);
  sv=(SearchView)bar.getCustomView();
  sv.setOnQueryTextListener(this);
  singleContainer=findViewById(R.id.single_container);
  if (savedInstanceState == null) {
    String q=getIntent().getStringExtra(EXTRA_QUERY);
    if (q != null && !q.trim().isEmpty()) {
      sv.setQuery(q.trim(),true);
      sv.setFocusable(false);
    }
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.add_subreddits);
  manager=getFragmentManager();
  manager.addOnBackStackChangedListener(this);
  bar=getActionBar();
  bar.setDisplayHomeAsUpEnabled(true);
  bar.setDisplayShowTitleEnabled(false);
  bar.setDisplayShowCustomEnabled(true);
  bar.setCustomView(R.layout.subreddits_search);
  sv=(SearchView)bar.getCustomView();
  sv.setOnQueryTextListener(this);
  sv.setFocusable(false);
  singleContainer=findViewById(R.id.single_container);
  if (savedInstanceState == null) {
    String q=getIntent().getStringExtra(EXTRA_QUERY);
    if (q != null && !q.trim().isEmpty()) {
      sv.setQuery(q.trim(),true);
    }
  }
}
Program: 188143
Project: 188143
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  adapter=new SubredditInfoAdapter(getActivity().getLayoutInflater(),getArguments().getBoolean(ARG_SINGLE_CHOICE));
  adapter.setChosenPosition(savedInstanceState != null ? savedInstanceState.getInt(STATE_CHOSEN) : 0);
  setListAdapter(adapter);
  setEmptyText(getString(R.string.empty));
  setListShown(false);
  getLoaderManager().initLoader(0,null,this);
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  adapter.setChosenPosition(savedInstanceState != null ? savedInstanceState.getInt(STATE_CHOSEN) : 0);
  setListAdapter(adapter);
  setEmptyText(getString(R.string.empty));
  setListShown(false);
  getLoaderManager().initLoader(0,null,this);
}
Program: 188144
Project: 188144
Buggy source:
private static void formatNamedLinks(SpannableStringBuilder b,Matcher m){
  for (int deleted=0; m.find(); ) {
    int s=m.start() - deleted;
    int e=m.end() - deleted;
    String name=m.group(1);
    String url=m.group(2);
    b.replace(s,e,name);
    deleted+=4 + url.length();
    if (url.startsWith("String_Node_Str")) {
      url="String_Node_Str" + url;
    }
 else     if (!url.startsWith("String_Node_Str") && !url.startsWith("String_Node_Str")) {
      url="String_Node_Str" + url;
    }
    URLSpan span=new URLSpan(url);
    b.setSpan(span,s,s + name.length(),0);
  }
}

Fixed version (ground truth):
private static void formatNamedLinks(SpannableStringBuilder b,Matcher m){
  for (int deleted=0; m.find(); ) {
    int s=m.start() - deleted;
    int e=m.end() - deleted;
    String name=m.group(1);
    String spacing=m.group(2);
    String url=m.group(3);
    b.replace(s,e,name);
    deleted+=4 + spacing.length() + url.length();
    if (url.startsWith("String_Node_Str")) {
      url="String_Node_Str" + url;
    }
 else     if (!url.startsWith("String_Node_Str") && !url.startsWith("String_Node_Str")) {
      url="String_Node_Str" + url;
    }
    URLSpan span=new URLSpan(url);
    b.setSpan(span,s,s + name.length(),0);
  }
}
Program: 188145
Project: 188145
Buggy source:
private boolean isVisible(String tag){
  Fragment f=manager.findFragmentByTag(tag);
  return f != null && f.isVisible();
}

Fixed version (ground truth):
private boolean isVisible(String tag){
  Fragment f=manager.findFragmentByTag(tag);
  return f != null && f.isAdded();
}
Program: 188147
Project: 188147
Buggy source:
@Override public void onTitle(JsonReader reader,int index) throws IOException {
  things.get(index).title=reader.nextString();
}

Fixed version (ground truth):
@Override public void onTitle(JsonReader reader,int index) throws IOException {
  things.get(index).title=Formatter.formatTitle(reader.nextString()).toString();
}
Program: 188148
Project: 188148
Buggy source:
@Override public void bindAll(Map<ParameterDescription,Object> bindings,Request req,Response resp){
  Map<String,Object> requestData=req.getAllData();
  Map<String,Object> normalisedKeys=RequestHeaderBinder.normaliseKeysToJavaVarNames(requestData);
  Map<String,List<String>> datamap=createListMap(normalisedKeys);
  parameterBinderRegistry.bind(bindings,datamap,null);
  for (  Map.Entry<ParameterDescription,Object> binding : bindings.entrySet()) {
    ParameterDescription key=binding.getKey();
    String name=key.name();
    Object value=normalisedKeys.get(name);
    if (binding.getValue() == null && value != null) {
      if (key.isA(value.getClass())) {
        bindings.put(key,value);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void bindAll(Map<ParameterDescription,Object> bindings,Request req,Response resp){
  Map<String,Object> requestData=req.getAllData();
  Map<String,Object> normalisedKeys=RequestHeaderBinder.normaliseKeysToJavaVarNames(requestData);
  Map<String,List<String>> datamap=createListMap(normalisedKeys);
  parameterBinderRegistry.bind(bindings,datamap,null);
  for (  Map.Entry<ParameterDescription,Object> binding : bindings.entrySet()) {
    ParameterDescription key=binding.getKey();
    String name=key.name();
    Object value=requestData.get(name);
    if (value == null) {
      value=normalisedKeys.get(name);
    }
    if (binding.getValue() == null && value != null) {
      if (key.isA(value.getClass())) {
        bindings.put(key,value);
      }
    }
  }
}
Program: 188150
Project: 188150
Buggy source:
private void addRecipients(Map<String,String> to,Message message,RecipientType recipientType) throws MessagingException {
  if (Expressive.isNotEmpty(to)) {
    for (    Entry<String,String> recipient : to.entrySet()) {
      message.setRecipient(recipientType,emailAddress(recipient));
    }
  }
}

Fixed version (ground truth):
private void addRecipients(Map<String,String> to,Message message,RecipientType recipientType) throws MessagingException {
  if (Expressive.isNotEmpty(to)) {
    List<Address> addresses=new ArrayList<>();
    for (    Entry<String,String> recipient : to.entrySet()) {
      addresses.add(emailAddress(recipient));
    }
    message.addRecipients(recipientType,addresses.toArray(new Address[0]));
  }
}
Program: 188151
Project: 188151
Buggy source:
public MailBuilder cc(Map<String,String> cc);

Fixed version (ground truth):
/** 
 * Add the given map of email address to names to the 'cc' recipients of the email
 * @param emailAddress
 * @return
 */
public MailBuilder cc(Map<String,String> cc);
Program: 188152
Project: 188152
Buggy source:
public MailBuilder bcc(Map<String,String> bcc);

Fixed version (ground truth):
/** 
 * Add the given map of email address to names to the 'bcc' recipients of the email
 * @param emailAddress
 * @return
 */
public MailBuilder bcc(Map<String,String> bcc);
Program: 188153
Project: 188153
Buggy source:
public MailBuilder subject(String subject);

Fixed version (ground truth):
/** 
 * Specify the subject of the email
 * @param subject
 * @return
 */
public MailBuilder subject(String subject);
Program: 188154
Project: 188154
Buggy source:
public MailBuilder replyTo(String email,String name);

Fixed version (ground truth):
/** 
 * Set the email address and name of the 'reply to' address of the email
 * @param emailAddress
 * @param name
 * @return
 */
public MailBuilder replyTo(String email,String name);
Program: 188155
Project: 188155
Buggy source:
public MailBuilder from(String emailAddress,String name);

Fixed version (ground truth):
/** 
 * Set the email address and name of the sender of the email
 * @param emailAddress
 * @param name
 * @return
 */
public MailBuilder from(String emailAddress,String name);
Program: 188156
Project: 188156
Buggy source:
public MailBuilder to(Map<String,String> to);

Fixed version (ground truth):
/** 
 * Add the given map of email address to names to the 'to' recipients of the email
 * @param emailAddress
 * @return
 */
public MailBuilder to(Map<String,String> to);
Program: 188157
Project: 188157
Buggy source:
public <T>MailBuilder body(T view) throws MailException ;

Fixed version (ground truth):
/** 
 * Set the body of the email. The given view can be any object for which a   {@link ViewResolver} has been registered in the {@link ViewResolverRegistry}.
 * @param view
 * @return
 * @throws MailException
 */
public <T>MailBuilder body(T view) throws MailException ;
Program: 188158
Project: 188158
Buggy source:
public void send() throws MailException ;

Fixed version (ground truth):
/** 
 * Send the email using the current state of the builder
 * @throws MailException
 */
public void send() throws MailException ;
Program: 188159
Project: 188159
Buggy source:
public MailBuilder mail() throws MailException ;

Fixed version (ground truth):
/** 
 * Start building an email using a new   {@link MailBuilder}
 * @return
 * @throws MailException
 */
public MailBuilder mail() throws MailException ;
Program: 188160
Project: 188160
Buggy source:
public void send(MailBuilder mailBuilder) throws MailException ;

Fixed version (ground truth):
/** 
 * Takes a   {@link MailBuilder} earlier provided from {@link #mail()} and sends the email configured in it.
 * @param mailBuilder
 * @throws MailException
 */
public void send(MailBuilder mailBuilder) throws MailException ;
Program: 188161
Project: 188161
Buggy source:
@Override public StringBuffer getRequestURL(){
  return new StringBuffer(path);
}

Fixed version (ground truth):
@Override public StringBuffer getRequestURL(){
  String url=this.url.toString();
  int index=url.indexOf('?');
  if (index != -1) {
    url=url.substring(0,index);
  }
  return new StringBuffer(url);
}
Program: 188162
Project: 188162
Buggy source:
@Override public int read() throws IOException {
  return sis.read();
}

Fixed version (ground truth):
@Override public int read() throws IOException {
  return inputStream.read();
}
Program: 188163
Project: 188163
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public ServletInputStream getInputStream() throws IOException {
  final StringInputStream sis=new StringInputStream(content,Mode.ALL);
  return new ServletInputStream(){
    @Override public int read() throws IOException {
      return sis.read();
    }
  }
;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public ServletInputStream getInputStream() throws IOException {
  String body=(content == null) ? "String_Node_Str" : content;
  final ByteArrayInputStream inputStream=new ByteArrayInputStream(body.getBytes(this.getCharacterEncoding()));
  return new ServletInputStream(){
    @Override public int read() throws IOException {
      return inputStream.read();
    }
  }
;
}
Program: 188164
Project: 188164
Buggy source:
public MockHttpServletRequest url(String url){
  Pattern pattern=Pattern.compile("String_Node_Str");
  Matcher matcher=pattern.matcher(url);
  if (!matcher.matches()) {
    path=url;
  }
 else {
    this.protocol=matcher.group(2);
    this.path=matcher.group(4) + matcher.group(6);
    this.queryString=matcher.group(7);
  }
  return this;
}

Fixed version (ground truth):
public MockHttpServletRequest url(String url){
  try {
    if (url.startsWith("String_Node_Str")) {
      url=String.format("String_Node_Str",protocol,host,url);
    }
    this.url=new URL(url);
    this.protocol=this.url.getProtocol();
    this.host=this.url.getHost();
    this.path=this.url.getPath();
    this.queryString=this.url.getQuery();
  }
 catch (  MalformedURLException e) {
    throw new RuntimeException(url + "String_Node_Str",e);
  }
  return this;
}
Program: 188165
Project: 188165
Buggy source:
protected void addRoutes(Routes routes,UpdatableInjectionContext injectionContext,String routesFile){
  try {
    String routesSource=Streams.getResourceAsString(routesFile);
    Logger.info("String_Node_Str",routesFile);
    Map<Route,Action> routeMap=routes.parseJsonRoutes(routesSource);
    routes.addRoutes(routeMap);
  }
 catch (  ActionException e) {
    throw e;
  }
catch (  BaseException e) {
    Logger.info("String_Node_Str",routesFile);
  }
}

Fixed version (ground truth):
protected void addRoutes(Routes routes,UpdatableInjectionContext injectionContext,String routesFile){
  String routesSource=null;
  try {
    routesSource=Streams.getResourceAsString(routesFile);
  }
 catch (  BaseException e) {
    Logger.info("String_Node_Str",routesFile);
  }
  if (routesSource != null) {
    Logger.info("String_Node_Str",routesFile);
    Map<Route,Action> routeMap=routes.parseJsonRoutes(routesSource);
    routes.addRoutes(routeMap);
  }
}
Program: 188166
Project: 188166
Buggy source:
public Map<Route,Action> parseJsonRoutes(String source){
  try {
    Map<Route,Action> routes=new LinkedHashMap<Route,Action>();
    JsonProperties properties=new JsonProperties(source);
    for (    String route : properties.getKeys()) {
      if (properties.is(route,String.class)) {
        String actionName=properties.getString(route);
        Action action=createAction(actionName);
        routes.put(new Route(RouteType.GET,route,null),action);
      }
 else       if (properties.is(route,Map.class)) {
        Map<String,String> map=properties.getMap(route);
        for (        Map.Entry<String,String> routeEntry : map.entrySet()) {
          RouteType routeType=RouteType.from(routeEntry.getKey());
          if (routeType == null) {
            throw new RouteNotFoundException("String_Node_Str",routeEntry.getKey());
          }
          String actionName=routeEntry.getValue();
          Action action=createAction(actionName);
          routes.put(new Route(routeType,route,null),action);
        }
      }
    }
    return routes;
  }
 catch (  Exception e) {
    throw new RouteNotFoundException(e,"String_Node_Str",e.getMessage());
  }
}

Fixed version (ground truth):
public Map<Route,Action> parseJsonRoutes(String source){
  Map<Route,Action> routes=new LinkedHashMap<Route,Action>();
  JsonProperties properties=new JsonProperties(source);
  for (  String route : properties.getKeys()) {
    if (properties.is(route,String.class)) {
      String actionName=properties.getString(route);
      Action action=createAction(actionName);
      routes.put(new Route(RouteType.GET,route,null),action);
    }
 else     if (properties.is(route,Map.class)) {
      Map<String,String> map=properties.getMap(route);
      for (      Map.Entry<String,String> routeEntry : map.entrySet()) {
        RouteType routeType=RouteType.from(routeEntry.getKey());
        if (routeType == null) {
          throw new RouteException("String_Node_Str",routeEntry.getKey());
        }
        String actionName=routeEntry.getValue();
        Action action=createAction(actionName);
        routes.put(new Route(routeType,route,null),action);
      }
    }
  }
  return routes;
}