nus-yam/ex-repair huggingface dataset:
Program: 13573
Project: 13573
Buggy source:
@Override protected void onBindView(@NonNull View view){
  super.onBindView(view);
  TextView titleView=(TextView)view.findViewById(android.R.id.title);
  if (titleView != null) {
    Resources res=getContext().getResources();
    titleView.setTextSize(TypedValue.COMPLEX_UNIT_PX,res.getDimensionPixelSize(R.dimen.text_sz_large));
    titleView.setTextColor(res.getColor(isEnabled() ? R.color.grey_dark : R.color.grey_lighten_10));
    if (!TextUtils.isEmpty(getDependency())) {
      titleView.setPadding(res.getDimensionPixelSize(R.dimen.margin_large),0,0,0);
    }
  }
}

Fixed version (ground truth):
@Override protected void onBindView(@NonNull View view){
  super.onBindView(view);
  TextView titleView=(TextView)view.findViewById(android.R.id.title);
  if (titleView != null) {
    Resources res=getContext().getResources();
    titleView.setTextSize(TypedValue.COMPLEX_UNIT_PX,res.getDimensionPixelSize(R.dimen.text_sz_large));
    titleView.setTextColor(res.getColor(isEnabled() ? R.color.grey_dark : R.color.grey_lighten_10));
    if (!TextUtils.isEmpty(getDependency())) {
      ViewCompat.setPaddingRelative(titleView,res.getDimensionPixelSize(R.dimen.margin_large),0,0,0);
    }
  }
}
Program: 13574
Project: 13574
Buggy source:
/** 
 * Padding information are reset when changing the background Drawable on a View. The reason why setting an image resets the padding is because 9-patch images can encode padding. See http://stackoverflow.com/a/10469121 and http://www.mail-archive.com/android-developers@googlegroups.com/msg09595.html
 * @param v The view to apply the background resource
 * @param backgroundResId The resource ID
 */
private static void setViewBackgroundWithoutResettingPadding(final View v,final int backgroundResId){
  final int paddingBottom=v.getPaddingBottom(), paddingLeft=v.getPaddingLeft();
  final int paddingRight=v.getPaddingRight(), paddingTop=v.getPaddingTop();
  v.setBackgroundResource(backgroundResId);
  v.setPadding(paddingLeft,paddingTop,paddingRight,paddingBottom);
}

Fixed version (ground truth):
/** 
 * Padding information are reset when changing the background Drawable on a View. The reason why setting an image resets the padding is because 9-patch images can encode padding. <p> See http://stackoverflow.com/a/10469121 and http://www.mail-archive.com/android-developers@googlegroups.com/msg09595.html
 * @param v               The view to apply the background resource
 * @param backgroundResId The resource ID
 */
private static void setViewBackgroundWithoutResettingPadding(final View v,final int backgroundResId){
  final int paddingBottom=v.getPaddingBottom(), paddingLeft=v.getPaddingLeft();
  final int paddingRight=v.getPaddingRight(), paddingTop=v.getPaddingTop();
  v.setBackgroundResource(backgroundResId);
  ViewCompat.setPaddingRelative(v,paddingLeft,paddingTop,paddingRight,paddingBottom);
}
Program: 13576
Project: 13576
Buggy source:
void setupTopModulePager(LayoutInflater inflater,ViewGroup container,View view,String[] buttonTitles){
  int dp4=DisplayUtils.dpToPx(view.getContext(),4);
  int dp80=DisplayUtils.dpToPx(view.getContext(),80);
  for (int i=0; i < buttonTitles.length; i++) {
    CheckedTextView rb=(CheckedTextView)inflater.inflate(R.layout.stats_top_module_pager_button,container,false);
    RadioGroup.LayoutParams params=new RadioGroup.LayoutParams(RadioGroup.LayoutParams.MATCH_PARENT,RadioGroup.LayoutParams.WRAP_CONTENT);
    params.weight=1;
    if (i == 0) {
      params.setMargins(0,0,dp4,0);
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        params.setMarginEnd(dp4);
      }
    }
 else {
      params.setMargins(dp4,0,0,0);
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        params.setMarginStart(dp4);
      }
    }
    rb.setMinimumWidth(dp80);
    rb.setGravity(Gravity.CENTER);
    rb.setLayoutParams(params);
    rb.setText(buttonTitles[i]);
    rb.setChecked(i == mTopPagerSelectedButtonIndex);
    rb.setOnClickListener(TopModulePagerOnClickListener);
    mTopPagerContainer.addView(rb);
  }
  mTopPagerContainer.setVisibility(View.VISIBLE);
}

Fixed version (ground truth):
void setupTopModulePager(LayoutInflater inflater,ViewGroup container,View view,String[] buttonTitles){
  int dp4=DisplayUtils.dpToPx(view.getContext(),4);
  int dp80=DisplayUtils.dpToPx(view.getContext(),80);
  for (int i=0; i < buttonTitles.length; i++) {
    CheckedTextView rb=(CheckedTextView)inflater.inflate(R.layout.stats_top_module_pager_button,container,false);
    RadioGroup.LayoutParams params=new RadioGroup.LayoutParams(RadioGroup.LayoutParams.MATCH_PARENT,RadioGroup.LayoutParams.WRAP_CONTENT);
    params.weight=1;
    if (i == 0) {
      MarginLayoutParamsCompat.setMarginEnd(params,dp4);
    }
 else {
      MarginLayoutParamsCompat.setMarginStart(params,dp4);
    }
    rb.setMinimumWidth(dp80);
    rb.setGravity(Gravity.CENTER);
    rb.setLayoutParams(params);
    rb.setText(buttonTitles[i]);
    rb.setChecked(i == mTopPagerSelectedButtonIndex);
    rb.setOnClickListener(TopModulePagerOnClickListener);
    mTopPagerContainer.addView(rb);
  }
  mTopPagerContainer.setVisibility(View.VISIBLE);
}
Program: 13578
Project: 13578
Buggy source:
@Provides @Singleton public static ViewModelProvider.Factory provideViewModelFactory(ViewModelSubComponent.Builder subComponentBuilder){
  ArrayMap<Class<? extends ViewModel>,Provider<ViewModel>> viewModelMap=new ArrayMap<>();
  final ViewModelSubComponent subComp=subComponentBuilder.build();
  viewModelMap.put(PluginBrowserViewModel.class,new Provider<ViewModel>(){
    @Override public ViewModel get(){
      return subComp.pluginBrowserViewModel();
    }
  }
);
  return new ViewModelFactory(viewModelMap);
}

Fixed version (ground truth):
@Provides @Singleton static ViewModelProvider.Factory provideViewModelFactory(ViewModelSubComponent.Builder subComponentBuilder){
  ArrayMap<Class<? extends ViewModel>,Provider<ViewModel>> viewModelMap=new ArrayMap<>();
  final ViewModelSubComponent subComp=subComponentBuilder.build();
  viewModelMap.put(PluginBrowserViewModel.class,new Provider<ViewModel>(){
    @Override public ViewModel get(){
      return subComp.pluginBrowserViewModel();
    }
  }
);
  return new ViewModelFactory(viewModelMap);
}
Program: 13579
Project: 13579
Buggy source:
@Inject public ViewModelFactory(ArrayMap<Class<? extends ViewModel>,Provider<ViewModel>> viewModelsMap){
  this.mViewModelsMap=viewModelsMap;
}

Fixed version (ground truth):
@Inject ViewModelFactory(ArrayMap<Class<? extends ViewModel>,Provider<ViewModel>> viewModelsMap){
  this.mViewModelsMap=viewModelsMap;
}
Program: 13580
Project: 13580
Buggy source:
@NonNull @Override public <T extends ViewModel>T create(@NonNull Class<T> viewModelClass){
  Provider<? extends ViewModel> creator=mViewModelsMap.get(viewModelClass);
  if (creator == null) {
    for (    Map.Entry<Class<? extends ViewModel>,Provider<ViewModel>> entry : mViewModelsMap.entrySet()) {
      if (viewModelClass.isAssignableFrom(entry.getKey())) {
        creator=entry.getValue();
        break;
      }
    }
  }
  if (creator == null) {
    throw new IllegalArgumentException("String_Node_Str" + viewModelClass + "String_Node_Str"+ "String_Node_Str");
  }
  return (T)creator.get();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @NonNull @Override public <T extends ViewModel>T create(@NonNull Class<T> viewModelClass){
  Provider<? extends ViewModel> creator=mViewModelsMap.get(viewModelClass);
  if (creator == null) {
    for (    Map.Entry<Class<? extends ViewModel>,Provider<ViewModel>> entry : mViewModelsMap.entrySet()) {
      if (viewModelClass.isAssignableFrom(entry.getKey())) {
        creator=entry.getValue();
        break;
      }
    }
  }
  if (creator == null) {
    throw new IllegalArgumentException("String_Node_Str" + viewModelClass + "String_Node_Str"+ "String_Node_Str");
  }
  return (T)creator.get();
}
Program: 13581
Project: 13581
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mViewModel=ViewModelProviders.of(getActivity()).get(PluginBrowserViewModel.class);
  mListType=(PluginListType)getArguments().getSerializable(ARG_LIST_TYPE);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  ((WordPress)getActivity().getApplication()).component().inject(this);
  mViewModel=ViewModelProviders.of(getActivity(),mViewModelFactory).get(PluginBrowserViewModel.class);
  mListType=(PluginListType)getArguments().getSerializable(ARG_LIST_TYPE);
}
Program: 13582
Project: 13582
Buggy source:
private void showProgress(boolean show){
  findViewById(R.id.progress).setVisibility(show ? View.VISIBLE : View.GONE);
}

Fixed version (ground truth):
protected void showProgress(boolean show){
  findViewById(R.id.progress).setVisibility(show ? View.VISIBLE : View.GONE);
}
Program: 13583
Project: 13583
Buggy source:
private void reloadPluginWithSlug(@NonNull String slug){
  int index=mItems.indexOfPluginWithSlug(slug);
  if (index != -1) {
    notifyItemChanged(index);
  }
}

Fixed version (ground truth):
void reloadPluginWithSlug(@NonNull String slug){
  int index=mItems.indexOfPluginWithSlug(slug);
  if (index != -1) {
    notifyItemChanged(index);
  }
}
Program: 13584
Project: 13584
Buggy source:
private void reloadPluginAdapterAndVisibility(@NonNull PluginListType pluginType,List<?> plugins){
  PluginBrowserAdapter adapter;
  View cardView;
switch (pluginType) {
case POPULAR:
    adapter=(PluginBrowserAdapter)mPopularPluginsRecycler.getAdapter();
  cardView=findViewById(R.id.popular_plugins_cardview);
break;
case NEW:
adapter=(PluginBrowserAdapter)mNewPluginsRecycler.getAdapter();
cardView=findViewById(R.id.new_plugins_cardview);
break;
case SEARCH:
return;
default :
adapter=(PluginBrowserAdapter)mSitePluginsRecycler.getAdapter();
cardView=findViewById(R.id.installed_plugins_cardview);
break;
}
adapter.setPlugins(plugins);
int newVisibility=plugins.size() > 0 ? View.VISIBLE : View.GONE;
int oldVisibility=cardView.getVisibility();
if (newVisibility == View.VISIBLE && oldVisibility != View.VISIBLE) {
AniUtils.fadeIn(cardView,AniUtils.Duration.MEDIUM);
}
 else if (newVisibility != View.VISIBLE && oldVisibility == View.VISIBLE) {
AniUtils.fadeOut(cardView,AniUtils.Duration.MEDIUM);
}
}

Fixed version (ground truth):
protected void reloadPluginAdapterAndVisibility(@NonNull PluginListType pluginType,List<?> plugins){
  PluginBrowserAdapter adapter;
  View cardView;
switch (pluginType) {
case POPULAR:
    adapter=(PluginBrowserAdapter)mPopularPluginsRecycler.getAdapter();
  cardView=findViewById(R.id.popular_plugins_cardview);
break;
case NEW:
adapter=(PluginBrowserAdapter)mNewPluginsRecycler.getAdapter();
cardView=findViewById(R.id.new_plugins_cardview);
break;
case SEARCH:
return;
default :
adapter=(PluginBrowserAdapter)mSitePluginsRecycler.getAdapter();
cardView=findViewById(R.id.installed_plugins_cardview);
break;
}
adapter.setPlugins(plugins);
int newVisibility=plugins.size() > 0 ? View.VISIBLE : View.GONE;
int oldVisibility=cardView.getVisibility();
if (newVisibility == View.VISIBLE && oldVisibility != View.VISIBLE) {
AniUtils.fadeIn(cardView,AniUtils.Duration.MEDIUM);
}
 else if (newVisibility != View.VISIBLE && oldVisibility == View.VISIBLE) {
AniUtils.fadeOut(cardView,AniUtils.Duration.MEDIUM);
}
}
Program: 13585
Project: 13585
Buggy source:
private void showListFragment(@NonNull PluginListType listType){
  PluginListFragment listFragment=getListFragment();
  if (listFragment != null) {
    listFragment.setListType(listType);
  }
 else {
    listFragment=PluginListFragment.newInstance(mViewModel.getSite(),listType);
    getSupportFragmentManager().beginTransaction().add(R.id.fragment_container,listFragment,PluginListFragment.TAG).addToBackStack(null).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE).commit();
  }
  mViewModel.setTitle(getTitleForListType(listType));
}

Fixed version (ground truth):
protected void showListFragment(@NonNull PluginListType listType){
  PluginListFragment listFragment=getListFragment();
  if (listFragment != null) {
    listFragment.setListType(listType);
  }
 else {
    listFragment=PluginListFragment.newInstance(mViewModel.getSite(),listType);
    getSupportFragmentManager().beginTransaction().add(R.id.fragment_container,listFragment,PluginListFragment.TAG).addToBackStack(null).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE).commit();
  }
  mViewModel.setTitle(getTitleForListType(listType));
}
Program: 13586
Project: 13586
Buggy source:
private void showProgress(boolean show){
  if (isAdded()) {
    getView().findViewById(R.id.progress).setVisibility(show ? View.VISIBLE : View.GONE);
  }
}

Fixed version (ground truth):
protected void showProgress(boolean show){
  if (isAdded() && getView() != null) {
    getView().findViewById(R.id.progress).setVisibility(show ? View.VISIBLE : View.GONE);
  }
}
Program: 13587
Project: 13587
Buggy source:
private void reloadPluginWithSlug(@NonNull String slug){
  int index=mItems.indexOfPluginWithSlug(slug);
  if (index != -1) {
    notifyItemChanged(index);
  }
}

Fixed version (ground truth):
void reloadPluginWithSlug(@NonNull String slug){
  int index=mItems.indexOfPluginWithSlug(slug);
  if (index != -1) {
    notifyItemChanged(index);
  }
}
Program: 13588
Project: 13588
Buggy source:
private void submitSearch(@Nullable final String query,boolean delayed){
  if (delayed) {
    mHandler.postDelayed(new Runnable(){
      @Override public void run(){
        if (StringUtils.equals(query,getSearchQuery())) {
          submitSearch(query,false);
        }
      }
    }
,250);
  }
 else {
    clearSearchResults();
    if (shouldSearch()) {
      fetchPlugins(PluginListType.SEARCH,false);
    }
 else {
      mSearchPluginsListStatus.setValue(PluginListStatus.DONE);
    }
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected void submitSearch(@Nullable final String query,boolean delayed){
  if (delayed) {
    mHandler.postDelayed(new Runnable(){
      @Override public void run(){
        if (StringUtils.equals(query,getSearchQuery())) {
          submitSearch(query,false);
        }
      }
    }
,250);
  }
 else {
    clearSearchResults();
    if (shouldSearch()) {
      fetchPlugins(PluginListType.SEARCH,false);
    }
 else {
      mSearchPluginsListStatus.setValue(PluginListStatus.DONE);
    }
  }
}
Program: 13590
Project: 13590
Buggy source:
@SuppressWarnings("String_Node_Str") @Subscribe(threadMode=ThreadMode.MAIN) public void onPluginDirectorySearched(PluginStore.OnPluginDirectorySearched event){
  if (event.isError()) {
    AppLog.e(AppLog.T.PLUGINS,"String_Node_Str");
    mSearchPluginsListStatus.setValue(PluginListStatus.ERROR);
    return;
  }
  setSearchResults(event.searchTerm,event.plugins);
  mSearchPluginsListStatus.setValue(PluginListStatus.DONE);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Subscribe(threadMode=ThreadMode.MAIN) public void onPluginDirectorySearched(PluginStore.OnPluginDirectorySearched event){
  if (!mSearchQuery.equals(event.searchTerm)) {
    return;
  }
  if (event.isError()) {
    AppLog.e(AppLog.T.PLUGINS,"String_Node_Str");
    mSearchPluginsListStatus.setValue(PluginListStatus.ERROR);
    return;
  }
  mSearchResults.setValue(event.plugins);
  mSearchPluginsListStatus.setValue(PluginListStatus.DONE);
}
Program: 13591
Project: 13591
Buggy source:
@Override public void onChanged(@Nullable String slug){
  if (!TextUtils.isEmpty(slug) && mRecycler.getAdapter() != null) {
    showProgress(true);
    ((PluginListAdapter)mRecycler.getAdapter()).reloadPluginWithSlug(slug);
  }
}

Fixed version (ground truth):
@Override public void onChanged(@Nullable String slug){
  if (!TextUtils.isEmpty(slug) && mRecycler.getAdapter() != null) {
    ((PluginListAdapter)mRecycler.getAdapter()).reloadPluginWithSlug(slug);
  }
}
Program: 13593
Project: 13593
Buggy source:
@Override public void onDetach(){
  super.onDetach();
  mLoginListener=null;
  if (mGoogleApiClient.isConnected()) {
    mGoogleApiClient.stopAutoManage(getActivity());
    mGoogleApiClient.disconnect();
  }
}

Fixed version (ground truth):
@Override public void onDetach(){
  super.onDetach();
  mLoginListener=null;
  mGoogleApiClient.stopAutoManage(getActivity());
  if (mGoogleApiClient.isConnected()) {
    mGoogleApiClient.disconnect();
  }
}
Program: 13595
Project: 13595
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  updateLanguagePreference(getResources().getConfiguration().locale.toString());
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  updateLanguagePreference(getResources().getConfiguration().locale.toString());
  AnalyticsTracker.flush();
}
Program: 13596
Project: 13596
Buggy source:
public static void init(Context context){
  loadPrefHasUserOptedOut(context);
}

Fixed version (ground truth):
public static void init(Context context){
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(context);
  boolean hasUserOptedOut=!prefs.getBoolean("String_Node_Str",true);
  if (hasUserOptedOut != mHasUserOptedOut) {
    mHasUserOptedOut=hasUserOptedOut;
  }
}
Program: 13597
Project: 13597
Buggy source:
public void setToolbarLeftPadding(int paddingLeft){
  mToolbar.setPadding(paddingLeft,mToolbar.getPaddingTop(),mToolbar.getPaddingRight(),mToolbar.getPaddingBottom());
}

Fixed version (ground truth):
public void setToolbarLeftPadding(int paddingLeft){
  ViewCompat.setPaddingRelative(mToolbar,paddingLeft,mToolbar.getPaddingTop(),mToolbar.getPaddingRight(),mToolbar.getPaddingBottom());
}
Program: 13598
Project: 13598
Buggy source:
public void setToolbarRightPadding(int paddingRight){
  mToolbar.setPadding(mToolbar.getPaddingLeft(),mToolbar.getPaddingTop(),paddingRight,mToolbar.getPaddingBottom());
}

Fixed version (ground truth):
public void setToolbarRightPadding(int paddingRight){
  ViewCompat.setPaddingRelative(mToolbar,mToolbar.getPaddingLeft(),mToolbar.getPaddingTop(),paddingRight,mToolbar.getPaddingBottom());
}
Program: 13599
Project: 13599
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  final View view;
  if (convertView == null) {
    view=mInflater.inflate(R.layout.filter_spinner_item,parent,false);
    final TextView text=(TextView)view.findViewById(R.id.text);
    FilterCriteria selectedCriteria=(FilterCriteria)getItem(position);
    text.setText(selectedCriteria.getLabel());
    if (mSpinnerTextColor != 0) {
      text.setTextColor(mSpinnerTextColor);
    }
    if (mSpinnerDrawableRight != 0) {
      text.setCompoundDrawablesWithIntrinsicBounds(0,0,mSpinnerDrawableRight,0);
      text.setCompoundDrawablePadding(getResources().getDimensionPixelSize(R.dimen.margin_medium));
      text.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
    }
  }
 else {
    view=convertView;
  }
  return view;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  final View view;
  if (convertView == null) {
    view=mInflater.inflate(R.layout.filter_spinner_item,parent,false);
    final TextView text=(TextView)view.findViewById(R.id.text);
    FilterCriteria selectedCriteria=(FilterCriteria)getItem(position);
    text.setText(selectedCriteria.getLabel());
    if (mSpinnerTextColor != 0) {
      text.setTextColor(mSpinnerTextColor);
    }
    if (mSpinnerDrawableRight != 0) {
      text.setCompoundDrawablePadding(getResources().getDimensionPixelSize(R.dimen.margin_medium));
      text.setGravity(Gravity.CENTER_VERTICAL | Gravity.START);
    }
  }
 else {
    view=convertView;
  }
  return view;
}
Program: 13600
Project: 13600
Buggy source:
public void setToolbarLeftAndRightPadding(int paddingLeft,int paddingRight){
  mToolbar.setPadding(paddingLeft,mToolbar.getPaddingTop(),paddingRight,mToolbar.getPaddingBottom());
}

Fixed version (ground truth):
public void setToolbarLeftAndRightPadding(int paddingLeft,int paddingRight){
  ViewCompat.setPaddingRelative(mToolbar,paddingLeft,mToolbar.getPaddingTop(),paddingRight,mToolbar.getPaddingBottom());
}
Program: 13601
Project: 13601
Buggy source:
@Override public void onResume(){
  super.onResume();
  refreshSelectedSiteDetails();
  if (ServiceUtils.isServiceRunning(getActivity(),StatsService.class)) {
    getActivity().stopService(new Intent(getActivity(),StatsService.class));
  }
  long delayMs=getResources().getInteger(R.integer.fab_animation_delay);
  new Handler().postDelayed(new Runnable(){
    @Override public void run(){
      if (isAdded() && (mFabView.getVisibility() != View.VISIBLE || mFabView.getTranslationY() != 0)) {
        AniUtils.showFab(mFabView,true);
      }
    }
  }
,delayMs);
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  refreshSelectedSiteDetails();
  if (ServiceUtils.isServiceRunning(getActivity(),StatsService.class)) {
    getActivity().stopService(new Intent(getActivity(),StatsService.class));
  }
  if (getSelectedSite() != null) {
    long delayMs=getResources().getInteger(R.integer.fab_animation_delay);
    new Handler().postDelayed(new Runnable(){
      @Override public void run(){
        if (isAdded() && (mFabView.getVisibility() != View.VISIBLE || mFabView.getTranslationY() != 0)) {
          AniUtils.showFab(mFabView,true);
        }
      }
    }
,delayMs);
  }
}
Program: 13602
Project: 13602
Buggy source:
/** 
 * Save the Views state manually so multiple instances of the compound View can exist in the same layout.
 */
@Override public Parcelable onSaveInstanceState(){
  Bundle bundle=new Bundle();
  bundle.putParcelable(KEY_SUPER_STATE,saveViewsState());
  return bundle;
}

Fixed version (ground truth):
/** 
 * Save the Views state manually so multiple instances of the compound View can exist in the same layout.
 */
@Override public Parcelable onSaveInstanceState(){
  Bundle bundle=new Bundle();
  Parcelable editTextState=mEditText.onSaveInstanceState();
  bundle.putParcelable(KEY_SUPER_STATE,new SavedState(super.onSaveInstanceState(),editTextState));
  return bundle;
}
Program: 13603
Project: 13603
Buggy source:
@Override public void onResume(){
  super.onResume();
  refreshSelectedSiteDetails();
  if (ServiceUtils.isServiceRunning(getActivity(),StatsService.class)) {
    getActivity().stopService(new Intent(getActivity(),StatsService.class));
  }
  long delayMs=getResources().getInteger(R.integer.fab_animation_delay);
  new Handler().postDelayed(new Runnable(){
    @Override public void run(){
      if (isAdded() && (mFabView.getVisibility() != View.VISIBLE || mFabView.getTranslationY() != 0)) {
        AniUtils.showFab(mFabView,true);
      }
    }
  }
,delayMs);
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  refreshSelectedSiteDetails();
  if (ServiceUtils.isServiceRunning(getActivity(),StatsService.class)) {
    getActivity().stopService(new Intent(getActivity(),StatsService.class));
  }
  if (getSelectedSite() != null) {
    long delayMs=getResources().getInteger(R.integer.fab_animation_delay);
    new Handler().postDelayed(new Runnable(){
      @Override public void run(){
        if (isAdded() && (mFabView.getVisibility() != View.VISIBLE || mFabView.getTranslationY() != 0)) {
          AniUtils.showFab(mFabView,true);
        }
      }
    }
,delayMs);
  }
}
Program: 13604
Project: 13604
Buggy source:
@SuppressWarnings("String_Node_Str") public void onEventMainThread(UploadService.UploadMediaSuccessEvent event){
  SiteModel site=getSelectedSite();
  if (site != null && event.mediaModelList != null && !event.mediaModelList.isEmpty()) {
    UploadUtils.onMediaUploadedSnackbarHandler(getActivity(),getActivity().findViewById(R.id.coordinator),false,event.mediaModelList,site,event.successMessage);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void onEventMainThread(UploadService.UploadMediaSuccessEvent event){
  EventBus.getDefault().removeStickyEvent(event);
  SiteModel site=getSelectedSite();
  if (site != null && event.mediaModelList != null && !event.mediaModelList.isEmpty()) {
    UploadUtils.onMediaUploadedSnackbarHandler(getActivity(),getActivity().findViewById(R.id.coordinator),false,event.mediaModelList,site,event.successMessage);
  }
}
Program: 13605
Project: 13605
Buggy source:
@SuppressWarnings("String_Node_Str") public void onEventMainThread(UploadService.UploadMediaSuccessEvent event){
  if (event.mediaModelList != null && !event.mediaModelList.isEmpty()) {
    UploadUtils.onMediaUploadedSnackbarHandler(this,findViewById(R.id.tab_layout),false,event.mediaModelList,mSite,event.successMessage);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Subscribe(sticky=true,threadMode=ThreadMode.MAIN) public void onEventMainThread(UploadService.UploadMediaSuccessEvent event){
  EventBus.getDefault().removeStickyEvent(event);
  if (event.mediaModelList != null && !event.mediaModelList.isEmpty()) {
    UploadUtils.onMediaUploadedSnackbarHandler(this,findViewById(R.id.tab_layout),false,event.mediaModelList,mSite,event.successMessage);
    updateMediaGridForTheseMedia(event.mediaModelList);
  }
}
Program: 13606
Project: 13606
Buggy source:
@Override public void onStart(){
  super.onStart();
  registerReceiver(mReceiver,new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
  mDispatcher.register(this);
  EventBus.getDefault().register(this);
}

Fixed version (ground truth):
@Override public void onStart(){
  super.onStart();
  registerReceiver(mReceiver,new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
  mDispatcher.register(this);
  EventBus.getDefault().registerSticky(this);
}
Program: 13607
Project: 13607
Buggy source:
private String buildSuccessMessageForMedia(int mediaItemsUploaded){
  String successMessage=String.format(mContext.getString(R.string.media_all_files_uploaded_successfully),mediaItemsUploaded);
  return successMessage;
}

Fixed version (ground truth):
private String buildSuccessMessageForMedia(int mediaItemsUploaded){
  String successMessage=mediaItemsUploaded == 1 ? mContext.getString(R.string.media_file_uploaded) : String.format(mContext.getString(R.string.media_all_files_uploaded_successfully),mediaItemsUploaded);
  return successMessage;
}
Program: 13611
Project: 13611
Buggy source:
private void startWebActivity(String themeId,ThemeWebActivity.ThemeWebActivityType type){
  String toastText=getString(R.string.no_network_message);
  if (NetworkUtils.isNetworkAvailable(this)) {
    ThemeModel theme=TextUtils.isEmpty(themeId) ? null : mThemeStore.getWpComThemeByThemeId(themeId.replace("String_Node_Str","String_Node_Str"));
    if (theme != null) {
      Map<String,Object> themeProperties=new HashMap<>();
      themeProperties.put(THEME_ID,themeId);
      theme.setActive(isActiveThemeForSite(theme.getThemeId()));
switch (type) {
case PREVIEW:
        AnalyticsUtils.trackWithSiteDetails(Stat.THEMES_PREVIEWED_SITE,mSite,themeProperties);
      break;
case DEMO:
    AnalyticsUtils.trackWithSiteDetails(Stat.THEMES_DEMO_ACCESSED,mSite,themeProperties);
  break;
case DETAILS:
AnalyticsUtils.trackWithSiteDetails(Stat.THEMES_DETAILS_ACCESSED,mSite,themeProperties);
break;
case SUPPORT:
AnalyticsUtils.trackWithSiteDetails(Stat.THEMES_SUPPORT_ACCESSED,mSite,themeProperties);
break;
}
ThemeWebActivity.openTheme(this,mSite,theme,type);
return;
}
 else {
toastText=getString(R.string.could_not_load_theme);
}
}
ToastUtils.showToast(this,toastText,ToastUtils.Duration.SHORT);
}

Fixed version (ground truth):
private void startWebActivity(String themeId,ThemeWebActivity.ThemeWebActivityType type){
  if (!NetworkUtils.checkConnection(this))   return;
  ThemeModel theme=TextUtils.isEmpty(themeId) ? null : mThemeStore.getWpComThemeByThemeId(themeId.replace("String_Node_Str","String_Node_Str"));
  if (theme == null) {
    theme=mThemeStore.getInstalledThemeByThemeId(mSite,themeId);
    if (theme == null) {
      ToastUtils.showToast(this,R.string.could_not_load_theme);
      return;
    }
  }
  Map<String,Object> themeProperties=new HashMap<>();
  themeProperties.put(THEME_ID,themeId);
  theme.setActive(isActiveThemeForSite(theme.getThemeId()));
switch (type) {
case PREVIEW:
    AnalyticsUtils.trackWithSiteDetails(Stat.THEMES_PREVIEWED_SITE,mSite,themeProperties);
  break;
case DEMO:
AnalyticsUtils.trackWithSiteDetails(Stat.THEMES_DEMO_ACCESSED,mSite,themeProperties);
break;
case DETAILS:
AnalyticsUtils.trackWithSiteDetails(Stat.THEMES_DETAILS_ACCESSED,mSite,themeProperties);
break;
case SUPPORT:
AnalyticsUtils.trackWithSiteDetails(Stat.THEMES_SUPPORT_ACCESSED,mSite,themeProperties);
break;
}
ThemeWebActivity.openTheme(this,mSite,theme,type);
}
Program: 13612
Project: 13612
Buggy source:
void setThemeList(@NonNull List<ThemeModel> themes){
  mAllThemes.clear();
  mAllThemes.addAll(themes);
  mFilteredThemes.clear();
  mFilteredThemes.addAll(themes);
  if (!TextUtils.isEmpty(mQuery)) {
    getFilter().filter(mQuery);
  }
 else {
    updateHeaders();
    notifyDataSetChanged();
  }
}

Fixed version (ground truth):
void setThemeList(@NonNull List<ThemeModel> themes){
  mAllThemes.clear();
  mAllThemes.addAll(themes);
  mFilteredThemes.clear();
  mFilteredThemes.addAll(themes);
  if (!TextUtils.isEmpty(mQuery)) {
    getFilter().filter(mQuery);
  }
 else {
    notifyDataSetChanged();
  }
}
Program: 13613
Project: 13613
Buggy source:
@SuppressWarnings("String_Node_Str") @Override protected void publishResults(CharSequence constraint,FilterResults results){
  mFilteredThemes.clear();
  mFilteredThemes.addAll((List<ThemeModel>)results.values);
  updateHeaders();
  ThemeBrowserAdapter.this.notifyDataSetChanged();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override protected void publishResults(CharSequence constraint,FilterResults results){
  mFilteredThemes.clear();
  mFilteredThemes.addAll((List<ThemeModel>)results.values);
  ThemeBrowserAdapter.this.notifyDataSetChanged();
}
Program: 13614
Project: 13614
Buggy source:
@Override public Filter getFilter(){
  return new Filter(){
    @SuppressWarnings("String_Node_Str") @Override protected void publishResults(    CharSequence constraint,    FilterResults results){
      mFilteredThemes.clear();
      mFilteredThemes.addAll((List<ThemeModel>)results.values);
      updateHeaders();
      ThemeBrowserAdapter.this.notifyDataSetChanged();
    }
    @Override protected FilterResults performFiltering(    CharSequence constraint){
      List<ThemeModel> filtered=new ArrayList<>();
      if (TextUtils.isEmpty(constraint)) {
        mQuery=null;
        filtered.addAll(mAllThemes);
      }
 else {
        mQuery=constraint.toString();
        String lcConstraint=constraint.toString().toLowerCase();
        for (        ThemeModel theme : mAllThemes) {
          if (theme.getName().toLowerCase().contains(lcConstraint)) {
            filtered.add(theme);
          }
        }
      }
      FilterResults results=new FilterResults();
      results.values=filtered;
      return results;
    }
  }
;
}

Fixed version (ground truth):
@Override public Filter getFilter(){
  return new Filter(){
    @SuppressWarnings("String_Node_Str") @Override protected void publishResults(    CharSequence constraint,    FilterResults results){
      mFilteredThemes.clear();
      mFilteredThemes.addAll((List<ThemeModel>)results.values);
      ThemeBrowserAdapter.this.notifyDataSetChanged();
    }
    @Override protected FilterResults performFiltering(    CharSequence constraint){
      List<ThemeModel> filtered=new ArrayList<>();
      if (TextUtils.isEmpty(constraint)) {
        mQuery=null;
        filtered.addAll(mAllThemes);
      }
 else {
        mQuery=constraint.toString();
        String lcConstraint=constraint.toString().toLowerCase();
        for (        ThemeModel theme : mAllThemes) {
          if (theme.getName().toLowerCase().contains(lcConstraint)) {
            filtered.add(theme);
          }
        }
      }
      FilterResults results=new FilterResults();
      results.values=filtered;
      return results;
    }
  }
;
}
Program: 13615
Project: 13615
Buggy source:
ThemeBrowserAdapter(Context context,boolean isWpCom,ThemeBrowserFragmentCallback callback){
  mContext=context;
  mInflater=LayoutInflater.from(context);
  mCallback=callback;
  mViewWidth=AppPrefs.getThemeImageSizeWidth();
  mIsWpCom=isWpCom;
}

Fixed version (ground truth):
ThemeBrowserAdapter(Context context,ThemeBrowserFragmentCallback callback){
  mContext=context;
  mInflater=LayoutInflater.from(context);
  mCallback=callback;
  mViewWidth=AppPrefs.getThemeImageSizeWidth();
}
Program: 13616
Project: 13616
Buggy source:
ThemeViewHolder(View view){
  cardView=view.findViewById(R.id.theme_grid_card);
  imageView=view.findViewById(R.id.theme_grid_item_image);
  nameView=view.findViewById(R.id.theme_grid_item_name);
  priceView=view.findViewById(R.id.theme_grid_item_price);
  activeView=view.findViewById(R.id.theme_grid_item_active);
  imageButton=view.findViewById(R.id.theme_grid_item_image_button);
  frameLayout=view.findViewById(R.id.theme_grid_item_image_layout);
  detailsView=view.findViewById(R.id.theme_grid_item_details);
  headerView=view.findViewById(R.id.section_header);
  headerText=headerView.findViewById(R.id.section_header_text);
  headerCount=headerView.findViewById(R.id.section_header_count);
}

Fixed version (ground truth):
ThemeViewHolder(View view){
  cardView=view.findViewById(R.id.theme_grid_card);
  imageView=view.findViewById(R.id.theme_grid_item_image);
  nameView=view.findViewById(R.id.theme_grid_item_name);
  priceView=view.findViewById(R.id.theme_grid_item_price);
  activeView=view.findViewById(R.id.theme_grid_item_active);
  imageButton=view.findViewById(R.id.theme_grid_item_image_button);
  frameLayout=view.findViewById(R.id.theme_grid_item_image_layout);
  detailsView=view.findViewById(R.id.theme_grid_item_details);
}
Program: 13617
Project: 13617
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  ThemeViewHolder holder;
  if (convertView == null || convertView.getTag() == null) {
    convertView=mInflater.inflate(R.layout.theme_grid_item,parent,false);
    holder=new ThemeViewHolder(convertView);
    convertView.setTag(holder);
  }
 else {
    holder=(ThemeViewHolder)convertView.getTag();
  }
  configureThemeImageSize(parent);
  ThemeModel theme=mFilteredThemes.get(position);
  String screenshotURL=theme.getScreenshotUrl();
  String themeId=theme.getThemeId();
  boolean isPremium=!theme.isFree();
  boolean isCurrent=theme.getActive();
  holder.nameView.setText(theme.getName());
  if (isPremium) {
    holder.priceView.setText(theme.getPriceText());
    holder.priceView.setVisibility(View.VISIBLE);
  }
 else {
    holder.priceView.setVisibility(View.GONE);
  }
  if (!screenshotURL.startsWith(ThemeWebActivity.THEME_HTTP_PREFIX)) {
    if (screenshotURL.startsWith("String_Node_Str")) {
      screenshotURL=screenshotURL.substring(2);
    }
    screenshotURL=ThemeWebActivity.THEME_HTTPS_PROTOCOL + screenshotURL;
  }
  configureImageView(holder,screenshotURL,themeId,isCurrent);
  configureImageButton(holder,themeId,isPremium,isCurrent);
  configureCardView(holder,isCurrent);
  ThemeSectionHeader header=mHeaders.get(position);
  if (header != null) {
    holder.headerView.setVisibility(View.VISIBLE);
    holder.headerText.setText(header.text);
    holder.headerCount.setText(String.valueOf(header.count));
  }
 else {
    holder.headerView.setVisibility(View.GONE);
  }
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  ThemeViewHolder holder;
  if (convertView == null || convertView.getTag() == null) {
    convertView=mInflater.inflate(R.layout.theme_grid_item,parent,false);
    holder=new ThemeViewHolder(convertView);
    convertView.setTag(holder);
  }
 else {
    holder=(ThemeViewHolder)convertView.getTag();
  }
  configureThemeImageSize(parent);
  ThemeModel theme=mFilteredThemes.get(position);
  String screenshotURL=theme.getScreenshotUrl();
  String themeId=theme.getThemeId();
  boolean isPremium=!theme.isFree();
  boolean isCurrent=theme.getActive();
  holder.nameView.setText(theme.getName());
  if (isPremium) {
    holder.priceView.setText(theme.getPriceText());
    holder.priceView.setVisibility(View.VISIBLE);
  }
 else {
    holder.priceView.setVisibility(View.GONE);
  }
  if (!screenshotURL.startsWith(ThemeWebActivity.THEME_HTTP_PREFIX)) {
    if (screenshotURL.startsWith("String_Node_Str")) {
      screenshotURL=screenshotURL.substring(2);
    }
    screenshotURL=ThemeWebActivity.THEME_HTTPS_PROTOCOL + screenshotURL;
  }
  configureImageView(holder,screenshotURL,themeId,isCurrent);
  configureImageButton(holder,themeId,isPremium,isCurrent);
  configureCardView(holder,isCurrent);
  return convertView;
}
Program: 13618
Project: 13618
Buggy source:
private ThemeBrowserAdapter getAdapter(){
  if (mAdapter == null) {
    mAdapter=new ThemeBrowserAdapter(getActivity(),mSite.isWPCom(),mCallback);
  }
  return mAdapter;
}

Fixed version (ground truth):
private ThemeBrowserAdapter getAdapter(){
  if (mAdapter == null) {
    mAdapter=new ThemeBrowserAdapter(getActivity(),mCallback);
  }
  return mAdapter;
}
Program: 13619
Project: 13619
Buggy source:
public static String getUrl(SiteModel site,ThemeModel theme,ThemeWebActivityType type,boolean isPremium){
switch (type) {
case PREVIEW:
    String domain=isPremium ? THEME_DOMAIN_PREMIUM : THEME_DOMAIN_PUBLIC;
  return String.format(THEME_URL_PREVIEW,UrlUtils.getHost(site.getUrl()),domain,theme.getThemeId());
case DEMO:
String url=theme.getDemoUrl();
if (url.contains("String_Node_Str")) {
return url + "String_Node_Str" + THEME_URL_DEMO_PARAMETER;
}
 else {
return url + "String_Node_Str" + THEME_URL_DEMO_PARAMETER;
}
case DETAILS:
return String.format(THEME_URL_DETAILS,theme.getThemeId());
case SUPPORT:
return String.format(THEME_URL_SUPPORT,theme.getThemeId());
default :
return "String_Node_Str";
}
}

Fixed version (ground truth):
public static String getUrl(SiteModel site,ThemeModel theme,ThemeWebActivityType type,boolean isPremium){
  if (theme.isWpComTheme()) {
switch (type) {
case PREVIEW:
      String domain=isPremium ? THEME_DOMAIN_PREMIUM : THEME_DOMAIN_PUBLIC;
    return String.format(THEME_URL_PREVIEW,UrlUtils.getHost(site.getUrl()),domain,theme.getThemeId());
case DEMO:
  String url=theme.getDemoUrl();
if (url.contains("String_Node_Str")) {
  return url + "String_Node_Str" + THEME_URL_DEMO_PARAMETER;
}
 else {
  return url + "String_Node_Str" + THEME_URL_DEMO_PARAMETER;
}
case DETAILS:
return String.format(THEME_URL_DETAILS,theme.getThemeId());
case SUPPORT:
return String.format(THEME_URL_SUPPORT,theme.getThemeId());
}
}
 else {
switch (type) {
case PREVIEW:
return site.getAdminUrl() + "String_Node_Str" + theme.getThemeId();
case DEMO:
return site.getAdminUrl() + "String_Node_Str" + theme.getThemeId();
case DETAILS:
case SUPPORT:
return theme.getThemeUrl();
}
}
return "String_Node_Str";
}
Program: 13620
Project: 13620
Buggy source:
public static void openTheme(Activity activity,SiteModel site,ThemeModel theme,ThemeWebActivityType type){
  String url=getUrl(site,theme,type,false);
  if (type == ThemeWebActivityType.PREVIEW) {
    ActivityLauncher.openUrlExternal(activity,url);
  }
 else {
    openWPCOMURL(activity,url,theme,site);
  }
}

Fixed version (ground truth):
public static void openTheme(Activity activity,SiteModel site,ThemeModel theme,ThemeWebActivityType type){
  String url=getUrl(site,theme,type,false);
  if (TextUtils.isEmpty(url)) {
    ToastUtils.showToast(activity,R.string.could_not_load_theme);
    return;
  }
  if (type == ThemeWebActivityType.PREVIEW || !theme.isWpComTheme()) {
    ActivityLauncher.openUrlExternal(activity,url);
  }
 else {
    openWPCOMURL(activity,url,theme,site);
  }
}
Program: 13621
Project: 13621
Buggy source:
private void setModerateButtonForStatus(CommentStatus status){
  if (status == CommentStatus.APPROVED) {
    mBtnModerateIcon.setImageResource(R.drawable.ic_checkmark_orange_jazzy_24dp);
    mBtnModerateTextView.setText(R.string.comment_status_approved);
    mBtnModerateTextView.setTextColor(ContextCompat.getColor(getActivity(),R.color.notification_status_unapproved_dark));
  }
 else {
    mBtnModerateIcon.setImageResource(R.drawable.ic_checkmark_grey_24dp);
    mBtnModerateTextView.setText(R.string.mnu_comment_approve);
    mBtnModerateTextView.setTextColor(ContextCompat.getColor(getActivity(),R.color.grey));
  }
}

Fixed version (ground truth):
private void setModerateButtonForStatus(CommentStatus status){
  if (status == CommentStatus.APPROVED) {
    mBtnModerateIcon.setImageResource(R.drawable.ic_checkmark_orange_jazzy_24dp);
    mBtnModerateTextView.setText(R.string.comment_status_approved);
    mBtnModerateTextView.setTextColor(ContextCompat.getColor(getActivity(),R.color.orange_jazzy));
  }
 else {
    mBtnModerateIcon.setImageResource(R.drawable.ic_checkmark_grey_24dp);
    mBtnModerateTextView.setText(R.string.mnu_comment_approve);
    mBtnModerateTextView.setTextColor(ContextCompat.getColor(getActivity(),R.color.grey));
  }
}
Program: 13622
Project: 13622
Buggy source:
private void setModerateButtonForStatus(CommentStatus status){
  if (status == CommentStatus.APPROVED) {
    mBtnModerateIcon.setImageResource(R.drawable.ic_checkmark_orange_jazzy_24dp);
    mBtnModerateTextView.setText(R.string.comment_status_approved);
    mBtnModerateTextView.setTextColor(ContextCompat.getColor(getActivity(),R.color.notification_status_unapproved_dark));
  }
 else {
    mBtnModerateIcon.setImageResource(R.drawable.ic_checkmark_grey_24dp);
    mBtnModerateTextView.setText(R.string.mnu_comment_approve);
    mBtnModerateTextView.setTextColor(ContextCompat.getColor(getActivity(),R.color.grey));
  }
}

Fixed version (ground truth):
private void setModerateButtonForStatus(CommentStatus status){
  if (status == CommentStatus.APPROVED) {
    mBtnModerateIcon.setImageResource(R.drawable.ic_checkmark_orange_jazzy_24dp);
    mBtnModerateTextView.setText(R.string.comment_status_approved);
    mBtnModerateTextView.setTextColor(ContextCompat.getColor(getActivity(),R.color.orange_jazzy));
  }
 else {
    mBtnModerateIcon.setImageResource(R.drawable.ic_checkmark_grey_24dp);
    mBtnModerateTextView.setText(R.string.mnu_comment_approve);
    mBtnModerateTextView.setTextColor(ContextCompat.getColor(getActivity(),R.color.grey));
  }
}
Program: 13623
Project: 13623
Buggy source:
private void submitSearch(@Nullable final String query,boolean delayed){
  mSearchQuery=query;
  if (delayed && !TextUtils.isEmpty(query)) {
    mHandler.postDelayed(new Runnable(){
      @Override public void run(){
        if (StringUtils.equals(query,mSearchQuery)) {
          submitSearch(query,false);
        }
      }
    }
,250);
  }
 else {
    mSearchResults.clear();
    PluginListFragment fragment=showListFragment(PluginListType.SEARCH);
    fragment.showEmptyView(false);
    if (!TextUtils.isEmpty(mSearchQuery)) {
      fetchPlugins(PluginListType.SEARCH,false);
    }
  }
}

Fixed version (ground truth):
private void submitSearch(@Nullable final String query,boolean delayed){
  mSearchQuery=query;
  if (delayed) {
    mHandler.postDelayed(new Runnable(){
      @Override public void run(){
        if (StringUtils.equals(query,mSearchQuery)) {
          submitSearch(query,false);
        }
      }
    }
,250);
  }
 else {
    mSearchResults.clear();
    PluginListFragment fragment=showListFragment(PluginListType.SEARCH);
    fragment.showEmptyView(false);
    if (!TextUtils.isEmpty(mSearchQuery)) {
      fetchPlugins(PluginListType.SEARCH,false);
    }
  }
}
Program: 13624
Project: 13624
Buggy source:
@Override public boolean onMenuItemActionCollapse(MenuItem menuItem){
  hideListFragment();
  return true;
}

Fixed version (ground truth):
@Override public boolean onMenuItemActionCollapse(MenuItem menuItem){
  mSearchView.setOnQueryTextListener(null);
  hideListFragment();
  return true;
}
Program: 13625
Project: 13625
Buggy source:
@Override public boolean onMenuItemActionExpand(MenuItem menuItem){
  return true;
}

Fixed version (ground truth):
@Override public boolean onMenuItemActionExpand(MenuItem menuItem){
  submitSearch(null,true);
  mSearchView.setOnQueryTextListener(this);
  return true;
}
Program: 13626
Project: 13626
Buggy source:
private void hideListFragment(){
  if (getFragmentManager().getBackStackEntryCount() > 0) {
    getFragmentManager().popBackStack();
  }
  setTitle(R.string.plugins);
}

Fixed version (ground truth):
private void hideListFragment(){
  if (getFragmentManager().getBackStackEntryCount() > 0) {
    onBackPressed();
  }
}
Program: 13627
Project: 13627
Buggy source:
private PluginListFragment showListFragment(@NonNull PluginListType listType){
  PluginListFragment listFragment;
  Fragment fragment=getListFragment();
  if (fragment != null) {
    listFragment=(PluginListFragment)fragment;
    listFragment.setListType(listType);
  }
 else {
    listFragment=PluginListFragment.newInstance(mSite,listType);
    getFragmentManager().beginTransaction().add(R.id.fragment_container,listFragment,PluginListFragment.TAG).addToBackStack(null).commit();
  }
  return listFragment;
}

Fixed version (ground truth):
private PluginListFragment showListFragment(@NonNull PluginListType listType){
  PluginListFragment listFragment=getListFragment();
  if (listFragment != null) {
    listFragment.setListType(listType);
  }
 else {
    listFragment=PluginListFragment.newInstance(mSite,listType);
    getFragmentManager().beginTransaction().add(R.id.fragment_container,listFragment,PluginListFragment.TAG).addToBackStack(null).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE).commit();
  }
  return listFragment;
}
Program: 13628
Project: 13628
Buggy source:
@Override public boolean onCreateOptionsMenu(Menu menu){
  getMenuInflater().inflate(R.menu.search,menu);
  mSearchMenuItem=menu.findItem(R.id.menu_search);
  mSearchView=(SearchView)mSearchMenuItem.getActionView();
  if (!TextUtils.isEmpty(mSearchQuery)) {
    mSearchMenuItem.expandActionView();
    onQueryTextSubmit(mSearchQuery);
    mSearchView.setQuery(mSearchQuery,true);
  }
  mSearchMenuItem.setOnActionExpandListener(this);
  mSearchView.setOnQueryTextListener(this);
  return super.onCreateOptionsMenu(menu);
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(Menu menu){
  getMenuInflater().inflate(R.menu.search,menu);
  mSearchMenuItem=menu.findItem(R.id.menu_search);
  mSearchView=(SearchView)mSearchMenuItem.getActionView();
  if (!TextUtils.isEmpty(mSearchQuery)) {
    mSearchMenuItem.expandActionView();
    onQueryTextSubmit(mSearchQuery);
    mSearchView.setQuery(mSearchQuery,true);
  }
  mSearchMenuItem.setOnActionExpandListener(this);
  return super.onCreateOptionsMenu(menu);
}
Program: 13631
Project: 13631
Buggy source:
private void addLastTakenPicture(){
  try {
    WPMediaUtils.scanMediaFile(this,mMediaCapturePath);
    File f=new File(mMediaCapturePath);
    Uri capturedImageUri=Uri.fromFile(f);
    if (addMedia(capturedImageUri,true)) {
      this.sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,Uri.parse("String_Node_Str" + Environment.getExternalStorageDirectory())));
    }
 else {
      ToastUtils.showToast(this,R.string.gallery_error,Duration.SHORT);
    }
  }
 catch (  RuntimeException|OutOfMemoryError e) {
    AppLog.e(T.EDITOR,e);
  }
}

Fixed version (ground truth):
private void addLastTakenPicture(){
  try {
    WPMediaUtils.scanMediaFile(this,mMediaCapturePath);
    File f=new File(mMediaCapturePath);
    Uri capturedImageUri=Uri.fromFile(f);
    if (addMedia(capturedImageUri,true)) {
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        final Intent scanIntent=new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
        scanIntent.setData(capturedImageUri);
        sendBroadcast(scanIntent);
      }
 else {
        this.sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,Uri.parse("String_Node_Str" + Environment.getExternalStorageDirectory())));
      }
    }
 else {
      ToastUtils.showToast(this,R.string.gallery_error,Duration.SHORT);
    }
  }
 catch (  RuntimeException|OutOfMemoryError e) {
    AppLog.e(T.EDITOR,e);
  }
}