nus-yam/ex-repair huggingface dataset:
Program: 163112
Project: 163112
Buggy source:
@Override public void onItemSelected(Issue item){
  IssueInfo info=new IssueInfo();
  info.num=item.getNumber();
  info.repoInfo=new RepoInfo();
  info.repoInfo.owner=item.getRepository().getOwner().getLogin();
  info.repoInfo.name=item.getRepository().getName();
  if (item.getPullRequest() != null) {
    Intent intent=PullRequestDetailActivity.createLauncherIntent(getActivity(),info);
    startActivity(intent);
  }
 else {
    Intent intent=IssueDetailActivity.createLauncherIntent(getActivity(),info);
    startActivity(intent);
  }
}

Fixed version (ground truth):
@Override public void onItemSelected(Issue item){
  IssueInfo info=new IssueInfo();
  info.num=item.getNumber();
  info.repoInfo=new RepoInfo();
  if (item.getRepository() != null) {
    info.repoInfo=new RepoInfo();
    info.repoInfo.owner=item.getRepository().getOwner().getLogin();
    info.repoInfo.name=item.getRepository().getName();
  }
 else   if (item.getRepositoryUrl() != null) {
    info.repoInfo=new RepoInfo();
    Uri parse=Uri.parse(item.getRepositoryUrl());
    List<String> pathSegments=parse.getPathSegments();
    if (pathSegments != null && pathSegments.size() > 1) {
      pathSegments=new ArrayList<>(pathSegments);
      Collections.reverse(pathSegments);
      info.repoInfo.name=pathSegments.get(0);
      info.repoInfo.owner=pathSegments.get(1);
    }
  }
  if (info.repoInfo != null) {
    if (item.getPullRequest() != null) {
      Intent intent=PullRequestDetailActivity.createLauncherIntent(getActivity(),info);
      startActivity(intent);
    }
 else {
      Intent intent=IssueDetailActivity.createLauncherIntent(getActivity(),info);
      startActivity(intent);
    }
  }
}
Program: 163113
Project: 163113
Buggy source:
private void getContent(){
  GetPullRequestFiles getPullRequestFiles=new GetPullRequestFiles(info);
  getPullRequestFiles.observable().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<Pair<List<CommitFile>,Integer>>(){
    @Override public void onCompleted(){
    }
    @Override public void onError(    Throwable e){
    }
    @Override public void onNext(    Pair<List<CommitFile>,Integer> listIntegerPair){
      if (getActivity() != null) {
        adapter.addAll(listIntegerPair.first);
        adapter.setOnFileRequestListener(PullRequestFilesListFragment.this);
        recyclerView.setAdapter(adapter);
      }
    }
  }
);
}

Fixed version (ground truth):
private void getContent(){
  GetPullRequestFiles getPullRequestFiles=new GetPullRequestFiles(issueInfo);
  getPullRequestFiles.observable().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<Pair<List<CommitFile>,Integer>>(){
    @Override public void onCompleted(){
    }
    @Override public void onError(    Throwable e){
    }
    @Override public void onNext(    Pair<List<CommitFile>,Integer> listIntegerPair){
      if (getActivity() != null) {
        adapter.addAll(listIntegerPair.first);
        adapter.setOnFileRequestListener(PullRequestFilesListFragment.this);
        recyclerView.setAdapter(adapter);
      }
    }
  }
);
}
Program: 163114
Project: 163114
Buggy source:
@Override public void onFileRequest(CommitFile file){
  FileInfo info=new FileInfo();
  info.content=file.patch;
  info.name=file.getFileName();
  Intent launcherIntent=FileActivity.createLauncherIntent(getActivity(),info);
  startActivity(launcherIntent);
}

Fixed version (ground truth):
@Override public void onFileRequest(CommitFile file){
  FileInfo info=new FileInfo();
  info.content=file.patch;
  info.name=file.getFileName();
  info.repoInfo=issueInfo.repoInfo;
  Intent launcherIntent=FileActivity.createLauncherIntent(getActivity(),info);
  startActivity(launcherIntent);
}
Program: 163115
Project: 163115
Buggy source:
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  if (getArguments() != null) {
    adapter=new CommitFilesAdapter(LayoutInflater.from(getActivity()));
    info=(IssueInfo)getArguments().getParcelable(INFO);
    recyclerView=(RecyclerView)view.findViewById(R.id.recycler);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity(),LinearLayoutManager.VERTICAL,false));
    getContent();
  }
}

Fixed version (ground truth):
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  if (getArguments() != null) {
    adapter=new CommitFilesAdapter(LayoutInflater.from(getActivity()));
    issueInfo=(IssueInfo)getArguments().getParcelable(INFO);
    recyclerView=(RecyclerView)view.findViewById(R.id.recycler);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity(),LinearLayoutManager.VERTICAL,false));
    getContent();
  }
}
Program: 163116
Project: 163116
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_new_issue);
  if (getIntent().getExtras() != null) {
    repoInfo=(RepoInfo)getIntent().getExtras().getParcelable(REPO_INFO);
    findViews();
    setTitle(getString(R.string.new_issue_title,repoInfo.name));
    issueRequest=CacheWrapper.getIssueRequest(repoInfo.owner + "String_Node_Str" + repoInfo.name);
    if (issueRequest != null) {
      setupFromCache(issueRequest);
    }
 else {
      issueRequest=new IssueRequest();
    }
  }
 else {
    finish();
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_new_issue);
  if (getIntent().getExtras() != null) {
    repoInfo=getIntent().getExtras().getParcelable(REPO_INFO);
    findViews();
    setTitle(getString(R.string.new_issue_title,repoInfo.name));
    issueRequest=CacheWrapper.getIssueRequest(repoInfo.owner + "String_Node_Str" + repoInfo.name);
    if (issueRequest != null) {
      setupFromCache(issueRequest);
    }
 else {
      issueRequest=new IssueRequest();
    }
    if (getSupportActionBar() != null) {
      getSupportActionBar().setBackgroundDrawable(new ColorDrawable(AttributesUtils.getPrimaryColor(this)));
    }
  }
 else {
    finish();
  }
}
Program: 163117
Project: 163117
Buggy source:
private void openNewIssueActivity(){
  Intent intent=NewIssueActivity.createLauncherIntent(getActivity(),repoInfo);
  startActivityForResult(intent,ISSUE_REQUEST);
}

Fixed version (ground truth):
private void openNewIssueActivity(){
  Intent intent=NewIssueActivity.createLauncherIntent(getActivity(),repoInfo);
  startActivityForResult(intent,NEW_ISSUE_REQUEST);
}
Program: 163118
Project: 163118
Buggy source:
@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
  if (resultCode == Activity.RESULT_FIRST_USER) {
    invalidate();
  }
 else   if (resultCode == Activity.RESULT_OK) {
    if (requestCode == ISSUE_REQUEST) {
      invalidate();
    }
 else     if (requestCode == MILESTONES_REQUEST) {
      Milestone milestone=data.getParcelableExtra(Milestone.class.getSimpleName());
      Intent intent=MilestoneIssuesActivity.launchIntent(getActivity(),repoInfo,milestone);
      startActivity(intent);
    }
  }
}

Fixed version (ground truth):
@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
  if (resultCode == Activity.RESULT_FIRST_USER) {
    invalidate();
  }
 else   if (resultCode == Activity.RESULT_OK) {
    if (requestCode == NEW_ISSUE_REQUEST) {
      invalidate();
    }
 else     if (requestCode == MILESTONES_REQUEST) {
      Milestone milestone=data.getParcelableExtra(Milestone.class.getSimpleName());
      Intent intent=MilestoneIssuesActivity.launchIntent(getActivity(),repoInfo,milestone);
      startActivity(intent);
    }
  }
}
Program: 163119
Project: 163119
Buggy source:
@Override protected void fabClick(){
  super.fabClick();
  if (repoInfo.permissions != null) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && fab != null) {
      animateRevealFab();
    }
 else {
      openNewIssueActivity();
    }
  }
}

Fixed version (ground truth):
@Override protected void fabClick(){
  super.fabClick();
  if (repoInfo.permissions != null) {
    openNewIssueActivity();
  }
}
Program: 163120
Project: 163120
Buggy source:
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  revealView=view.findViewById(R.id.revealView);
  Spinner spinner=(Spinner)view.findViewById(R.id.spinner);
  String[] items=getResources().getStringArray(R.array.issues_filter);
  ArrayAdapter<String> adapter=new ArrayAdapter<>(getActivity(),android.R.layout.simple_list_item_1,items);
  spinner.setAdapter(adapter);
  spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      if (currentFilter != position) {
        currentFilter=position;
        clear();
        onRefresh();
      }
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
    }
  }
);
  view.findViewById(R.id.milestones).setOnClickListener(v -> showMilestones());
}

Fixed version (ground truth):
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  Spinner spinner=(Spinner)view.findViewById(R.id.spinner);
  String[] items=getResources().getStringArray(R.array.issues_filter);
  ArrayAdapter<String> adapter=new ArrayAdapter<>(getActivity(),android.R.layout.simple_list_item_1,items);
  spinner.setAdapter(adapter);
  spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      if (currentFilter != position) {
        currentFilter=position;
        clear();
        onRefresh();
      }
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
    }
  }
);
  view.findViewById(R.id.milestones).setOnClickListener(v -> showMilestones());
}
Program: 163121
Project: 163121
Buggy source:
@Override public void onIssueOpenRequest(Issue item){
  if (item != null) {
    IssueInfo info=new IssueInfo();
    info.repoInfo=repoInfo;
    info.num=item.number;
    if (item.pullRequest == null) {
      Intent intent=IssueDetailActivity.createLauncherIntent(getActivity(),info);
      startActivityForResult(intent,ISSUE_REQUEST);
    }
  }
}

Fixed version (ground truth):
@Override public void onIssueOpenRequest(Issue item){
  if (item != null) {
    IssueInfo info=new IssueInfo();
    info.repoInfo=repoInfo;
    info.num=item.number;
    if (item.pullRequest == null) {
      Intent intent=IssueDetailActivity.createLauncherIntent(getActivity(),info);
      startActivity(intent);
    }
  }
}
Program: 163122
Project: 163122
Buggy source:
@SuppressLint("String_Node_Str") @Override public void onPrepareOptionsMenu(Menu menu){
  super.onPrepareOptionsMenu(menu);
  MenuItem menuItem=menu.findItem(R.id.edit);
  if (menuItem != null && fileContent != null) {
    Drawable drawable=AppCompatDrawableManager.get().getDrawable(getActivity(),R.drawable.pencil);
    drawable=DrawableCompat.wrap(drawable);
    drawable.setTint(Color.WHITE);
    menuItem.setIcon(drawable);
    menuItem.setEnabled(fileInfo.content != null);
  }
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") @Override public void onPrepareOptionsMenu(Menu menu){
  super.onPrepareOptionsMenu(menu);
  MenuItem menuItem=menu.findItem(R.id.edit);
  if (menuItem != null && fileContent != null) {
    Drawable drawable=AppCompatDrawableManager.get().getDrawable(getActivity(),R.drawable.pencil);
    Drawable wrappedDrawable=DrawableCompat.wrap(drawable);
    wrappedDrawable=wrappedDrawable.mutate();
    DrawableCompat.setTint(wrappedDrawable,getResources().getColor(R.color.white));
    menuItem.setIcon(drawable);
    menuItem.setEnabled(fileInfo.content != null);
  }
}
Program: 163123
Project: 163123
Buggy source:
@Override protected int getTitle(){
  return R.string.my_issues;
}

Fixed version (ground truth):
@Override protected int getTitle(){
  return R.string.navigation_issues;
}
Program: 163124
Project: 163124
Buggy source:
@Override public boolean onPrepareOptionsMenu(Menu menu){
  if (this.issueStory != null) {
    if (issueInfo.repoInfo.permissions != null && issueInfo.repoInfo.permissions.push || accountNameProvider.getName().equals(issueStory.item.user.login)) {
      if (menu.findItem(R.id.action_close_issue) != null) {
        menu.removeItem(R.id.action_close_issue);
      }
      if (menu.findItem(R.id.action_reopen_issue) != null) {
        menu.removeItem(R.id.action_reopen_issue);
      }
      if (issueStory.item.state == IssueState.closed) {
        MenuItem menuItem=menu.add(0,R.id.action_reopen_issue,1,getString(R.string.reopenIssue));
        menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
      }
 else {
        MenuItem menuItem=menu.add(0,R.id.action_close_issue,1,getString(R.string.closeIssue));
        menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
      }
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onPrepareOptionsMenu(Menu menu){
  if (this.issueStory != null) {
    if (issueInfo.repoInfo.permissions != null && issueInfo.repoInfo.permissions.push || (accountNameProvider.getName() != null && accountNameProvider.getName().equals(issueStory.item.user.login))) {
      if (menu.findItem(R.id.action_close_issue) != null) {
        menu.removeItem(R.id.action_close_issue);
      }
      if (menu.findItem(R.id.action_reopen_issue) != null) {
        menu.removeItem(R.id.action_reopen_issue);
      }
      if (issueStory.item.state == IssueState.closed) {
        MenuItem menuItem=menu.add(0,R.id.action_reopen_issue,1,getString(R.string.reopenIssue));
        menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
      }
 else {
        MenuItem menuItem=menu.add(0,R.id.action_close_issue,1,getString(R.string.closeIssue));
        menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
      }
    }
  }
  return true;
}
Program: 163125
Project: 163125
Buggy source:
@Override public void onErrorTwoFactorException(){
  show2faDialog(R.string.write_otp_code_sms);
}

Fixed version (ground truth):
@Override public void onErrorTwoFactorException(){
  show2faRequest(R.string.write_otp_code_sms);
}
Program: 163126
Project: 163126
Buggy source:
@Override public void onErrorTwoFactorAppException(){
  show2faDialog(R.string.write_otp_code_app);
}

Fixed version (ground truth):
@Override public void onErrorTwoFactorAppException(){
  show2faRequest(R.string.write_otp_code_app);
}
Program: 163127
Project: 163127
Buggy source:
private void checkError(Throwable e){
  if (e instanceof UnauthorizedException) {
    onErrorUnauthorized();
  }
 else {
    onGenericError();
  }
}

Fixed version (ground truth):
private void checkError(Throwable e){
  if (e instanceof UnauthorizedException) {
    onErrorUnauthorized();
  }
 else   if (!(e instanceof TwoFactorAppException || e instanceof TwoFactorAuthException)) {
    onGenericError();
  }
}
Program: 163128
Project: 163128
Buggy source:
private void createContent(NewContentRequest newContentRequest){
  NewFileClient client=new NewFileClient(newContentRequest,repoInfo,currentPath + editPath.getText().toString());
  client.observable().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(newContentResponse -> {
    Toast.makeText(NewContentActivity.this,"String_Node_Str",Toast.LENGTH_SHORT).show();
    hideProgressDialog();
  }
,throwable -> {
    Toast.makeText(NewContentActivity.this,"String_Node_Str",Toast.LENGTH_SHORT).show();
  }
);
}

Fixed version (ground truth):
private void createContent(NewContentRequest newContentRequest){
  String path=currentPath + editPath.getText().toString();
  if (currentPath.equals("String_Node_Str")) {
    path=editPath.getText().toString();
  }
  NewFileClient client=new NewFileClient(newContentRequest,repoInfo,path);
  client.observable().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(newContentResponse -> {
    Toast.makeText(NewContentActivity.this,"String_Node_Str",Toast.LENGTH_SHORT).show();
    hideProgressDialog();
  }
,throwable -> {
    Toast.makeText(NewContentActivity.this,"String_Node_Str",Toast.LENGTH_SHORT).show();
    hideProgressDialog();
  }
);
}
Program: 163129
Project: 163129
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  super.onOptionsItemSelected(item);
switch (item.getItemId()) {
case R.id.action_send:
    NewContentRequest contentRequest=checkDataAndCreateIssue();
  invalidateOptionsMenu();
createContent(contentRequest);
showProgressDialog(R.string.creating_content);
break;
}
return true;
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  super.onOptionsItemSelected(item);
switch (item.getItemId()) {
case R.id.action_send:
    NewContentRequest contentRequest=checkDataAndCreateFile();
  invalidateOptionsMenu();
createContent(contentRequest);
showProgressDialog(R.string.creating_content);
break;
}
return true;
}
Program: 163130
Project: 163130
Buggy source:
@Override public void loadMore(String username,Callback<List<Repo>> listCallback){
  if (page > Integer.MIN_VALUE) {
    execute(config().execute(new SdkItem<>(page,username)),listCallback);
  }
}

Fixed version (ground truth):
@Override public void loadMore(String username,Callback<List<Repo>> listCallback){
  if (page != null) {
    execute(config().execute(new SdkItem<>(page,username)),listCallback);
  }
}
Program: 163131
Project: 163131
Buggy source:
@NonNull @Override protected GenericRepository<String,List<Repo>> configRepository(RestWrapper restWrapper){
  if (genericRepository == null) {
    genericRepository=new GenericRepository<>(getUserReposCache(),getCloudRepositoriesDataSource(restWrapper,sortOrder));
  }
  return genericRepository;
}

Fixed version (ground truth):
@NonNull @Override protected GenericRepository<String,List<Repo>> configRepository(RestWrapper restWrapper){
  if (genericRepository == null) {
    genericRepository=new GenericRepository<>(getUserReposCacheDataSource(),getCloudRepositoriesDataSource(restWrapper,sortOrder));
  }
  return genericRepository;
}
Program: 163133
Project: 163133
Buggy source:
@Override public void onStart(){
  super.onStart();
  if (issueInfo != null) {
    String issueComment=CacheWrapper.getIssueComment(issueInfo.toString());
    if (issueComment != null) {
      editText.setText(issueComment);
    }
  }
}

Fixed version (ground truth):
@Override public void onStart(){
  super.onStart();
  if (issueInfo != null) {
    String issueComment=CacheWrapper.getIssueComment(issueInfo.toString());
    if (issueComment != null) {
      editText.setText(Html.fromHtml(issueComment));
    }
  }
}
Program: 163136
Project: 163136
Buggy source:
@Override public void onStart(){
  super.onStart();
  if (resultDrawer == null) {
    accountList=getAccounts();
    if (!accountList.isEmpty()) {
      selectedAccount=accountList.get(0);
      createDrawer();
      selectAccount(selectedAccount);
      onUserEventsSelected();
    }
  }
}

Fixed version (ground truth):
@Override public void onStart(){
  super.onStart();
  if (resultDrawer == null) {
    accountList=getAccounts();
    if (!accountList.isEmpty()) {
      selectedAccount=accountList.get(0);
      createDrawer();
      selectAccount(selectedAccount);
    }
  }
}
Program: 163137
Project: 163137
Buggy source:
@Override public boolean onReposSelected(){
  clearFragments();
  setFragment(GeneralReposFragment.newInstance(),false);
  return true;
}

Fixed version (ground truth):
@Override public boolean onReposSelected(){
  setFragment(GeneralReposFragment.newInstance(),false);
  return true;
}
Program: 163138
Project: 163138
Buggy source:
@Override public void onBackPressed(){
  if (resultDrawer != null && resultDrawer.isDrawerOpen()) {
    resultDrawer.closeDrawer();
  }
 else {
    if (lastUsedFragment instanceof EventsListFragment) {
      finish();
    }
 else     if (resultDrawer != null && (lastUsedFragment instanceof GeneralReposFragment || lastUsedFragment instanceof GeneralPeopleFragment)) {
      resultDrawer.setSelection(R.id.nav_drawer_events);
      clearFragments();
      onUserEventsSelected();
    }
  }
}

Fixed version (ground truth):
@Override public void onBackPressed(){
  if (resultDrawer != null && resultDrawer.isDrawerOpen()) {
    resultDrawer.closeDrawer();
  }
 else {
    if (lastUsedFragment instanceof EventsListFragment) {
      finish();
    }
 else     if (resultDrawer != null && (lastUsedFragment instanceof GeneralReposFragment || lastUsedFragment instanceof GeneralPeopleFragment)) {
      resultDrawer.setSelection(R.id.nav_drawer_events);
    }
  }
}
Program: 163139
Project: 163139
Buggy source:
private void selectAccount(final Account account){
  boolean changingUser=selectedAccount != null && !selectedAccount.name.equals(account.name);
  this.selectedAccount=account;
  if (notificationsDrawerItem != null) {
    notificationsDrawerItem.withChecked(selectedAccount != null && ContentResolver.getSyncAutomatically(selectedAccount,selectedAccount.type.replace("String_Node_Str","String_Node_Str")));
    if (resultDrawer != null) {
      resultDrawer.updateItem(notificationsDrawerItem);
    }
  }
  StoreCredentials credentials=new StoreCredentials(MainActivity.this);
  credentials.clear();
  String authToken=AccountsHelper.getUserToken(this,account);
  credentials.storeToken(authToken);
  credentials.storeUsername(account.name);
  credentials.storeUrl(AccountsHelper.getUrl(this,account));
  String url=AccountsHelper.getUrl(this,account);
  credentials.storeUrl(url);
  if (changingUser) {
    lastUsedFragment=null;
    clearFragments();
  }
}

Fixed version (ground truth):
private void selectAccount(final Account account){
  boolean changingUser=selectedAccount != null && !selectedAccount.name.equals(account.name);
  this.selectedAccount=account;
  if (notificationsDrawerItem != null) {
    notificationsDrawerItem.withChecked(selectedAccount != null && ContentResolver.getSyncAutomatically(selectedAccount,selectedAccount.type.replace("String_Node_Str","String_Node_Str")));
    if (resultDrawer != null) {
      resultDrawer.updateItem(notificationsDrawerItem);
    }
  }
  StoreCredentials credentials=new StoreCredentials(MainActivity.this);
  credentials.clear();
  String authToken=AccountsHelper.getUserToken(this,account);
  credentials.storeToken(authToken);
  credentials.storeUsername(account.name);
  credentials.storeUrl(AccountsHelper.getUrl(this,account));
  String url=AccountsHelper.getUrl(this,account);
  credentials.storeUrl(url);
  if (changingUser) {
    lastUsedFragment=null;
  }
}
Program: 163140
Project: 163140
Buggy source:
@Override public boolean onUserEventsSelected(){
  String user=new StoreCredentials(this).getUserName();
  if (user != null) {
    setFragment(EventsListFragment.newInstance(user));
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onUserEventsSelected(){
  String user=new StoreCredentials(this).getUserName();
  if (user != null) {
    setFragment(EventsListFragment.newInstance(user),false);
  }
  return true;
}
Program: 163141
Project: 163141
Buggy source:
@Override public void onStart(){
  super.onStart();
  if (resultDrawer == null) {
    accountList=getAccounts();
    if (!accountList.isEmpty()) {
      selectedAccount=accountList.get(0);
      createDrawer();
      selectAccount(selectedAccount);
      onUserEventsSelected();
    }
  }
}

Fixed version (ground truth):
@Override public void onStart(){
  super.onStart();
  if (resultDrawer == null) {
    accountList=getAccounts();
    if (!accountList.isEmpty()) {
      selectedAccount=accountList.get(0);
      createDrawer();
      selectAccount(selectedAccount);
    }
  }
}
Program: 163142
Project: 163142
Buggy source:
@Override public boolean onReposSelected(){
  clearFragments();
  setFragment(GeneralReposFragment.newInstance(),false);
  return true;
}

Fixed version (ground truth):
@Override public boolean onReposSelected(){
  setFragment(GeneralReposFragment.newInstance(),false);
  return true;
}
Program: 163143
Project: 163143
Buggy source:
@Override public void onBackPressed(){
  if (resultDrawer != null && resultDrawer.isDrawerOpen()) {
    resultDrawer.closeDrawer();
  }
 else {
    if (lastUsedFragment instanceof EventsListFragment) {
      finish();
    }
 else     if (resultDrawer != null && (lastUsedFragment instanceof GeneralReposFragment || lastUsedFragment instanceof GeneralPeopleFragment)) {
      resultDrawer.setSelection(R.id.nav_drawer_events);
      clearFragments();
      onUserEventsSelected();
    }
  }
}

Fixed version (ground truth):
@Override public void onBackPressed(){
  if (resultDrawer != null && resultDrawer.isDrawerOpen()) {
    resultDrawer.closeDrawer();
  }
 else {
    if (lastUsedFragment instanceof EventsListFragment) {
      finish();
    }
 else     if (resultDrawer != null && (lastUsedFragment instanceof GeneralReposFragment || lastUsedFragment instanceof GeneralPeopleFragment)) {
      resultDrawer.setSelection(R.id.nav_drawer_events);
    }
  }
}
Program: 163144
Project: 163144
Buggy source:
private void selectAccount(final Account account){
  boolean changingUser=selectedAccount != null && !selectedAccount.name.equals(account.name);
  this.selectedAccount=account;
  if (notificationsDrawerItem != null) {
    notificationsDrawerItem.withChecked(selectedAccount != null && ContentResolver.getSyncAutomatically(selectedAccount,selectedAccount.type.replace("String_Node_Str","String_Node_Str")));
    if (resultDrawer != null) {
      resultDrawer.updateItem(notificationsDrawerItem);
    }
  }
  StoreCredentials credentials=new StoreCredentials(MainActivity.this);
  credentials.clear();
  String authToken=AccountsHelper.getUserToken(this,account);
  credentials.storeToken(authToken);
  credentials.storeUsername(account.name);
  credentials.storeUrl(AccountsHelper.getUrl(this,account));
  String url=AccountsHelper.getUrl(this,account);
  credentials.storeUrl(url);
  if (changingUser) {
    lastUsedFragment=null;
    clearFragments();
  }
}

Fixed version (ground truth):
private void selectAccount(final Account account){
  boolean changingUser=selectedAccount != null && !selectedAccount.name.equals(account.name);
  this.selectedAccount=account;
  if (notificationsDrawerItem != null) {
    notificationsDrawerItem.withChecked(selectedAccount != null && ContentResolver.getSyncAutomatically(selectedAccount,selectedAccount.type.replace("String_Node_Str","String_Node_Str")));
    if (resultDrawer != null) {
      resultDrawer.updateItem(notificationsDrawerItem);
    }
  }
  StoreCredentials credentials=new StoreCredentials(MainActivity.this);
  credentials.clear();
  String authToken=AccountsHelper.getUserToken(this,account);
  credentials.storeToken(authToken);
  credentials.storeUsername(account.name);
  credentials.storeUrl(AccountsHelper.getUrl(this,account));
  String url=AccountsHelper.getUrl(this,account);
  credentials.storeUrl(url);
  if (changingUser) {
    lastUsedFragment=null;
  }
}
Program: 163145
Project: 163145
Buggy source:
@Override public boolean onUserEventsSelected(){
  String user=new StoreCredentials(this).getUserName();
  if (user != null) {
    setFragment(EventsListFragment.newInstance(user));
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onUserEventsSelected(){
  String user=new StoreCredentials(this).getUserName();
  if (user != null) {
    setFragment(EventsListFragment.newInstance(user),false);
  }
  return true;
}
Program: 163148
Project: 163148
Buggy source:
public int getColorIcons(){
  if (pullRequest.state == IssueState.open) {
    return R.color.issue_state_open;
  }
 else {
    return R.color.issue_state_close;
  }
}

Fixed version (ground truth):
public int getColorIcons(){
  if (pullRequest.merged) {
    return R.color.pullrequest_state_merged;
  }
 else   if (pullRequest.state == IssueState.open) {
    return R.color.pullrequest_state_open;
  }
 else {
    return R.color.pullrequest_state_close;
  }
}
Program: 163149
Project: 163149
Buggy source:
@Override protected void onBindViewHolder(ViewHolder holder,Content content){
  holder.textName.setText(content.name);
  IconicsDrawable iconDrawable=null;
  if (ContentType.dir.equals(content.type)) {
    iconDrawable=new IconicsDrawable(holder.itemView.getContext(),Octicons.Icon.oct_file_directory);
  }
 else   if (ContentType.submodule.equals(content.type)) {
    iconDrawable=new IconicsDrawable(holder.itemView.getContext(),Octicons.Icon.oct_file_symlink_directory);
  }
 else   if (ContentType.file.equals(content.type)) {
    iconDrawable=new IconicsDrawable(holder.itemView.getContext(),Octicons.Icon.oct_file_text);
  }
  if (iconDrawable != null) {
    iconDrawable.color(AttributesUtils.getPrimaryLightColor(holder.itemView.getContext()));
    holder.image.setImageDrawable(iconDrawable);
  }
}

Fixed version (ground truth):
@Override protected void onBindViewHolder(ViewHolder holder,Content content){
  holder.textName.setText(content.name);
  IconicsDrawable iconDrawable=null;
  if (ContentType.dir.equals(content.type)) {
    iconDrawable=new IconicsDrawable(holder.itemView.getContext(),Octicons.Icon.oct_file_directory);
  }
 else   if (ContentType.symlink.equals(content.type)) {
    iconDrawable=new IconicsDrawable(holder.itemView.getContext(),Octicons.Icon.oct_file_symlink_directory);
  }
 else   if (ContentType.file.equals(content.type)) {
    iconDrawable=new IconicsDrawable(holder.itemView.getContext(),Octicons.Icon.oct_file_text);
  }
  if (iconDrawable != null) {
    iconDrawable.color(AttributesUtils.getPrimaryLightColor(holder.itemView.getContext()));
    holder.image.setImageDrawable(iconDrawable);
  }
}
Program: 163150
Project: 163150
Buggy source:
private void onContentLoaded(List<Content> contents){
  if (getActivity() != null) {
    if (contents != null && contents.size() > 0) {
      Collections.sort(contents,Content.Comparators.TYPE);
      displayContent(contents);
    }
 else     if (getAdapter() == null || getAdapter().getItemCount() == 0) {
      setEmpty(false);
    }
  }
}

Fixed version (ground truth):
private void onContentLoaded(List<Content> contents){
  if (getActivity() != null) {
    if (contents != null && contents.size() > 0) {
      Collections.sort(contents);
      displayContent(contents);
    }
 else     if (getAdapter() == null || getAdapter().getItemCount() == 0) {
      setEmpty(false);
    }
  }
}
Program: 163151
Project: 163151
Buggy source:
private void setAction(GithubListClient<List<Issue>> client){
  client.observable().observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<Pair<List<Issue>,Integer>>(){
    @Override public void onCompleted(){
      stopRefresh();
    }
    @Override public void onError(    Throwable e){
      stopRefresh();
      if (getAdapter() == null || getAdapter().getItemCount() == 0) {
        setEmpty(true);
      }
    }
    @Override public void onNext(    Pair<List<Issue>,Integer> listIntegerPair){
      onResponse(listIntegerPair.first);
    }
  }
);
}

Fixed version (ground truth):
private void setAction(GithubListClient<List<Issue>> client){
  client.observable().observeOn(AndroidSchedulers.mainThread()).doOnNext(new Action1<Pair<List<Issue>,Integer>>(){
    @Override public void call(    Pair<List<Issue>,Integer> listIntegerPair){
      setPage(listIntegerPair.second);
    }
  }
).flatMap(new Func1<Pair<List<Issue>,Integer>,Observable<Issue>>(){
    @Override public Observable<Issue> call(    Pair<List<Issue>,Integer> listIntegerPair){
      return Observable.from(listIntegerPair.first);
    }
  }
).filter(new Func1<Issue,Boolean>(){
    @Override public Boolean call(    Issue issue){
      return issue.pullRequest == null;
    }
  }
).toList().subscribe(new Subscriber<List<Issue>>(){
    @Override public void onCompleted(){
      stopRefresh();
    }
    @Override public void onError(    Throwable e){
      if (getAdapter() == null || getAdapter().getItemCount() == 0) {
        setEmpty(true);
      }
    }
    @Override public void onNext(    List<Issue> issues){
      onResponse(issues);
    }
  }
);
}
Program: 163152
Project: 163152
Buggy source:
protected void onResponse(List<Issue> issues){
  if (issues != null && issues.size() > 0) {
    issues=filterIssues(issues);
    if (getAdapter() == null) {
      IssuesAdapter issuesAdapter=new IssuesAdapter(LayoutInflater.from(getActivity()));
      issuesAdapter.setIssuesAdapterListener(this);
      issuesAdapter.addAll(issues);
      setAdapter(issuesAdapter);
    }
 else {
      getAdapter().addAll(issues);
    }
  }
 else   if (getAdapter() == null || getAdapter().getItemCount() == 0) {
    setEmpty(false);
  }
}

Fixed version (ground truth):
protected void onResponse(List<Issue> issues){
  if (issues != null && issues.size() > 0) {
    if (getAdapter() == null) {
      IssuesAdapter issuesAdapter=new IssuesAdapter(LayoutInflater.from(getActivity()));
      issuesAdapter.setIssuesAdapterListener(this);
      issuesAdapter.addAll(issues);
      setAdapter(issuesAdapter);
    }
 else {
      getAdapter().addAll(issues);
    }
  }
 else   if (getAdapter() == null || getAdapter().getItemCount() == 0) {
    setEmpty(false);
  }
}
Program: 163153
Project: 163153
Buggy source:
@Override public void onError(Throwable e){
  stopRefresh();
  if (getAdapter() == null || getAdapter().getItemCount() == 0) {
    setEmpty(true);
  }
}

Fixed version (ground truth):
@Override public void onError(Throwable e){
  if (getAdapter() == null || getAdapter().getItemCount() == 0) {
    setEmpty(true);
  }
}
Program: 163154
Project: 163154
Buggy source:
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  revealView=view.findViewById(R.id.revealView);
  Spinner spinner=(Spinner)view.findViewById(R.id.spinner);
  String[] items=getResources().getStringArray(R.array.issues_filter);
  ArrayAdapter<String> adapter=new ArrayAdapter<>(getActivity(),android.R.layout.simple_list_item_1,items);
  spinner.setAdapter(adapter);
  spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      if (currentFilter != position) {
        currentFilter=position;
        onRefresh();
      }
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
    }
  }
);
}

Fixed version (ground truth):
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  revealView=view.findViewById(R.id.revealView);
  Spinner spinner=(Spinner)view.findViewById(R.id.spinner);
  String[] items=getResources().getStringArray(R.array.issues_filter);
  ArrayAdapter<String> adapter=new ArrayAdapter<>(getActivity(),android.R.layout.simple_list_item_1,items);
  spinner.setAdapter(adapter);
  spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      if (currentFilter != position) {
        currentFilter=position;
        clear();
        onRefresh();
      }
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
    }
  }
);
}
Program: 163155
Project: 163155
Buggy source:
@Override public void onNext(Pair<List<Issue>,Integer> listIntegerPair){
  onResponse(listIntegerPair.first);
}

Fixed version (ground truth):
@Override public void onNext(List<Issue> issues){
  onResponse(issues);
}
Program: 163156
Project: 163156
Buggy source:
@Override public void onItemSelected(AdapterView<?> parent,View view,int position,long id){
  if (currentFilter != position) {
    currentFilter=position;
    onRefresh();
  }
}

Fixed version (ground truth):
@Override public void onItemSelected(AdapterView<?> parent,View view,int position,long id){
  if (currentFilter != position) {
    currentFilter=position;
    clear();
    onRefresh();
  }
}
Program: 163157
Project: 163157
Buggy source:
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  Spinner spinner=(Spinner)view.findViewById(R.id.spinner);
  String[] items=getResources().getStringArray(R.array.pullrequest_filter);
  ArrayAdapter<String> adapter=new ArrayAdapter<>(getActivity(),android.R.layout.simple_list_item_1,items);
  spinner.setAdapter(adapter);
  spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      if (currentFilter != position) {
        currentFilter=position;
        onRefresh();
      }
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
    }
  }
);
}

Fixed version (ground truth):
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  Spinner spinner=(Spinner)view.findViewById(R.id.spinner);
  String[] items=getResources().getStringArray(R.array.pullrequest_filter);
  ArrayAdapter<String> adapter=new ArrayAdapter<>(getActivity(),android.R.layout.simple_list_item_1,items);
  spinner.setAdapter(adapter);
  spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      if (currentFilter != position) {
        currentFilter=position;
        clear();
        onRefresh();
      }
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
    }
  }
);
}
Program: 163158
Project: 163158
Buggy source:
@Override public void onItemSelected(AdapterView<?> parent,View view,int position,long id){
  if (currentFilter != position) {
    currentFilter=position;
    onRefresh();
  }
}

Fixed version (ground truth):
@Override public void onItemSelected(AdapterView<?> parent,View view,int position,long id){
  if (currentFilter != position) {
    currentFilter=position;
    clear();
    onRefresh();
  }
}
Program: 163159
Project: 163159
Buggy source:
@Override protected void getContent(){
  super.getContent();
  loadingView.setVisibility(View.VISIBLE);
  if (checkPermissions(issueInfo)) {
    GetRepoClient repoClient=new GetRepoClient(this,issueInfo.repoInfo);
    repoClient.setOnResultCallback(new BaseClient.OnResultCallback<Repo>(){
      @Override public void onResponseOk(      Repo repo,      Response r){
        issueInfo.repoInfo.permissions=repo.permissions;
        repository=repo;
        getContent();
      }
      @Override public void onFail(      RetrofitError error){
      }
    }
);
    repoClient.execute();
  }
 else {
    loadIssue();
  }
}

Fixed version (ground truth):
@Override protected void getContent(){
  super.getContent();
  hideProgressDialog();
  loadingView.setVisibility(View.VISIBLE);
  if (checkPermissions(issueInfo)) {
    GetRepoClient repoClient=new GetRepoClient(this,issueInfo.repoInfo);
    repoClient.setOnResultCallback(new BaseClient.OnResultCallback<Repo>(){
      @Override public void onResponseOk(      Repo repo,      Response r){
        issueInfo.repoInfo.permissions=repo.permissions;
        repository=repo;
        getContent();
      }
      @Override public void onFail(      RetrofitError error){
      }
    }
);
    repoClient.execute();
  }
 else {
    loadIssue();
  }
}
Program: 163160
Project: 163160
Buggy source:
@Override protected void getContent(){
  super.getContent();
  loadingView.setVisibility(View.VISIBLE);
  if (checkPermissions(issueInfo)) {
    GetRepoClient repoClient=new GetRepoClient(this,issueInfo.repoInfo);
    repoClient.setOnResultCallback(new BaseClient.OnResultCallback<Repo>(){
      @Override public void onResponseOk(      Repo repo,      Response r){
        issueInfo.repoInfo.permissions=repo.permissions;
        repository=repo;
        loadPullRequest();
      }
      @Override public void onFail(      RetrofitError error){
      }
    }
);
    repoClient.execute();
  }
 else {
    loadPullRequest();
  }
}

Fixed version (ground truth):
@Override protected void getContent(){
  super.getContent();
  hideProgressDialog();
  loadingView.setVisibility(View.VISIBLE);
  if (checkPermissions(issueInfo)) {
    GetRepoClient repoClient=new GetRepoClient(this,issueInfo.repoInfo);
    repoClient.setOnResultCallback(new BaseClient.OnResultCallback<Repo>(){
      @Override public void onResponseOk(      Repo repo,      Response r){
        issueInfo.repoInfo.permissions=repo.permissions;
        repository=repo;
        loadPullRequest();
      }
      @Override public void onFail(      RetrofitError error){
      }
    }
);
    repoClient.execute();
  }
 else {
    loadPullRequest();
  }
}
Program: 163161
Project: 163161
Buggy source:
private void setUpOrgs(final View view){
  ImageView icon=(ImageView)view.findViewById(R.id.iconOrgs);
  IconicsDrawable githubIconDrawable=drawable(view.getContext(),Octicons.Icon.oct_organization);
  icon.setImageDrawable(githubIconDrawable);
  textOrgs=(TextView)view.findViewById(R.id.textOrgs);
  view.findViewById(R.id.orgs).setOnClickListener(this);
  GetOrgsClient orgsClient=new GetOrgsClient(view.getContext(),user.login);
  orgsClient.setOnResultCallback(new BaseClient.OnResultCallback<ListOrganizations>(){
    @Override public void onResponseOk(    ListOrganizations organizations,    Response r){
      textOrgs.setText(view.getContext().getString(R.string.orgs_num,organizations.size()));
    }
    @Override public void onFail(    RetrofitError error){
    }
  }
);
  orgsClient.execute();
}

Fixed version (ground truth):
private void setUpOrgs(final View view){
  final ImageView icon=(ImageView)view.findViewById(R.id.iconOrgs);
  IconicsDrawable githubIconDrawable=drawable(view.getContext(),Octicons.Icon.oct_organization);
  icon.setImageDrawable(githubIconDrawable);
  textOrgs=(TextView)view.findViewById(R.id.textOrgs);
  view.findViewById(R.id.orgs).setOnClickListener(this);
  GetOrgsClient orgsClient=new GetOrgsClient(view.getContext(),user.login);
  orgsClient.setOnResultCallback(new BaseClient.OnResultCallback<ListOrganizations>(){
    @Override public void onResponseOk(    ListOrganizations organizations,    Response r){
      if (organizations != null && organizations.size() > 0) {
        textOrgs.setText(view.getContext().getString(R.string.orgs_num,organizations.size()));
      }
 else {
        view.findViewById(R.id.orgs).setVisibility(View.GONE);
        view.findViewById(R.id.dividerGists).setVisibility(View.GONE);
      }
    }
    @Override public void onFail(    RetrofitError error){
    }
  }
);
  orgsClient.execute();
}
Program: 163162
Project: 163162
Buggy source:
@Override public void onResponseOk(ListOrganizations organizations,Response r){
  textOrgs.setText(view.getContext().getString(R.string.orgs_num,organizations.size()));
}

Fixed version (ground truth):
@Override public void onResponseOk(ListOrganizations organizations,Response r){
  if (organizations != null && organizations.size() > 0) {
    textOrgs.setText(view.getContext().getString(R.string.orgs_num,organizations.size()));
  }
 else {
    view.findViewById(R.id.orgs).setVisibility(View.GONE);
    view.findViewById(R.id.dividerGists).setVisibility(View.GONE);
  }
}
Program: 163163
Project: 163163
Buggy source:
@Override public void onLoadingComplete(String imageUri,View view,Bitmap loadedImage){
  super.onLoadingComplete(imageUri,view,loadedImage);
  Palette.generateAsync(loadedImage,new PaletteListener(loadedImage,listener));
}

Fixed version (ground truth):
@Override public void onLoadingComplete(String imageUri,View view,final Bitmap loadedImage){
  super.onLoadingComplete(imageUri,view,loadedImage);
  new Palette.Builder(loadedImage).maximumColorCount(3).generate(new Palette.PaletteAsyncListener(){
    @Override public void onGenerated(    Palette palette){
      if (listener != null) {
        listener.onImageLoaded(loadedImage,palette);
      }
    }
  }
);
}
Program: 163164
Project: 163164
Buggy source:
public void loadImageAndPalette(String url,final PaletteUtilsListener listener){
  ImageLoader.getInstance().loadImage(url,new SimpleImageLoadingListener(){
    @Override public void onLoadingComplete(    String imageUri,    View view,    Bitmap loadedImage){
      super.onLoadingComplete(imageUri,view,loadedImage);
      Palette.generateAsync(loadedImage,new PaletteListener(loadedImage,listener));
    }
  }
);
}

Fixed version (ground truth):
public void loadImageAndPalette(String url,final PaletteUtilsListener listener){
  ImageLoader.getInstance().loadImage(url,new SimpleImageLoadingListener(){
    @Override public void onLoadingComplete(    String imageUri,    View view,    final Bitmap loadedImage){
      super.onLoadingComplete(imageUri,view,loadedImage);
      new Palette.Builder(loadedImage).maximumColorCount(3).generate(new Palette.PaletteAsyncListener(){
        @Override public void onGenerated(        Palette palette){
          if (listener != null) {
            listener.onImageLoaded(loadedImage,palette);
          }
        }
      }
);
    }
  }
);
}
Program: 163165
Project: 163165
Buggy source:
@Override public void onResponseOk(ListContributors contributors,Response r){
  List<User> users=new ArrayList<User>(contributors.size());
  User cleanUser=new User();
  cleanUser.login="String_Node_Str";
  users.add(cleanUser);
  for (  Contributor contributor : contributors) {
    users.add(contributor.author);
  }
  assigneesAdapter=new UsersAdapterSpinner(NewIssueActivity.this,users);
  spinnerAssignee.setAdapter(assigneesAdapter);
}

Fixed version (ground truth):
@Override public void onResponseOk(ListContributors contributors,Response r){
  if (contributors != null) {
    List<User> users=new ArrayList<User>(contributors.size());
    User cleanUser=new User();
    cleanUser.login="String_Node_Str";
    users.add(cleanUser);
    for (    Contributor contributor : contributors) {
      users.add(contributor.author);
    }
    assigneesAdapter=new UsersAdapterSpinner(NewIssueActivity.this,users);
    spinnerAssignee.setAdapter(assigneesAdapter);
  }
}
Program: 163166
Project: 163166
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  if (!fromSearch) {
switch (item.getItemId()) {
case R.id.issue_list_filter_open:
      currentState=IssueState.open;
    issuesAdapter.clear();
  onRefresh();
break;
case R.id.issue_list_filter_closed:
currentState=IssueState.closed;
issuesAdapter.clear();
onRefresh();
break;
case R.id.issue_list_filter_search:
Intent intent=SearchIssuesActivity.launchIntent(getActivity(),repoInfo);
startActivity(intent);
break;
}
}
return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  if (!fromSearch) {
switch (item.getItemId()) {
case R.id.issue_list_filter_open:
      currentState=IssueState.open;
    if (issuesAdapter != null) {
      issuesAdapter.clear();
    }
  onRefresh();
break;
case R.id.issue_list_filter_closed:
currentState=IssueState.closed;
if (issuesAdapter != null) {
issuesAdapter.clear();
}
onRefresh();
break;
case R.id.issue_list_filter_search:
Intent intent=SearchIssuesActivity.launchIntent(getActivity(),repoInfo);
startActivity(intent);
break;
}
}
return super.onOptionsItemSelected(item);
}
Program: 163167
Project: 163167
Buggy source:
@Override public void onResponseOk(ListIssues issues,Response r){
  super.onResponseOk(issues,r);
  if (issues == null || issues.size() == 0 && (issuesAdapter == null || issuesAdapter.getCount() == 0)) {
    setEmpty();
  }
}

Fixed version (ground truth):
@Override public void onResponseOk(ListIssues issues,Response r){
  super.onResponseOk(issues,r);
  if (refreshing) {
    if (issuesAdapter != null) {
      issuesAdapter.clear();
    }
  }
  if (issues == null || issues.size() == 0 && (issuesAdapter == null || issuesAdapter.getCount() == 0)) {
    setEmpty();
  }
}
Program: 163168
Project: 163168
Buggy source:
@Override public void onNotificationRequested(){
  setTitle(R.string.notifications);
  setFragment(NotificationsFragment.newInstance());
}

Fixed version (ground truth):
@Override public void onNotificationRequested(){
  setTitle(R.string.notifications);
  if (notificationsFragment == null) {
    notificationsFragment=NotificationsFragment.newInstance();
  }
  setFragment(notificationsFragment,true);
}