nus-yam/ex-repair huggingface dataset:
Program: 163169
Project: 163169
Buggy source:
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  if (getToolbar() != null) {
    getToolbar().inflateMenu(R.menu.main_menu);
    MenuItem notificationsItem=menu.findItem(R.id.action_notifications);
    notificationProvider=(NotificationsActionProvider)MenuItemCompat.getActionProvider(notificationsItem);
    notificationProvider.setOnNotificationListener(this);
    bus.register(notificationProvider);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  if (getToolbar() != null) {
    getToolbar().inflateMenu(R.menu.main_menu);
    MenuItem notificationsItem=menu.findItem(R.id.action_notifications);
    notificationProvider=(NotificationsActionProvider)MenuItemCompat.getActionProvider(notificationsItem);
    if (notificationProvider != null) {
      notificationProvider.setOnNotificationListener(this);
    }
    bus.register(notificationProvider);
  }
  return true;
}
Program: 163170
Project: 163170
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  View v=mInflater.inflate(R.layout.notification_row,parent,false);
  final Notification item=getItem(position);
  v.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      bus.post(item);
    }
  }
);
  TextView text=(TextView)v.findViewById(R.id.text);
  text.setText(item.subject.title);
  ImageView iv=(ImageView)v.findViewById(R.id.clearNotifications);
  iv.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      PopupMenu popupMenu=new PopupMenu(v.getContext(),v);
      popupMenu.inflate(R.menu.notifications_row_menu);
      popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener(){
        @Override public boolean onMenuItemClick(        MenuItem menuItem){
switch (menuItem.getItemId()) {
case R.id.action_notification_unsubscribe:
            bus.post(new UnsubscribeThreadNotification(item));
          break;
case R.id.action_notification_mark_read:
        bus.post(new ClearNotification(item,false));
      break;
  }
  return true;
}
}
);
popupMenu.show();
}
}
);
return v;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  View v=mInflater.inflate(R.layout.notification_row,parent,false);
  final Notification item=getItem(position);
  v.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      if (bus != null && item != null) {
        bus.post(item);
      }
    }
  }
);
  TextView text=(TextView)v.findViewById(R.id.text);
  text.setText(item.subject.title);
  ImageView iv=(ImageView)v.findViewById(R.id.clearNotifications);
  iv.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      PopupMenu popupMenu=new PopupMenu(v.getContext(),v);
      popupMenu.inflate(R.menu.notifications_row_menu);
      popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener(){
        @Override public boolean onMenuItemClick(        MenuItem menuItem){
switch (menuItem.getItemId()) {
case R.id.action_notification_unsubscribe:
            bus.post(new UnsubscribeThreadNotification(item));
          break;
case R.id.action_notification_mark_read:
        bus.post(new ClearNotification(item,false));
      break;
  }
  return true;
}
}
);
popupMenu.show();
}
}
);
return v;
}
Program: 163171
Project: 163171
Buggy source:
@Override public void onBindViewHolder(Holder holder,int position){
  if (position == 0) {
    ((IssueHolder)holder).issueDetailView.setIssue(issueStory.issue);
  }
 else   if (holder instanceof CommentHolder) {
    IssueStoryComment issueStoryDetail=(IssueStoryComment)issueStory.details.get(position - 1).second;
    ((CommentHolder)holder).issueCommentView.setComment(issueStoryDetail);
  }
 else   if (holder instanceof TimelineHolder) {
    IssueStoryEvent issueStoryDetail=(IssueStoryEvent)issueStory.details.get(position - 1).second;
    ((TimelineHolder)holder).issueTimelineView.setLastItem((position + 1) == getItemCount());
    ((TimelineHolder)holder).issueTimelineView.setIssueEvent(issueStoryDetail);
  }
 else {
    IssueStoryDetail issueStoryDetail=issueStory.details.get(position - 1).second;
    if (issueStoryDetail instanceof IssueStoryEvent) {
      holder.text.setText(((IssueStoryEvent)issueStoryDetail).event.event);
    }
  }
}

Fixed version (ground truth):
@Override public void onBindViewHolder(Holder holder,int position){
  if (position == 0) {
    ((IssueHolder)holder).issueDetailView.setIssue(issueStory.issue);
  }
 else   if (holder instanceof CommentHolder) {
    IssueStoryComment issueStoryDetail=(IssueStoryComment)issueStory.details.get(position - 1).second;
    ((CommentHolder)holder).issueCommentView.setComment(issueStoryDetail);
  }
 else   if (holder instanceof TimelineHolder) {
    if (issueStory.details.get(position - 1).second instanceof IssueStoryEvent) {
      IssueStoryEvent issueStoryDetail=(IssueStoryEvent)issueStory.details.get(position - 1).second;
      ((TimelineHolder)holder).issueTimelineView.setLastItem((position + 1) == getItemCount());
      ((TimelineHolder)holder).issueTimelineView.setIssueEvent(issueStoryDetail);
    }
  }
 else {
    IssueStoryDetail issueStoryDetail=issueStory.details.get(position - 1).second;
    if (issueStoryDetail instanceof IssueStoryEvent) {
      holder.text.setText(((IssueStoryEvent)issueStoryDetail).event.event);
    }
  }
}
Program: 163172
Project: 163172
Buggy source:
@Override public void onResponseOk(final String s,Response r){
  webView.clearCache(true);
  webView.clearFormData();
  webView.clearHistory();
  webView.clearMatches();
  webView.clearSslPreferences();
  webView.getSettings().setUseWideViewPort(false);
  webView.setBackgroundColor(getResources().getColor(R.color.gray_github_light));
  webView.loadDataWithBaseURL("String_Node_Str",s,"String_Node_Str","String_Node_Str",null);
}

Fixed version (ground truth):
@Override public void onResponseOk(final String s,Response r){
  if (getActivity() != null && isAdded()) {
    webView.clearCache(true);
    webView.clearFormData();
    webView.clearHistory();
    webView.clearMatches();
    webView.clearSslPreferences();
    webView.getSettings().setUseWideViewPort(false);
    webView.setBackgroundColor(getResources().getColor(R.color.gray_github_light));
    webView.loadDataWithBaseURL("String_Node_Str",s,"String_Node_Str","String_Node_Str",null);
  }
}
Program: 163173
Project: 163173
Buggy source:
private void navigateUp(){
  currentSelectedContent=currentSelectedContent.parent;
  if (currentSelectedContent != null) {
    if (treeContent.get(currentSelectedContent) != null) {
      displayContent(treeContent.get(currentSelectedContent));
    }
  }
 else {
    getActivity().finish();
  }
}

Fixed version (ground truth):
private void navigateUp(){
  currentSelectedContent=currentSelectedContent.parent;
  if (currentSelectedContent != null) {
    if (treeContent.get(currentSelectedContent) != null) {
      displayContent(treeContent.get(currentSelectedContent));
    }
  }
}
Program: 163174
Project: 163174
Buggy source:
public void showNotificationBubble(boolean show){
  this.show=show;
  int start=show ? 0 : 16;
  int end=show ? 16 : 0;
  animator=ValueAnimator.ofInt(start,end);
  animator.setDuration(animationDuration);
  animator.setInterpolator(show ? new BounceInterpolator() : new AccelerateDecelerateInterpolator());
  animator.addUpdateListener(this);
  animator.start();
  this.postInvalidate();
}

Fixed version (ground truth):
public void showNotificationBubble(boolean show){
  this.show=show;
  int start=show ? 0 : getSize();
  int end=show ? getSize() : 0;
  animator=ValueAnimator.ofInt(start,end);
  animator.setDuration(animationDuration);
  animator.setInterpolator(show ? new BounceInterpolator() : new AccelerateDecelerateInterpolator());
  animator.addUpdateListener(this);
  animator.start();
  this.postInvalidate();
}
Program: 163175
Project: 163175
Buggy source:
private void showDialog(){
  try {
    progressDialog=new SpotsDialog(this,R.style.SpotDialog_Login);
    progressDialog.setCancelable(false);
    progressDialog.setCanceledOnTouchOutside(false);
    progressDialog.show();
  }
 catch (  Exception e) {
    e.printStackTrace();
    Crashlytics.logException(e);
  }
}

Fixed version (ground truth):
private void showDialog(){
  try {
    progressDialog=new SpotsDialog(this,R.style.SpotDialog_Login);
    progressDialog.setCancelable(false);
    progressDialog.setCanceledOnTouchOutside(false);
    progressDialog.show();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 163176
Project: 163176
Buggy source:
private void showDialog(){
  try {
    progressDialog=new SpotsDialog(this,R.style.SpotDialog_CreatingIssue);
    progressDialog.setCancelable(false);
    progressDialog.setCanceledOnTouchOutside(false);
    progressDialog.show();
  }
 catch (  Exception e) {
    e.printStackTrace();
    Crashlytics.logException(e);
  }
}

Fixed version (ground truth):
private void showDialog(){
  try {
    progressDialog=new SpotsDialog(this,R.style.SpotDialog_CreatingIssue);
    progressDialog.setCancelable(false);
    progressDialog.setCanceledOnTouchOutside(false);
    progressDialog.show();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 163177
Project: 163177
Buggy source:
private void showDialog(){
  try {
    progressDialog=new SpotsDialog(this,R.style.SpotDialog_Login);
    progressDialog.setCancelable(false);
    progressDialog.setCanceledOnTouchOutside(false);
    progressDialog.show();
  }
 catch (  Exception e) {
    e.printStackTrace();
    Crashlytics.logException(e);
  }
}

Fixed version (ground truth):
private void showDialog(){
  try {
    progressDialog=new SpotsDialog(this,R.style.SpotDialog_Login);
    progressDialog.setCancelable(false);
    progressDialog.setCanceledOnTouchOutside(false);
    progressDialog.show();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 163178
Project: 163178
Buggy source:
private void showDialog(){
  try {
    progressDialog=new SpotsDialog(this,R.style.SpotDialog_CreatingIssue);
    progressDialog.setCancelable(false);
    progressDialog.setCanceledOnTouchOutside(false);
    progressDialog.show();
  }
 catch (  Exception e) {
    e.printStackTrace();
    Crashlytics.logException(e);
  }
}

Fixed version (ground truth):
private void showDialog(){
  try {
    progressDialog=new SpotsDialog(this,R.style.SpotDialog_CreatingIssue);
    progressDialog.setCancelable(false);
    progressDialog.setCanceledOnTouchOutside(false);
    progressDialog.show();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 163180
Project: 163180
Buggy source:
@Override protected void onResponse(ListGists gists,boolean refreshing){
  if (gists != null && gists.size() > 0) {
    if (gistsAdapter == null || refreshing) {
      gistsAdapter=new GistsAdapter(getActivity(),gists);
      setListAdapter(gistsAdapter);
    }
    if (gistsAdapter.isLazyLoading()) {
      if (gistsAdapter != null) {
        gistsAdapter.setLazyLoading(false);
        gistsAdapter.addAll(gists);
      }
    }
    if (gistsAdapter != null) {
      setListAdapter(gistsAdapter);
    }
  }
}

Fixed version (ground truth):
@Override protected void onResponse(ListGists gists,boolean refreshing){
  if (gists != null && gists.size() > 0) {
    if (gistsAdapter == null || refreshing) {
      gistsAdapter=new GistsAdapter(getActivity(),gists);
      setListAdapter(gistsAdapter);
    }
    if (gistsAdapter.isLazyLoading()) {
      if (gistsAdapter != null) {
        gistsAdapter.setLazyLoading(false);
        gistsAdapter.addAll(gists);
      }
    }
 else {
      setListAdapter(gistsAdapter);
    }
  }
}
Program: 163181
Project: 163181
Buggy source:
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  setupListView(view);
  progressBar=(SmoothProgressBar)view.findViewById(R.id.progress);
  emptyIcon=(ImageView)view.findViewById(R.id.emptyIcon);
  emptyText=(TextView)view.findViewById(R.id.emptyText);
  emptyLy=view.findViewById(R.id.emptyLayout);
  fab=(FloatingActionButton)view.findViewById(R.id.fabButton);
  loadArguments();
  checkFAB();
  swipe=(SwipeRefreshLayout)view.findViewById(R.id.swipe);
  executeRequest();
}

Fixed version (ground truth):
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  setupListView(view);
  progressBar=(SmoothProgressBar)view.findViewById(R.id.progress);
  emptyIcon=(ImageView)view.findViewById(R.id.emptyIcon);
  emptyText=(TextView)view.findViewById(R.id.emptyText);
  emptyLy=view.findViewById(R.id.emptyLayout);
  fab=(FloatingActionButton)view.findViewById(R.id.fabButton);
  loadArguments();
  checkFAB();
  swipe=(SwipeRefreshLayout)view.findViewById(R.id.swipe);
  swipe.setOnRefreshListener(this);
  executeRequest();
}
Program: 163182
Project: 163182
Buggy source:
private void displayContent(ListContents contents){
  if (contents != null) {
    try {
      ListContents currentContents=treeContent.get(currentSelectedContent);
      Context context=getActivity();
      int style=R.style.AppTheme_Repos;
      if (currentContents == null) {
        int size=contents.size() + (currentSelectedContent.parent != null ? 1 : 0);
        currentContents=new ListContents(size);
        treeContent.put(currentSelectedContent,currentContents);
        if (currentSelectedContent.parent != null) {
          Content up=new UpContent();
          up.parent=currentSelectedContent.parent;
          currentContents.add(up);
        }
        Collections.sort(contents,ListContents.SORT.TYPE);
        currentContents.addAll(contents);
        contentAdapter=new RepoSourceAdapter(context,currentContents,style);
      }
 else {
        contentAdapter=new RepoSourceAdapter(context,contents,style);
      }
      setListAdapter(contentAdapter);
      if (refreshListener != null) {
        refreshListener.cancelRefresh();
      }
    }
 catch (    Exception e) {
      Crashlytics.logException(e);
    }
  }
}

Fixed version (ground truth):
private void displayContent(ListContents contents){
  if (getActivity() != null && contents != null) {
    try {
      ListContents currentContents=treeContent.get(currentSelectedContent);
      Context context=getActivity();
      int style=R.style.AppTheme_Repos;
      if (currentContents == null) {
        int size=contents.size() + (currentSelectedContent.parent != null ? 1 : 0);
        currentContents=new ListContents(size);
        treeContent.put(currentSelectedContent,currentContents);
        if (currentSelectedContent.parent != null) {
          Content up=new UpContent();
          up.parent=currentSelectedContent.parent;
          currentContents.add(up);
        }
        Collections.sort(contents,ListContents.SORT.TYPE);
        currentContents.addAll(contents);
        contentAdapter=new RepoSourceAdapter(context,currentContents,style);
      }
 else {
        contentAdapter=new RepoSourceAdapter(context,contents,style);
      }
      setListAdapter(contentAdapter);
      if (refreshListener != null) {
        refreshListener.cancelRefresh();
      }
    }
 catch (    Exception e) {
      Crashlytics.logException(e);
    }
  }
}
Program: 163183
Project: 163183
Buggy source:
public static SearchReposFragment newInstance(String query){
  Bundle args=Bundle.EMPTY;
  args.putString(SearchManager.QUERY,query);
  SearchReposFragment f=new SearchReposFragment();
  f.setArguments(args);
  return f;
}

Fixed version (ground truth):
public static SearchReposFragment newInstance(String query){
  Bundle args=new Bundle();
  if (query != null) {
    args.putString(SearchManager.QUERY,query);
  }
  SearchReposFragment f=new SearchReposFragment();
  f.setArguments(args);
  return f;
}
Program: 163184
Project: 163184
Buggy source:
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  view.setBackgroundColor(Color.WHITE);
  String query=getArguments().getString(SearchManager.QUERY);
  setQuery(query);
}

Fixed version (ground truth):
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  view.setBackgroundColor(Color.WHITE);
  String query=getArguments().getString(SearchManager.QUERY,null);
  if (query != null) {
    setQuery(query);
  }
 else {
    setEmpty();
  }
}
Program: 163185
Project: 163185
Buggy source:
@Override protected void onResponse(ListEvents githubEvents,boolean refreshing){
  if (githubEvents != null && githubEvents.size() > 0) {
    if (eventsAdapter == null || refreshing) {
      eventsAdapter=new EventAdapter(getActivity(),githubEvents);
      setListAdapter(eventsAdapter);
    }
    if (eventsAdapter.isLazyLoading()) {
      if (eventsAdapter != null) {
        eventsAdapter.setLazyLoading(false);
        eventsAdapter.addAll(githubEvents);
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void onResponse(ListEvents githubEvents,boolean refreshing){
  getListView().setDivider(null);
  if (githubEvents != null && githubEvents.size() > 0) {
    if (eventsAdapter == null || refreshing) {
      eventsAdapter=new EventAdapter(getActivity(),githubEvents);
      setListAdapter(eventsAdapter);
    }
    if (eventsAdapter.isLazyLoading()) {
      if (eventsAdapter != null) {
        eventsAdapter.setLazyLoading(false);
        eventsAdapter.addAll(githubEvents);
      }
    }
    if (eventsAdapter != null) {
      setListAdapter(eventsAdapter);
    }
  }
}
Program: 163186
Project: 163186
Buggy source:
@Override protected void onResponse(ListOrganizations organizations,boolean refreshing){
  if (adapter == null) {
    setUpList();
  }
  adapter.addAll(organizations,paging);
}

Fixed version (ground truth):
@Override protected void onResponse(ListOrganizations organizations,boolean refreshing){
  getListView().setDivider(null);
  if (getListAdapter() != null) {
    adapter.addAll(organizations,paging);
  }
 else   if (adapter == null) {
    setUpList(organizations);
  }
 else {
    setListAdapter(adapter);
  }
}
Program: 163187
Project: 163187
Buggy source:
private void setUpList(){
  adapter=new OrganizationsAdapter(getActivity(),new ArrayList<Organization>());
  setListAdapter(adapter);
  getListView().setDivider(null);
}

Fixed version (ground truth):
private void setUpList(ListOrganizations organizations){
  adapter=new OrganizationsAdapter(getActivity(),organizations);
  setListAdapter(adapter);
  getListView().setDivider(null);
}
Program: 163188
Project: 163188
Buggy source:
@Override protected void onResponse(ListRepos repos,boolean refreshing){
  if (repos.size() > 0) {
    if (reposAdapter == null) {
      setUpList();
    }
    reposAdapter.addAll(repos,paging);
  }
}

Fixed version (ground truth):
@Override protected void onResponse(ListRepos repos,boolean refreshing){
  getListView().setDivider(null);
  if (repos.size() > 0) {
    if (getListAdapter() != null) {
      reposAdapter.addAll(repos,paging);
    }
 else     if (reposAdapter == null) {
      setUpList(repos);
    }
 else {
      setListAdapter(reposAdapter);
    }
  }
}
Program: 163189
Project: 163189
Buggy source:
protected void setUpList(){
  reposAdapter=new ReposAdapter(getActivity(),new ArrayList<Repo>());
  getListView().setDivider(null);
  setListAdapter(reposAdapter);
  settings=new GitskariosSettings(getActivity());
  settings.registerListener(this);
}

Fixed version (ground truth):
protected void setUpList(ListRepos repos){
  settings=new GitskariosSettings(getActivity());
  settings.registerListener(this);
  reposAdapter=new ReposAdapter(getActivity(),repos);
  setListAdapter(reposAdapter);
}
Program: 163190
Project: 163190
Buggy source:
@Override protected void onResponse(ListUsers users,boolean refreshing){
  if (usersAdapter == null) {
    setUpList();
  }
  usersAdapter.addAll(users,paging);
}

Fixed version (ground truth):
@Override protected void onResponse(ListUsers users,boolean refreshing){
  getListView().setDivider(null);
  if (users.size() > 0) {
    if (getListAdapter() != null) {
      usersAdapter.addAll(users,paging);
    }
 else     if (usersAdapter == null) {
      setUpList(users);
    }
 else {
      setListAdapter(usersAdapter);
    }
  }
}
Program: 163191
Project: 163191
Buggy source:
private void setUpList(){
  usersAdapter=new UsersAdapter(getActivity(),new ArrayList<User>());
  setListAdapter(usersAdapter);
  getListView().setDivider(null);
}

Fixed version (ground truth):
private void setUpList(ListUsers users){
  usersAdapter=new UsersAdapter(getActivity(),users);
  setListAdapter(usersAdapter);
}
Program: 163192
Project: 163192
Buggy source:
@Override protected void onResponse(ListEvents githubEvents,boolean refreshing){
  if (githubEvents != null && githubEvents.size() > 0) {
    if (eventsAdapter == null || refreshing) {
      eventsAdapter=new EventAdapter(getActivity(),githubEvents);
      setListAdapter(eventsAdapter);
    }
    if (eventsAdapter.isLazyLoading()) {
      if (eventsAdapter != null) {
        eventsAdapter.setLazyLoading(false);
        eventsAdapter.addAll(githubEvents);
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void onResponse(ListEvents githubEvents,boolean refreshing){
  getListView().setDivider(null);
  if (githubEvents != null && githubEvents.size() > 0) {
    if (eventsAdapter == null || refreshing) {
      eventsAdapter=new EventAdapter(getActivity(),githubEvents);
      setListAdapter(eventsAdapter);
    }
    if (eventsAdapter.isLazyLoading()) {
      if (eventsAdapter != null) {
        eventsAdapter.setLazyLoading(false);
        eventsAdapter.addAll(githubEvents);
      }
    }
    if (eventsAdapter != null) {
      setListAdapter(eventsAdapter);
    }
  }
}
Program: 163193
Project: 163193
Buggy source:
@Override protected void onResponse(ListOrganizations organizations,boolean refreshing){
  if (adapter == null) {
    setUpList();
  }
  adapter.addAll(organizations,paging);
}

Fixed version (ground truth):
@Override protected void onResponse(ListOrganizations organizations,boolean refreshing){
  getListView().setDivider(null);
  if (getListAdapter() != null) {
    adapter.addAll(organizations,paging);
  }
 else   if (adapter == null) {
    setUpList(organizations);
  }
 else {
    setListAdapter(adapter);
  }
}
Program: 163194
Project: 163194
Buggy source:
private void setUpList(){
  adapter=new OrganizationsAdapter(getActivity(),new ArrayList<Organization>());
  setListAdapter(adapter);
  getListView().setDivider(null);
}

Fixed version (ground truth):
private void setUpList(ListOrganizations organizations){
  adapter=new OrganizationsAdapter(getActivity(),organizations);
  setListAdapter(adapter);
  getListView().setDivider(null);
}
Program: 163195
Project: 163195
Buggy source:
@Override protected void onResponse(ListRepos repos,boolean refreshing){
  if (repos.size() > 0) {
    if (reposAdapter == null) {
      setUpList();
    }
    reposAdapter.addAll(repos,paging);
  }
}

Fixed version (ground truth):
@Override protected void onResponse(ListRepos repos,boolean refreshing){
  getListView().setDivider(null);
  if (repos.size() > 0) {
    if (getListAdapter() != null) {
      reposAdapter.addAll(repos,paging);
    }
 else     if (reposAdapter == null) {
      setUpList(repos);
    }
 else {
      setListAdapter(reposAdapter);
    }
  }
}
Program: 163196
Project: 163196
Buggy source:
protected void setUpList(){
  reposAdapter=new ReposAdapter(getActivity(),new ArrayList<Repo>());
  getListView().setDivider(null);
  setListAdapter(reposAdapter);
  settings=new GitskariosSettings(getActivity());
  settings.registerListener(this);
}

Fixed version (ground truth):
protected void setUpList(ListRepos repos){
  settings=new GitskariosSettings(getActivity());
  settings.registerListener(this);
  reposAdapter=new ReposAdapter(getActivity(),repos);
  setListAdapter(reposAdapter);
}
Program: 163197
Project: 163197
Buggy source:
@Override protected void onResponse(ListUsers users,boolean refreshing){
  if (usersAdapter == null) {
    setUpList();
  }
  usersAdapter.addAll(users,paging);
}

Fixed version (ground truth):
@Override protected void onResponse(ListUsers users,boolean refreshing){
  getListView().setDivider(null);
  if (users.size() > 0) {
    if (getListAdapter() != null) {
      usersAdapter.addAll(users,paging);
    }
 else     if (usersAdapter == null) {
      setUpList(users);
    }
 else {
      setListAdapter(usersAdapter);
    }
  }
}
Program: 163198
Project: 163198
Buggy source:
private void setUpList(){
  usersAdapter=new UsersAdapter(getActivity(),new ArrayList<User>());
  setListAdapter(usersAdapter);
  getListView().setDivider(null);
}

Fixed version (ground truth):
private void setUpList(ListUsers users){
  usersAdapter=new UsersAdapter(getActivity(),users);
  setListAdapter(usersAdapter);
}
Program: 163199
Project: 163199
Buggy source:
private void findViews(){
  fabLayout=(FABCenterLayout)findViewById(R.id.fabLayout);
  fabLayout.setFabColor(getResources().getColor(R.color.accent));
  fabLayout.setFabColorPressed(getResources().getColor(R.color.primary_dark));
  GithubIconDrawable drawable=new GithubIconDrawable(this,GithubIconify.IconValue.octicon_comment_discussion).color(Color.WHITE).fabSize();
  fabLayout.setFabIcon(drawable);
  fabLayout.setFabClickListener(this,getString(R.string.add_comment));
  issueBody=(TextView)findViewById(R.id.issueBody);
}

Fixed version (ground truth):
private void findViews(){
  fabLayout=(FABCenterLayout)findViewById(R.id.fabLayout);
  fabLayout.setFabColor(getResources().getColor(R.color.accent));
  fabLayout.setFabColorPressed(getResources().getColor(R.color.primary_dark));
  GithubIconDrawable drawable=new GithubIconDrawable(this,GithubIconify.IconValue.octicon_comment_discussion).color(Color.WHITE).fabSize();
  fabLayout.setFabIcon(drawable);
  fabLayout.setFabClickListener(this,getString(R.string.add_comment));
  issueBody=(TextView)findViewById(R.id.issueBody);
  issueBody.setMaxLines(3);
  issueBody.setEllipsize(TextUtils.TruncateAt.END);
}
Program: 163200
Project: 163200
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  super.onOptionsItemSelected(item);
switch (item.getItemId()) {
case android.R.id.home:
    setResult(shouldRefreshOnBack ? RESULT_FIRST_USER : RESULT_OK);
  finish();
break;
case R.id.action_close_issue:
closeIssueDialog();
break;
case R.id.action_fold_issue:
fabLayout.setFold(!fabLayout.isFold());
invalidateOptionsMenu();
break;
}
return true;
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  super.onOptionsItemSelected(item);
switch (item.getItemId()) {
case android.R.id.home:
    setResult(shouldRefreshOnBack ? RESULT_FIRST_USER : RESULT_OK);
  finish();
break;
case R.id.action_close_issue:
closeIssueDialog();
break;
case R.id.action_fold_issue:
if (fabLayout.isFold()) {
issueBody.setMaxLines(Integer.MAX_VALUE);
issueBody.setEllipsize(null);
}
 else {
issueBody.setMaxLines(3);
issueBody.setEllipsize(TextUtils.TruncateAt.END);
}
fabLayout.setFold(!fabLayout.isFold());
invalidateOptionsMenu();
break;
}
return true;
}
Program: 163201
Project: 163201
Buggy source:
@Override public void onResponseOk(Issue issue,Response r){
  if (issue != null) {
    issueBody.setText(issue.body);
    IssueDetailActivity.this.issue=issue;
    IssueDetailActivity.this.issueState=issue.state;
    invalidateOptionsMenu();
    setData();
    Spanned issueNumber=Html.fromHtml(getString(R.string.issue_detail_title,issue.number));
    shouldRefreshOnBack=true;
  }
}

Fixed version (ground truth):
@Override public void onResponseOk(Issue issue,Response r){
  if (issue != null) {
    issueBody.setText(issue.body);
    IssueDetailActivity.this.issue=issue;
    IssueDetailActivity.this.issueState=issue.state;
    invalidateOptionsMenu();
    setData();
    shouldRefreshOnBack=true;
  }
}
Program: 163202
Project: 163202
Buggy source:
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  super.onLayout(changed,l,t,r,b);
  if (topView != null && fabVisible && fabView != null) {
    int bottom=topView.getBottom();
    if (bottom > 0) {
      int int16=getResources().getDimensionPixelOffset(R.dimen.gapLarge);
      fabView.layout(r - fabView.getWidth() - int16,bottom - fabView.getHeight() / 2,r - int16,bottom + fabView.getHeight() / 2);
      removeView(fabView);
      addView(fabView);
    }
  }
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  super.onLayout(changed,l,t,r,b);
  if (topView != null && fabVisible && fabView != null) {
    int bottom=topView.getBottom();
    if (bottom > 0) {
      int int16=getResources().getDimensionPixelOffset(R.dimen.gapLarge);
      fabView.layout(r - fabView.getWidth() - int16,bottom - fabView.getHeight() / 2,r - int16,bottom + fabView.getHeight() / 2);
      removeView(fabView);
      addView(fabView);
      ViewCompat.setElevation(fabView,6f);
    }
  }
}
Program: 163203
Project: 163203
Buggy source:
@Override public void addView(View child,int index,ViewGroup.LayoutParams params){
  super.addView(child,index,params);
  if (child.getId() == scrollableId) {
    scrolledChild=child;
    addChildScrollListener(scrolledChild);
  }
 else   if (child.getId() == topId) {
    topView=child;
  }
 else {
    View viewTop=child.findViewById(topId);
    if (viewTop != null) {
      topView=viewTop;
      ViewCompat.setElevation(topView,4f);
    }
    View viewScroll=child.findViewById(scrollableId);
    if (viewScroll != null) {
      scrolledChild=viewScroll;
    }
  }
}

Fixed version (ground truth):
@Override public void addView(View child,int index,ViewGroup.LayoutParams params){
  super.addView(child,index,params);
  if (child.getId() == scrollableId) {
    scrolledChild=child;
    addChildScrollListener(scrolledChild);
  }
 else   if (child.getId() == topId) {
    topView=child;
  }
 else {
    View viewTop=child.findViewById(topId);
    if (viewTop != null) {
      topView=viewTop;
    }
    View viewScroll=child.findViewById(scrollableId);
    if (viewScroll != null) {
      scrolledChild=viewScroll;
    }
  }
}
Program: 163204
Project: 163204
Buggy source:
private void animFold(int finalValue){
  ValueAnimator animator=ValueAnimator.ofInt(topView.getMeasuredHeight(),finalValue);
  animator.addUpdateListener(new TopFoldAnimatorListener(topView));
  animator.setDuration(FOLD_DURATION);
  animator.start();
}

Fixed version (ground truth):
private void animFold(int finalValue){
  ValueAnimator animator=ValueAnimator.ofInt(topView.getMeasuredHeight(),finalValue);
  animator.addUpdateListener(new TopFoldAnimatorListener(topView));
  animator.setDuration(FOLD_DURATION);
  animator.setInterpolator(new AccelerateDecelerateInterpolator());
  animator.start();
}
Program: 163205
Project: 163205
Buggy source:
public void setEmpty(){
  if (emptyText != null && emptyIcon != null) {
    if (getNoDataIcon() != null && getNoDataText() > 0) {
      IconDrawable iconDrawable=new IconDrawable(getActivity(),getNoDataIcon());
      iconDrawable.colorRes(R.color.gray_github_medium);
      emptyIcon.setImageDrawable(iconDrawable);
      emptyText.setText(getNoDataText());
      emptyLy.setVisibility(View.VISIBLE);
    }
  }
}

Fixed version (ground truth):
public void setEmpty(){
  if (getActivity() != null) {
    if (emptyText != null && emptyIcon != null) {
      if (getNoDataIcon() != null && getNoDataText() > 0) {
        IconDrawable iconDrawable=new IconDrawable(getActivity(),getNoDataIcon());
        iconDrawable.colorRes(R.color.gray_github_medium);
        emptyIcon.setImageDrawable(iconDrawable);
        emptyText.setText(getNoDataText());
        emptyLy.setVisibility(View.VISIBLE);
      }
    }
  }
}
Program: 163206
Project: 163206
Buggy source:
public IssueInfo(Parcel in){
  super(in);
  num=in.readInt();
}

Fixed version (ground truth):
public IssueInfo(Parcel in){
  owner=in.readString();
  repo=in.readString();
  num=in.readInt();
}
Program: 163207
Project: 163207
Buggy source:
@Override public void writeToParcel(Parcel dest,int flags){
  super.writeToParcel(dest,flags);
  dest.writeInt(num);
}

Fixed version (ground truth):
@Override public void writeToParcel(Parcel dest,int flags){
  dest.writeString(owner);
  dest.writeString(repo);
  dest.writeInt(num);
}
Program: 163208
Project: 163208
Buggy source:
public RepoInfo(Parcel in){
  super(in);
  repo=in.readString();
}

Fixed version (ground truth):
public RepoInfo(Parcel in){
  owner=in.readString();
  repo=in.readString();
}
Program: 163209
Project: 163209
Buggy source:
@Override public void writeToParcel(Parcel dest,int flags){
  super.writeToParcel(dest,flags);
  dest.writeString(repo);
}

Fixed version (ground truth):
@Override public void writeToParcel(Parcel dest,int flags){
  dest.writeString(owner);
  dest.writeString(repo);
}
Program: 163210
Project: 163210
Buggy source:
@Override public void onFail(RetrofitError error){
  stopRefresh();
  setEmpty();
  ErrorHandler.onRetrofitError(getActivity(),this.getClass().getSimpleName(),error);
}

Fixed version (ground truth):
@Override public void onFail(RetrofitError error){
  stopRefresh();
  if (getListAdapter() == null || getListAdapter().getCount() == 0) {
    setEmpty();
  }
  ErrorHandler.onRetrofitError(getActivity(),"String_Node_Str",error);
}
Program: 163211
Project: 163211
Buggy source:
@Override public void onResponseOk(K k,Response r){
  if (getActivity() != null && isAdded()) {
    stopRefresh();
    if (!paging && k != null && k instanceof List) {
      if (emptyLy != null && ((List)k).size() > 0) {
        emptyLy.setVisibility(View.GONE);
        getLinkData(r);
        onResponse(k,refreshing);
      }
 else {
        setEmpty();
      }
    }
 else {
      setEmpty();
    }
  }
}

Fixed version (ground truth):
@Override public void onResponseOk(K k,Response r){
  if (getActivity() != null && isAdded()) {
    stopRefresh();
    if (k != null && k instanceof List) {
      if (emptyLy != null && ((List)k).size() > 0) {
        emptyLy.setVisibility(View.GONE);
        getLinkData(r);
        onResponse(k,refreshing);
        paging=false;
        refreshing=false;
      }
 else {
        setEmpty();
      }
    }
 else {
      setEmpty();
    }
  }
}
Program: 163212
Project: 163212
Buggy source:
@Override protected Iconify.IconValue getNoDataIcon(){
  return null;
}

Fixed version (ground truth):
@Override protected Iconify.IconValue getNoDataIcon(){
  return Iconify.IconValue.fa_info_circle;
}
Program: 163213
Project: 163213
Buggy source:
@Override protected int getNoDataText(){
  return 0;
}

Fixed version (ground truth):
@Override protected int getNoDataText(){
  return R.string.no_issues_found;
}
Program: 163214
Project: 163214
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Tracker t=((GistsApplication)getApplication()).getTracker();
  t.setScreenName(this.getClass().getSimpleName());
  t.send(new HitBuilders.AppViewBuilder().build());
  BugSenseHandler.initAndStartSession(BaseActivity.this,"String_Node_Str");
  ImageLoader.getInstance().init(UniversalImageLoaderUtils.getImageLoaderConfiguration(this));
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (!BuildConfig.DEBUG) {
    Tracker t=((GistsApplication)getApplication()).getTracker();
    t.setScreenName(this.getClass().getSimpleName());
    t.send(new HitBuilders.AppViewBuilder().build());
    BugSenseHandler.initAndStartSession(BaseActivity.this,"String_Node_Str");
    ImageLoader.getInstance().init(UniversalImageLoaderUtils.getImageLoaderConfiguration(this));
  }
}
Program: 163215
Project: 163215
Buggy source:
private void setUpFromPaletteItem(PaletteItem paletteItem){
  this.usedPalette=paletteItem;
  int rgb=getResources().getColor(R.color.accent);
  if (paletteItem != null && paletteItem.getRgb() != 0x000000) {
    rgb=paletteItem.getRgb();
  }
  if (getActivity().getActionBar() != null) {
    animateChange(rgb);
  }
  avatarImage.setBorderColor(rgb);
  selectButton(null);
  mailText.setPrefixColor(rgb);
  blogText.setPrefixColor(rgb);
  joinedText.setPrefixColor(rgb);
}

Fixed version (ground truth):
private void setUpFromPaletteItem(PaletteItem paletteItem){
  if (isAdded()) {
    this.usedPalette=paletteItem;
    int rgb=getResources().getColor(R.color.accent);
    if (paletteItem != null && paletteItem.getRgb() != 0x000000) {
      rgb=paletteItem.getRgb();
    }
    if (getActivity().getActionBar() != null) {
      animateChange(rgb);
    }
    avatarImage.setBorderColor(rgb);
    selectButton(null);
    mailText.setPrefixColor(rgb);
    blogText.setPrefixColor(rgb);
    joinedText.setPrefixColor(rgb);
  }
}
Program: 163216
Project: 163216
Buggy source:
@Override public void onResponseOk(ListContents contents,Response r){
  if (contentAdapter == null) {
    contentAdapter=new RepoContentAdapter(getActivity(),new ArrayList<Content>());
    setListAdapter(contentAdapter);
  }
  Collections.sort(contents,ListContents.SORT.TYPE);
  contentAdapter.clear();
  contentAdapter.addAll(contents);
}

Fixed version (ground truth):
@Override public void onResponseOk(ListContents contents,Response r){
  try {
    if (contentAdapter == null) {
      contentAdapter=new RepoContentAdapter(getActivity(),new ArrayList<Content>());
      setListAdapter(contentAdapter);
    }
    Collections.sort(contents,ListContents.SORT.TYPE);
    contentAdapter.clear();
    contentAdapter.addAll(contents);
  }
 catch (  Exception e) {
    BugSenseHandler.addCrashExtraData("String_Node_Str",e.getMessage());
    BugSenseHandler.flush(getActivity());
  }
}
Program: 163217
Project: 163217
Buggy source:
private boolean validateAllValues(Object[] objectRow){
  if (conversions != null && conversions.validatedIndexes != null) {
    boolean keepRow=true;
    for (int i=0; keepRow && i < conversions.validatedIndexes.length; i++) {
      int index=conversions.validatedIndexes[i];
      try {
        Object value=index < objectRow.length ? objectRow[i] : null;
        conversions.executeValidations(index,value);
      }
 catch (      Throwable ex) {
        keepRow=handleConversionError(ex,objectRow,index);
      }
    }
    return keepRow;
  }
  return true;
}

Fixed version (ground truth):
private boolean validateAllValues(Object[] objectRow){
  if (conversions != null && conversions.validatedIndexes != null) {
    boolean keepRow=true;
    for (int i=0; keepRow && i < conversions.validatedIndexes.length; i++) {
      int index=conversions.validatedIndexes[i];
      try {
        Object value=index < objectRow.length ? objectRow[index] : null;
        conversions.executeValidations(index,value);
      }
 catch (      Throwable ex) {
        keepRow=handleConversionError(ex,objectRow,index);
      }
    }
    return keepRow;
  }
  return true;
}
Program: 163218
Project: 163218
Buggy source:
@Test(expectedExceptions=DataValidationException.class) public void testValidationAnnotation(){
  List<A> list=new CsvRoutines().parseAll(A.class,new StringReader("String_Node_Str"));
  System.out.println(list);
}

Fixed version (ground truth):
@Test public void testValidationAnnotation(){
  CsvParserSettings settings=new CsvParserSettings();
  final boolean[] ran=new boolean[]{false};
  settings.setProcessorErrorHandler(new ProcessorErrorHandler<Context>(){
    @Override public void handleError(    DataProcessingException error,    Object[] inputRow,    Context context){
      assertEquals(error.getColumnIndex(),2);
      assertEquals(inputRow[2],"String_Node_Str");
      ran[0]=true;
    }
  }
);
  new CsvRoutines(settings).parseAll(A.class,new StringReader("String_Node_Str"));
  assertTrue(ran[0]);
}
Program: 163219
Project: 163219
Buggy source:
/** 
 * Goes through a list of objects and associates each value to a particular field of a java bean instance
 * @param instance the java bean instance that is going to have its properties set
 * @param row      the values to associate with each field of the javabean.
 * @param context  information about the current parsing process.
 */
void mapValuesToFields(T instance,Object[] row,Context context){
  if (row.length > lastFieldIndexMapped) {
    this.lastFieldIndexMapped=row.length;
    mapFieldIndexes(context,row,context.headers(),context.extractedFieldIndexes(),context.columnsReordered());
  }
  int last=row.length < readOrder.length ? row.length : readOrder.length;
  int i=0;
  for (; i < last; i++) {
    FieldMapping field=readOrder[i];
    if (field != null) {
      Object value=row[i];
      field.write(instance,value);
    }
  }
  if (missing != null) {
    for (i=0; i < missing.length; i++) {
      Object value=valuesForMissing[i];
      if (value != null) {
        FieldMapping field=missing[i];
        field.write(instance,value);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Goes through a list of objects and associates each value to a particular field of a java bean instance
 * @param instance the java bean instance that is going to have its properties set
 * @param row      the values to associate with each field of the javabean.
 * @param context  information about the current parsing process.
 */
void mapValuesToFields(T instance,Object[] row,Context context){
  if (row.length > lastFieldIndexMapped) {
    this.lastFieldIndexMapped=row.length;
    mapFieldIndexes(context,row,context.headers(),context.extractedFieldIndexes(),context.columnsReordered());
  }
  int last=row.length < readOrder.length ? row.length : readOrder.length;
  int i=0;
  for (; i < last; i++) {
    FieldMapping field=readOrder[i];
    if (field != null) {
      Object value=row[i];
      field.write(instance,value);
    }
  }
  if (row.length < readOrder.length) {
    i=last;
    for (; i < readOrder.length; i++) {
      FieldMapping field=readOrder[i];
      if (field != null) {
        Object value=conversions.applyConversions(i,null,null);
        field.write(instance,value);
      }
    }
  }
  if (missing != null) {
    for (i=0; i < missing.length; i++) {
      Object value=valuesForMissing[i];
      if (value != null) {
        FieldMapping field=missing[i];
        field.write(instance,value);
      }
    }
  }
}
Program: 163220
Project: 163220
Buggy source:
/** 
 * Defines whether fields selected using the field selection methods (defined by the parent class   {@link CommonSettings}) should be reordered (defaults to true). <p>When disabled, each parsed record will contain values for all columns, in the order they occur in the input. Fields which were not selected will not be parsed but and the record will contain empty values. <p>When enabled, each parsed record will contain values only for the selected columns. The values will be ordered according to the selection.
 * @param columnReorderingEnabled the flag indicating whether or not selected fields should be reordered and returned by the parser
 */
public void setColumnReorderingEnabled(boolean columnReorderingEnabled){
  if (columnReorderingEnabled && preventReordering()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.columnReorderingEnabled=columnReorderingEnabled;
}

Fixed version (ground truth):
/** 
 * Defines whether fields selected using the field selection methods (defined by the parent class   {@link CommonSettings}) should be reordered (defaults to true). <p>When disabled, each parsed record will contain values for all columns, in the order they occur in the input. Fields which were not selected will not be parsed but the record will contain empty values. <p>When enabled, each parsed record will contain values only for the selected columns. The values will be ordered according to the selection.
 * @param columnReorderingEnabled the flag indicating whether or not selected fields should be reordered and returned by the parser
 */
public void setColumnReorderingEnabled(boolean columnReorderingEnabled){
  if (columnReorderingEnabled && preventReordering()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.columnReorderingEnabled=columnReorderingEnabled;
}
Program: 163221
Project: 163221
Buggy source:
/** 
 * Initializes the ParserOutput with the configuration specified in   {@link CommonParserSettings}
 * @param parser   the parser whose output will be managed by this class.
 * @param settings the parser configuration
 */
public ParserOutput(AbstractParser<?> parser,CommonParserSettings<?> settings){
  this.parser=parser;
  this.appenderInstance=settings.newCharAppender();
  this.appender=appenderInstance;
  this.parsedValues=new String[settings.getMaxColumns()];
  this.appenders=new CharAppender[settings.getMaxColumns() + 1];
  Arrays.fill(appenders,appender);
  this.settings=settings;
  this.skipEmptyLines=settings.getSkipEmptyLines();
  this.nullValue=settings.getNullValue();
  this.columnsToExtractInitialized=false;
  this.currentRecord=0;
  if (settings.getHeaders() != null) {
    initializeHeaders();
  }
}

Fixed version (ground truth):
/** 
 * Initializes the ParserOutput with the configuration specified in   {@link CommonParserSettings}
 * @param parser   the parser whose output will be managed by this class.
 * @param settings the parser configuration
 */
public ParserOutput(AbstractParser<?> parser,CommonParserSettings<?> settings){
  this.parser=parser;
  this.appenderInstance=settings.newCharAppender();
  this.appender=appenderInstance;
  this.parsedValues=new String[settings.getMaxColumns()];
  this.appenders=new CharAppender[settings.getMaxColumns() + 1];
  Arrays.fill(appenders,appender);
  this.settings=settings;
  this.skipEmptyLines=settings.getSkipEmptyLines();
  this.nullValue=settings.getNullValue();
  this.columnsToExtractInitialized=false;
  this.currentRecord=0;
  if (settings.getHeaders() != null) {
    initializeHeaders();
  }
  this.columnReorderingEnabledSetting=settings.isColumnReorderingEnabled();
}