nus-yam/ex-repair huggingface dataset:
Program: 13423
Project: 13423
Buggy source:
/** 
 * If the user has selected a language other than the device default, return that language code, else just return the device default language code.
 * @return The 2-letter language code (example "en")
 */
private static String getLanguage(Context context){
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(context);
  if (prefs.contains(LANGUAGE_KEY)) {
    return prefs.getString(LANGUAGE_KEY,"String_Node_Str");
  }
  return LanguageUtils.getCurrentDeviceLanguageCode(context);
}

Fixed version (ground truth):
/** 
 * If the user has selected a language other than the device default, return that language code, else just return the device default language code.
 * @return The 2-letter language code (example "en")
 */
private static String getLanguage(Context context){
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(context);
  return prefs.getString(LANGUAGE_KEY,LanguageUtils.getCurrentDeviceLanguageCode());
}
Program: 13424
Project: 13424
Buggy source:
/** 
 * Gets a locale for the given language code.
 * @param languageCode The 2-letter language code (example "en"). If null or empty will returnthe current default locale.
 */
public static Locale languageLocale(@Nullable String languageCode){
  if (TextUtils.isEmpty(languageCode)) {
    return Locale.getDefault();
  }
  if (languageCode.length() > NO_REGION_LANG_CODE_LEN) {
    return new Locale(languageCode.substring(0,NO_REGION_LANG_CODE_LEN),languageCode.substring(REGION_SUBSTRING_INDEX));
  }
  return new Locale(languageCode);
}

Fixed version (ground truth):
/** 
 * Gets a locale for the given language code.
 * @param languageCode The 2-letter language code (example "en"). If null or empty will returnthe current default locale.
 */
public static Locale languageLocale(@Nullable String languageCode){
  if (TextUtils.isEmpty(languageCode)) {
    return Locale.getDefault();
  }
  if (languageCode.contains("String_Node_Str")) {
    String[] opts=languageCode.split("String_Node_Str");
    if (opts.length >= 2) {
      return new Locale(opts[0],opts[1]);
    }
 else {
      return new Locale(opts[0]);
    }
  }
  return new Locale(languageCode);
}
Program: 13425
Project: 13425
Buggy source:
/** 
 * Update resources for the current session.
 * @param context The current active context
 * @param language The 2-letter language code (example "en")
 * @return The modified context containing the updated localized resources
 */
private static Context updateResources(Context context,String language){
  Locale locale=new Locale(language);
  Locale.setDefault(locale);
  Resources res=context.getResources();
  Configuration config=new Configuration(res.getConfiguration());
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
    config.setLocale(locale);
    context=context.createConfigurationContext(config);
  }
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) {
    config.locale=locale;
    res.updateConfiguration(config,res.getDisplayMetrics());
  }
  return context;
}

Fixed version (ground truth):
/** 
 * Update resources for the current session.
 * @param context The current active context
 * @param language The 2-letter language code (example "en")
 * @return The modified context containing the updated localized resources
 */
private static Context updateResources(Context context,String language){
  Locale locale=languageLocale(language);
  Locale.setDefault(locale);
  Resources res=context.getResources();
  Configuration config=new Configuration(res.getConfiguration());
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
    config.setLocale(locale);
    context=context.createConfigurationContext(config);
  }
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) {
    config.locale=locale;
    res.updateConfiguration(config,res.getDisplayMetrics());
  }
  return context;
}
Program: 13426
Project: 13426
Buggy source:
/** 
 * Compare the language for the current context with another language.
 * @param language The language to compare
 * @return True if the languages are the same, else false
 */
public static boolean isSameLanguage(@NonNull String language){
  Locale newLocale=languageLocale(language);
  return Locale.getDefault().getLanguage().equals(newLocale.getLanguage());
}

Fixed version (ground truth):
/** 
 * Compare the language for the current context with another language.
 * @param language The language to compare
 * @return True if the languages are the same, else false
 */
public static boolean isSameLanguage(@NonNull String language){
  Locale newLocale=languageLocale(language);
  return Locale.getDefault().toString().equals(newLocale.toString());
}
Program: 13427
Project: 13427
Buggy source:
@Override public void onBackPressed(){
  if (isCommentEdited()) {
    AlertDialog.Builder dialogBuilder=new AlertDialog.Builder(new ContextThemeWrapper(this,R.style.Calypso_Dialog));
    dialogBuilder.setTitle(getResources().getText(R.string.cancel_edit));
    dialogBuilder.setMessage(getResources().getText(R.string.sure_to_cancel_edit_comment));
    dialogBuilder.setPositiveButton(getResources().getText(R.string.yes),new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int whichButton){
        finish();
      }
    }
);
    dialogBuilder.setNegativeButton(getResources().getText(R.string.no),new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int whichButton){
      }
    }
);
    dialogBuilder.setCancelable(true);
    dialogBuilder.create().show();
  }
 else {
    super.onBackPressed();
  }
}

Fixed version (ground truth):
@Override public void onBackPressed(){
  if (isCommentEdited()) {
    cancelEditCommentConfirmation();
  }
 else {
    super.onBackPressed();
  }
}
Program: 13428
Project: 13428
Buggy source:
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  ((WordPress)getApplication()).component().inject(this);
  setContentView(R.layout.comment_edit_activity);
  ActionBar actionBar=getSupportActionBar();
  if (actionBar != null) {
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);
  }
  loadComment(getIntent());
  ActivityId.trackLastActivity(ActivityId.COMMENT_EDITOR);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  ((WordPress)getApplication()).component().inject(this);
  setContentView(R.layout.comment_edit_activity);
  ActionBar actionBar=getSupportActionBar();
  if (actionBar != null) {
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);
  }
  loadComment(getIntent());
  if (icicle != null) {
    if (icicle.getBoolean(ARG_CANCEL_EDITING_COMMENT_DIALOG_VISIBLE,false)) {
      cancelEditCommentConfirmation();
    }
  }
  ActivityId.trackLastActivity(ActivityId.COMMENT_EDITOR);
}
Program: 13429
Project: 13429
Buggy source:
@Override public void onBackPressed(){
  if (isCommentEdited()) {
    AlertDialog.Builder dialogBuilder=new AlertDialog.Builder(EditCommentActivity.this);
    dialogBuilder.setTitle(getResources().getText(R.string.cancel_edit));
    dialogBuilder.setMessage(getResources().getText(R.string.sure_to_cancel_edit_comment));
    dialogBuilder.setPositiveButton(getResources().getText(R.string.yes),new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int whichButton){
        finish();
      }
    }
);
    dialogBuilder.setNegativeButton(getResources().getText(R.string.no),new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int whichButton){
      }
    }
);
    dialogBuilder.setCancelable(true);
    dialogBuilder.create().show();
  }
 else {
    super.onBackPressed();
  }
}

Fixed version (ground truth):
@Override public void onBackPressed(){
  if (isCommentEdited()) {
    cancelEditCommentConfirmation();
  }
 else {
    super.onBackPressed();
  }
}
Program: 13430
Project: 13430
Buggy source:
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  ((WordPress)getApplication()).component().inject(this);
  setContentView(R.layout.comment_edit_activity);
  ActionBar actionBar=getSupportActionBar();
  if (actionBar != null) {
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);
  }
  loadComment(getIntent());
  ActivityId.trackLastActivity(ActivityId.COMMENT_EDITOR);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  ((WordPress)getApplication()).component().inject(this);
  setContentView(R.layout.comment_edit_activity);
  ActionBar actionBar=getSupportActionBar();
  if (actionBar != null) {
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);
  }
  loadComment(getIntent());
  if (icicle != null) {
    if (icicle.getBoolean(ARG_CANCEL_EDITING_COMMENT_DIALOG_VISIBLE,false)) {
      cancelEditCommentConfirmation();
    }
  }
  ActivityId.trackLastActivity(ActivityId.COMMENT_EDITOR);
}
Program: 13431
Project: 13431
Buggy source:
@Override protected void updateUI(){
  if (!isAdded()) {
    return;
  }
  if (mCommentsModel == null && mCommentFollowersModel == null) {
    showHideNoResultsUI(true);
    mTotalsLabel.setVisibility(View.GONE);
    mTopPagerContainer.setVisibility(View.GONE);
    return;
  }
  mTopPagerContainer.setVisibility(View.VISIBLE);
  if (mCommentFollowersModel != null) {
    mTotalsLabel.setVisibility(View.VISIBLE);
    int totalNumberOfFollowers=mCommentFollowersModel.getTotal();
    String totalCommentsFollowers=getString(R.string.stats_comments_total_comments_followers);
    mTotalsLabel.setText(String.format(totalCommentsFollowers,FormatUtils.formatDecimal(totalNumberOfFollowers)));
  }
  ArrayAdapter adapter=null;
  if (mTopPagerSelectedButtonIndex == 0 && hasAuthors()) {
    adapter=new AuthorsAdapter(getActivity(),getAuthors());
  }
 else   if (mTopPagerSelectedButtonIndex == 1 && hasPosts()) {
    adapter=new PostsAndPagesAdapter(getActivity(),getPosts());
  }
  if (adapter != null) {
    StatsUIHelper.reloadLinearLayout(getActivity(),adapter,mList,getMaxNumberOfItemsToShowInList());
    showHideNoResultsUI(false);
  }
 else {
    showHideNoResultsUI(true);
  }
}

Fixed version (ground truth):
@Override protected void updateUI(){
  if (!isAdded()) {
    return;
  }
  if (mCommentsModel == null && mCommentFollowersModel == null) {
    showHideNoResultsUI(true);
    mTotalsLabel.setVisibility(View.GONE);
    mTopPagerContainer.setVisibility(View.GONE);
    return;
  }
  mTopPagerContainer.setVisibility(View.VISIBLE);
  if (mCommentFollowersModel != null) {
    mTotalsLabel.setVisibility(View.VISIBLE);
    int totalNumberOfFollowers=mCommentFollowersModel.getTotal();
    String totalCommentsFollowers=getString(R.string.stats_comments_total_comments_followers);
    mTotalsLabel.setText(String.format(totalCommentsFollowers,FormatUtils.formatDecimal(totalNumberOfFollowers)));
  }
  ArrayAdapter adapter=null;
  if (mTopPagerSelectedButtonIndex == 0 && hasAuthors()) {
    adapter=new AuthorsAdapter(getActivity(),getAuthors());
  }
 else   if (mTopPagerSelectedButtonIndex == 1 && hasPosts()) {
    adapter=new PostsAndPagesAdapter(getActivity(),getPosts(),true);
  }
  if (adapter != null) {
    StatsUIHelper.reloadLinearLayout(getActivity(),adapter,mList,getMaxNumberOfItemsToShowInList());
    showHideNoResultsUI(false);
  }
 else {
    showHideNoResultsUI(true);
  }
}
Program: 13432
Project: 13432
Buggy source:
@Override protected void updateUI(){
  if (!isAdded()) {
    return;
  }
  if (hasTopPostsAndPages()) {
    List<StatsPostModel> postViews=mTopPostsAndPagesModel.getTopPostsAndPages();
    ArrayAdapter adapter=new PostsAndPagesAdapter(getActivity(),postViews);
    StatsUIHelper.reloadLinearLayout(getActivity(),adapter,mList,getMaxNumberOfItemsToShowInList());
    showHideNoResultsUI(false);
  }
 else {
    showHideNoResultsUI(true);
  }
}

Fixed version (ground truth):
@Override protected void updateUI(){
  if (!isAdded()) {
    return;
  }
  if (hasTopPostsAndPages()) {
    List<StatsPostModel> postViews=mTopPostsAndPagesModel.getTopPostsAndPages();
    ArrayAdapter adapter=new PostsAndPagesAdapter(getActivity(),postViews,false);
    StatsUIHelper.reloadLinearLayout(getActivity(),adapter,mList,getMaxNumberOfItemsToShowInList());
    showHideNoResultsUI(false);
  }
 else {
    showHideNoResultsUI(true);
  }
}
Program: 13433
Project: 13433
Buggy source:
@Override @NonNull public View getView(int position,View convertView,@NonNull ViewGroup parent){
  View rowView=convertView;
  if (rowView == null) {
    rowView=mInflater.inflate(R.layout.stats_list_cell,parent,false);
    StatsViewHolder viewHolder=new StatsViewHolder(rowView);
    rowView.setTag(viewHolder);
  }
  final StatsPostModel currentRowData=mList.get(position);
  StatsViewHolder holder=(StatsViewHolder)rowView.getTag();
  holder.setEntryTextOpenDetailsPage(currentRowData);
  holder.setMoreButtonOpenInReader(currentRowData);
  holder.totalsTextView.setText(FormatUtils.formatDecimal(currentRowData.getTotals()));
  holder.totalsTextView.setContentDescription(StringUtils.getQuantityString(holder.totalsTextView.getContext(),R.string.stats_comments_zero_desc,R.string.stats_comments_one_desc,R.string.stats_comments_many_desc,currentRowData.getTotals()));
  holder.networkImageView.setVisibility(View.GONE);
  return rowView;
}

Fixed version (ground truth):
@Override @NonNull public View getView(int position,View convertView,@NonNull ViewGroup parent){
  View rowView=convertView;
  if (rowView == null) {
    rowView=mInflater.inflate(R.layout.stats_list_cell,parent,false);
    StatsViewHolder viewHolder=new StatsViewHolder(rowView);
    rowView.setTag(viewHolder);
  }
  final StatsPostModel currentRowData=mList.get(position);
  StatsViewHolder holder=(StatsViewHolder)rowView.getTag();
  holder.setEntryTextOpenDetailsPage(currentRowData);
  holder.setMoreButtonOpenInReader(currentRowData);
  holder.totalsTextView.setText(FormatUtils.formatDecimal(currentRowData.getTotals()));
  if (mAnnounceValueAsComments) {
    holder.totalsTextView.setContentDescription(StringUtils.getQuantityString(holder.totalsTextView.getContext(),R.string.stats_comments_zero_desc,R.string.stats_comments_one_desc,R.string.stats_comments_many_desc,currentRowData.getTotals()));
  }
 else {
    holder.totalsTextView.setContentDescription(StringUtils.getQuantityString(holder.totalsTextView.getContext(),R.string.stats_views_zero_desc,R.string.stats_views_one_desc,R.string.stats_views_many_desc,currentRowData.getTotals()));
  }
  holder.networkImageView.setVisibility(View.GONE);
  return rowView;
}
Program: 13434
Project: 13434
Buggy source:
public PostsAndPagesAdapter(Context context,List<StatsPostModel> list){
  super(context,R.layout.stats_list_cell,list);
  mList=list;
  mInflater=LayoutInflater.from(context);
}

Fixed version (ground truth):
public PostsAndPagesAdapter(Context context,List<StatsPostModel> list,boolean announceValueAsComments){
  super(context,R.layout.stats_list_cell,list);
  mList=list;
  mInflater=LayoutInflater.from(context);
  mAnnounceValueAsComments=announceValueAsComments;
}
Program: 13435
Project: 13435
Buggy source:
private void showListEditorDialog(int titleRes,int headerRes){
  mDialog=new Dialog(getActivity(),R.style.Calypso_SiteSettingsTheme);
  mDialog.setOnDismissListener(this);
  mDialog.setContentView(getListEditorView(getString(headerRes)));
  mDialog.show();
  WPActivityUtils.addToolbarToDialog(this,mDialog,getString(titleRes));
}

Fixed version (ground truth):
private void showListEditorDialog(int titleRes,int headerRes){
  mDialog=new Dialog(getActivity(),R.style.Calypso_SiteSettingsTheme);
  mDialog.setOnDismissListener(this);
  mDialog.setTitle(titleRes);
  mDialog.setContentView(getListEditorView(getString(headerRes)));
  mDialog.show();
  WPActivityUtils.addToolbarToDialog(this,mDialog,getString(titleRes));
}
Program: 13437
Project: 13437
Buggy source:
@Override public void onChildViewAdded(View parent,View child){
  if (child.getId() == android.R.id.title && child instanceof TextView) {
    TextView title=(TextView)child;
    WPPrefUtils.layoutAsBody2(title);
  }
 else {
    TextView title=(TextView)child.findViewById(android.R.id.title);
    if (title != null)     WPPrefUtils.layoutAsSubhead(title);
  }
}

Fixed version (ground truth):
@Override public void onChildViewAdded(View parent,View child){
  if (child.getId() == android.R.id.title && child instanceof TextView) {
    TextView title=(TextView)child;
    WPPrefUtils.layoutAsBody2(title);
  }
 else {
    TextView title=child.findViewById(android.R.id.title);
    if (title != null)     WPPrefUtils.layoutAsSubhead(title);
  }
}
Program: 13438
Project: 13438
Buggy source:
private boolean setupMorePreferenceScreen(){
  if (mMorePreference == null || !isAdded())   return false;
  String title=getString(R.string.site_settings_discussion_title);
  Dialog dialog=mMorePreference.getDialog();
  if (dialog != null) {
    setupPreferenceList((ListView)dialog.findViewById(android.R.id.list),getResources());
    WPActivityUtils.addToolbarToDialog(this,dialog,title);
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean setupMorePreferenceScreen(){
  if (mMorePreference == null || !isAdded())   return false;
  String title=getString(R.string.site_settings_discussion_title);
  Dialog dialog=mMorePreference.getDialog();
  if (dialog != null) {
    dialog.setTitle(title);
    setupPreferenceList((ListView)dialog.findViewById(android.R.id.list),getResources());
    WPActivityUtils.addToolbarToDialog(this,dialog,title);
    return true;
  }
  return false;
}
Program: 13439
Project: 13439
Buggy source:
@SuppressWarnings("String_Node_Str") @Subscribe(threadMode=ThreadMode.MAIN) public void onStockMediaListFetched(StockMediaStore.OnStockMediaListFetched event){
  if (mSearchQuery == null || !mSearchQuery.equals(event.searchTerm)) {
    return;
  }
  mIsFetching=false;
  showProgress(false);
  if (event.isError()) {
    AppLog.e(AppLog.T.MEDIA,"String_Node_Str");
    mCanLoadMore=false;
    return;
  }
  mNextPage=event.nextPage;
  mCanLoadMore=event.canLoadMore;
  if (event.nextPage == 2) {
    mAdapter.setMediaList(event.mediaList);
  }
 else {
    mAdapter.addMediaList(event.mediaList);
  }
  showEmptyView(mAdapter.isEmpty() && !TextUtils.isEmpty(mSearchQuery));
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Subscribe(threadMode=ThreadMode.MAIN) public void onStockMediaListFetched(StockMediaStore.OnStockMediaListFetched event){
  if (mSearchQuery == null || !mSearchQuery.equals(event.searchTerm)) {
    return;
  }
  mIsFetching=false;
  showProgress(false);
  if (event.isError()) {
    AppLog.e(AppLog.T.MEDIA,"String_Node_Str");
    ToastUtils.showToast(this,R.string.media_generic_error);
    mCanLoadMore=false;
    return;
  }
  mNextPage=event.nextPage;
  mCanLoadMore=event.canLoadMore;
  if (event.nextPage == 2) {
    mAdapter.setMediaList(event.mediaList);
  }
 else {
    mAdapter.addMediaList(event.mediaList);
  }
  showEmptyView(mAdapter.isEmpty() && !TextUtils.isEmpty(mSearchQuery));
}
Program: 13440
Project: 13440
Buggy source:
private void fetchStockMedia(@Nullable String searchQuery,int page){
  if (mIsFetching || !NetworkUtils.checkConnection(this)) {
    return;
  }
  if (TextUtils.isEmpty(searchQuery)) {
    mAdapter.clear();
    return;
  }
  if (page == 1) {
    mAdapter.clear();
  }
  showProgress(true);
  mIsFetching=true;
  showEmptyView(false);
  mSearchQuery=searchQuery;
  AppLog.d(AppLog.T.MEDIA,"String_Node_Str" + page);
  StockMediaStore.FetchStockMediaListPayload payload=new StockMediaStore.FetchStockMediaListPayload(searchQuery,page);
  mDispatcher.dispatch(StockMediaActionBuilder.newFetchStockMediaAction(payload));
}

Fixed version (ground truth):
private void fetchStockMedia(@Nullable String searchQuery,int page){
  if ((mIsFetching && page != 1) || !NetworkUtils.checkConnection(this)) {
    return;
  }
  mSearchQuery=searchQuery;
  if (TextUtils.isEmpty(searchQuery)) {
    mIsFetching=false;
    mAdapter.clear();
    showEmptyView(true);
    return;
  }
  if (page == 1) {
    mAdapter.clear();
  }
  showProgress(true);
  mIsFetching=true;
  showEmptyView(false);
  AppLog.d(AppLog.T.MEDIA,"String_Node_Str" + page);
  StockMediaStore.FetchStockMediaListPayload payload=new StockMediaStore.FetchStockMediaListPayload(searchQuery,page);
  mDispatcher.dispatch(StockMediaActionBuilder.newFetchStockMediaAction(payload));
}
Program: 13441
Project: 13441
Buggy source:
@Override protected void setupContent(ViewGroup rootView){
  rootView.findViewById(R.id.site_creation_card_blog).setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      if (mSiteCreationListener != null) {
        mSiteCreationListener.withCategory(ThemeStore.MOBILE_FRIENDLY_CATEGORY_BLOG);
      }
    }
  }
);
  rootView.findViewById(R.id.site_creation_card_website).setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      if (mSiteCreationListener != null) {
        mSiteCreationListener.withCategory(ThemeStore.MOBILE_FRIENDLY_CATEGORY_WEBSITE);
      }
    }
  }
);
  rootView.findViewById(R.id.site_creation_card_portfolio).setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      if (mSiteCreationListener != null) {
        mSiteCreationListener.withCategory(ThemeStore.MOBILE_FRIENDLY_CATEGORY_PORTFOLIO);
      }
    }
  }
);
}

Fixed version (ground truth):
@Override protected void setupContent(ViewGroup rootView){
  getActivity().setTitle(R.string.site_creation_category_title);
  rootView.findViewById(R.id.site_creation_card_blog).setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      if (mSiteCreationListener != null) {
        mSiteCreationListener.withCategory(ThemeStore.MOBILE_FRIENDLY_CATEGORY_BLOG);
      }
    }
  }
);
  rootView.findViewById(R.id.site_creation_card_website).setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      if (mSiteCreationListener != null) {
        mSiteCreationListener.withCategory(ThemeStore.MOBILE_FRIENDLY_CATEGORY_WEBSITE);
      }
    }
  }
);
  rootView.findViewById(R.id.site_creation_card_portfolio).setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      if (mSiteCreationListener != null) {
        mSiteCreationListener.withCategory(ThemeStore.MOBILE_FRIENDLY_CATEGORY_PORTFOLIO);
      }
    }
  }
);
}
Program: 13442
Project: 13442
Buggy source:
@Override protected void setupContent(ViewGroup rootView){
  RecyclerView recyclerView=rootView.findViewById(R.id.recycler_view);
  recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
  recyclerView.setAdapter(mSiteCreationDomainAdapter);
  View bottomShadow=rootView.findViewById(R.id.bottom_shadow);
  bottomShadow.setVisibility(View.VISIBLE);
  ViewGroup bottomButtons=rootView.findViewById(R.id.bottom_buttons);
  bottomButtons.setVisibility(View.VISIBLE);
  mFinishButton=rootView.findViewById(R.id.finish_button);
  mFinishButton.setVisibility(View.VISIBLE);
  mFinishButton.setEnabled(mSelectedDomain != null);
  mFinishButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      mSiteCreationListener.withDomain(mSelectedDomain);
    }
  }
);
}

Fixed version (ground truth):
@Override protected void setupContent(ViewGroup rootView){
  getActivity().setTitle(R.string.site_creation_domain_selection_title);
  RecyclerView recyclerView=rootView.findViewById(R.id.recycler_view);
  recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
  recyclerView.setAdapter(mSiteCreationDomainAdapter);
  View bottomShadow=rootView.findViewById(R.id.bottom_shadow);
  bottomShadow.setVisibility(View.VISIBLE);
  ViewGroup bottomButtons=rootView.findViewById(R.id.bottom_buttons);
  bottomButtons.setVisibility(View.VISIBLE);
  mFinishButton=rootView.findViewById(R.id.finish_button);
  mFinishButton.setVisibility(View.VISIBLE);
  mFinishButton.setEnabled(mSelectedDomain != null);
  mFinishButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      mSiteCreationListener.withDomain(mSelectedDomain);
    }
  }
);
}
Program: 13443
Project: 13443
Buggy source:
@Override protected void setupContent(ViewGroup rootView){
  mScrollView=rootView.findViewById(R.id.scroll_view);
  mSiteTitleInput=rootView.findViewById(R.id.site_creation_site_title_row);
  mSiteTitleInput.addTextChangedListener(this);
  mSiteTitleInput.setOnEditorCommitListener(new WPLoginInputRow.OnEditorCommitListener(){
    @Override public void onEditorCommit(){
      mSiteTaglineInput.getEditText().requestFocus();
    }
  }
);
  mSiteTaglineInput=rootView.findViewById(R.id.site_creation_site_tagline_row);
  mSiteTaglineInput.addTextChangedListener(this);
  mSiteTaglineInput.setOnEditorCommitListener(new WPLoginInputRow.OnEditorCommitListener(){
    @Override public void onEditorCommit(){
      next();
    }
  }
);
  ViewGroup bottomButtons=rootView.findViewById(R.id.bottom_buttons);
  bottomButtons.setVisibility(View.VISIBLE);
}

Fixed version (ground truth):
@Override protected void setupContent(ViewGroup rootView){
  getActivity().setTitle(R.string.site_creation_site_details_title);
  mScrollView=rootView.findViewById(R.id.scroll_view);
  mSiteTitleInput=rootView.findViewById(R.id.site_creation_site_title_row);
  mSiteTitleInput.addTextChangedListener(this);
  mSiteTitleInput.setOnEditorCommitListener(new WPLoginInputRow.OnEditorCommitListener(){
    @Override public void onEditorCommit(){
      mSiteTaglineInput.getEditText().requestFocus();
    }
  }
);
  mSiteTaglineInput=rootView.findViewById(R.id.site_creation_site_tagline_row);
  mSiteTaglineInput.addTextChangedListener(this);
  mSiteTaglineInput.setOnEditorCommitListener(new WPLoginInputRow.OnEditorCommitListener(){
    @Override public void onEditorCommit(){
      next();
    }
  }
);
  ViewGroup bottomButtons=rootView.findViewById(R.id.bottom_buttons);
  bottomButtons.setVisibility(View.VISIBLE);
}
Program: 13444
Project: 13444
Buggy source:
@Override protected void setupContent(ViewGroup rootView){
  RecyclerView recyclerView=(RecyclerView)rootView.findViewById(R.id.recycler_view);
  recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
  recyclerView.setAdapter(mSiteCreationThemeAdapter);
}

Fixed version (ground truth):
@Override protected void setupContent(ViewGroup rootView){
  getActivity().setTitle(R.string.site_creation_theme_selection_title);
  RecyclerView recyclerView=(RecyclerView)rootView.findViewById(R.id.recycler_view);
  recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
  recyclerView.setAdapter(mSiteCreationThemeAdapter);
}
Program: 13445
Project: 13445
Buggy source:
private void initShareActionMediaButton(final ViewGroup layout,boolean sharingMediaFile){
  mShareMediaBtn=(Button)layout.findViewById(R.id.secondary_button);
  addShareActionListener(mShareMediaBtn,ShareAction.SHARE_TO_MEDIA_LIBRARY);
  mShareMediaBtn.setVisibility(sharingMediaFile ? View.VISIBLE : View.GONE);
  mShareMediaBtn.setText(R.string.share_action_media);
}

Fixed version (ground truth):
private void initShareActionMediaButton(final ViewGroup layout,boolean sharingMediaFile){
  mShareMediaBtn=layout.findViewById(R.id.secondary_button);
  addShareActionListener(mShareMediaBtn,ShareAction.SHARE_TO_MEDIA_LIBRARY);
  mShareMediaBtn.setVisibility(sharingMediaFile ? View.VISIBLE : View.GONE);
  mShareMediaBtn.setText(R.string.share_action_media);
}
Program: 13446
Project: 13446
Buggy source:
private void initRecyclerView(ViewGroup layout){
  mRecyclerView=(RecyclerView)layout.findViewById(R.id.recycler_view);
  mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
  mRecyclerView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
  mRecyclerView.setItemAnimator(null);
  mRecyclerView.setAdapter(createSiteAdapter());
}

Fixed version (ground truth):
private void initRecyclerView(ViewGroup layout){
  mRecyclerView=layout.findViewById(R.id.recycler_view);
  mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
  mRecyclerView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
  mRecyclerView.setItemAnimator(null);
  mRecyclerView.setAdapter(createSiteAdapter());
}
Program: 13447
Project: 13447
Buggy source:
private void initShareActionPostButton(final ViewGroup layout){
  mSharePostBtn=(Button)layout.findViewById(R.id.primary_button);
  addShareActionListener(mSharePostBtn,ShareAction.SHARE_TO_POST);
  mSharePostBtn.setVisibility(View.VISIBLE);
  mSharePostBtn.setText(R.string.share_action_post);
}

Fixed version (ground truth):
private void initShareActionPostButton(final ViewGroup layout){
  mSharePostBtn=layout.findViewById(R.id.primary_button);
  addShareActionListener(mSharePostBtn,ShareAction.SHARE_TO_POST);
  mSharePostBtn.setVisibility(View.VISIBLE);
  mSharePostBtn.setText(R.string.share_action_post);
}
Program: 13450
Project: 13450
Buggy source:
private void setActionBarTitleToThemeName(){
  String themeName=getIntent().getStringExtra(THEME_NAME);
  if (getSupportActionBar() != null && themeName != null) {
    setTitle("String_Node_Str");
    getSupportActionBar().setTitle(themeName);
  }
}

Fixed version (ground truth):
private void setActionBarTitleToThemeName(){
  String themeName=getIntent().getStringExtra(THEME_NAME);
  if (getSupportActionBar() != null && themeName != null) {
    getSupportActionBar().setTitle(themeName);
  }
}
Program: 13451
Project: 13451
Buggy source:
void setTitle(String title){
  Toolbar toolbar=getToolbar();
  if (toolbar != null) {
    toolbar.setTitle(title);
  }
}

Fixed version (ground truth):
void setTitle(String title){
  Toolbar toolbar=getToolbar();
  if (toolbar != null) {
    toolbar.setTitle(title);
  }
  if (getActivity() != null) {
    getActivity().setTitle(title);
  }
}
Program: 13452
Project: 13452
Buggy source:
@Override public void onBindViewHolder(ViewHolder viewHolder,int position){
  PluginBrowserViewHolder holder=(PluginBrowserViewHolder)viewHolder;
  ImmutablePluginModel plugin=(ImmutablePluginModel)getItem(position);
  if (plugin == null) {
    return;
  }
  holder.nameText.setText(plugin.getDisplayName());
  holder.authorText.setText(plugin.getAuthorName());
  holder.icon.setImageUrl(plugin.getIcon(),ImageType.PLUGIN_ICON);
  if (plugin.isInstalled()) {
    @StringRes int textResId;
    @ColorRes int colorResId;
    @DrawableRes int drawableResId;
    if (PluginUtils.isUpdateAvailable(plugin)) {
      textResId=R.string.plugin_needs_update;
      colorResId=R.color.alert_yellow;
      drawableResId=R.drawable.plugin_update_available_icon;
    }
 else     if (plugin.isActive()) {
      textResId=R.string.plugin_active;
      colorResId=R.color.alert_green;
      drawableResId=R.drawable.ic_checkmark_green_24dp;
    }
 else {
      textResId=R.string.plugin_inactive;
      colorResId=R.color.grey;
      drawableResId=R.drawable.ic_cross_grey_600_24dp;
    }
    holder.mStatusText.setText(textResId);
    holder.mStatusText.setTextColor(getResources().getColor(colorResId));
    holder.mStatusIcon.setImageResource(drawableResId);
    holder.mStatusContainer.setVisibility(View.VISIBLE);
    holder.mRatingBar.setVisibility(View.GONE);
  }
 else {
    holder.statusContainer.setVisibility(View.GONE);
    holder.ratingBar.setVisibility(View.VISIBLE);
    holder.ratingBar.setRating(plugin.getAverageStarRating());
  }
}

Fixed version (ground truth):
@Override public void onBindViewHolder(ViewHolder viewHolder,int position){
  PluginBrowserViewHolder holder=(PluginBrowserViewHolder)viewHolder;
  ImmutablePluginModel plugin=(ImmutablePluginModel)getItem(position);
  if (plugin == null) {
    return;
  }
  holder.mNameText.setText(plugin.getDisplayName());
  holder.mAuthorText.setText(plugin.getAuthorName());
  holder.mIcon.setImageUrl(plugin.getIcon(),ImageType.PLUGIN_ICON);
  if (plugin.isInstalled()) {
    @StringRes int textResId;
    @ColorRes int colorResId;
    @DrawableRes int drawableResId;
    if (PluginUtils.isUpdateAvailable(plugin)) {
      textResId=R.string.plugin_needs_update;
      colorResId=R.color.alert_yellow;
      drawableResId=R.drawable.plugin_update_available_icon;
    }
 else     if (plugin.isActive()) {
      textResId=R.string.plugin_active;
      colorResId=R.color.alert_green;
      drawableResId=R.drawable.ic_checkmark_green_24dp;
    }
 else {
      textResId=R.string.plugin_inactive;
      colorResId=R.color.grey;
      drawableResId=R.drawable.ic_cross_grey_600_24dp;
    }
    holder.mStatusText.setText(textResId);
    holder.mStatusText.setTextColor(getResources().getColor(colorResId));
    holder.mStatusIcon.setImageResource(drawableResId);
    holder.mStatusContainer.setVisibility(View.VISIBLE);
    holder.mRatingBar.setVisibility(View.GONE);
  }
 else {
    holder.mStatusContainer.setVisibility(View.GONE);
    holder.mRatingBar.setVisibility(View.VISIBLE);
    holder.mRatingBar.setRating(plugin.getAverageStarRating());
  }
}
Program: 13454
Project: 13454
Buggy source:
public static Map<Integer,CategoryModel> getAllCategories(){
  String sqlCommand=sqlSelectAllCategories() + "String_Node_Str";
  Cursor cursor=WordPress.wpDB.getDatabase().rawQuery(sqlCommand,null);
  if (cursor == null || !cursor.moveToFirst() || cursor.getCount() == 0) {
    return null;
  }
  Map<Integer,CategoryModel> models=new HashMap<>();
  for (int i=0; i < cursor.getCount(); ++i) {
    CategoryModel model=new CategoryModel();
    model.deserializeFromDatabase(cursor);
    models.put(model.id,model);
    cursor.moveToNext();
  }
  return models;
}

Fixed version (ground truth):
public static SparseArrayCompat<CategoryModel> getAllCategories(){
  String sqlCommand=sqlSelectAllCategories() + "String_Node_Str";
  Cursor cursor=WordPress.wpDB.getDatabase().rawQuery(sqlCommand,null);
  if (cursor == null || !cursor.moveToFirst() || cursor.getCount() == 0) {
    return null;
  }
  SparseArrayCompat<CategoryModel> models=new SparseArrayCompat<>();
  for (int i=0; i < cursor.getCount(); ++i) {
    CategoryModel model=new CategoryModel();
    model.deserializeFromDatabase(cursor);
    models.put(model.id,model);
    cursor.moveToNext();
  }
  return models;
}
Program: 13455
Project: 13455
Buggy source:
public Map<Long,JSONObject> getBlogSettings(){
  return mBlogSettings;
}

Fixed version (ground truth):
public LongSparseArray<JSONObject> getBlogSettings(){
  return mBlogSettings;
}
Program: 13456
Project: 13456
Buggy source:
public void updateJson(JSONObject json){
  mBlogSettings=new HashMap<>();
  mOtherSettings=JSONUtils.queryJSON(json,KEY_OTHER,new JSONObject());
  mWPComSettings=JSONUtils.queryJSON(json,KEY_WPCOM,new JSONObject());
  JSONArray siteSettingsArray=JSONUtils.queryJSON(json,KEY_BLOGS,new JSONArray());
  for (int i=0; i < siteSettingsArray.length(); i++) {
    try {
      JSONObject siteSetting=siteSettingsArray.getJSONObject(i);
      mBlogSettings.put(siteSetting.optLong(KEY_BLOG_ID),siteSetting);
    }
 catch (    JSONException e) {
      AppLog.e(AppLog.T.NOTIFS,"String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public void updateJson(JSONObject json){
  mBlogSettings=new LongSparseArray<>();
  mOtherSettings=JSONUtils.queryJSON(json,KEY_OTHER,new JSONObject());
  mWPComSettings=JSONUtils.queryJSON(json,KEY_WPCOM,new JSONObject());
  JSONArray siteSettingsArray=JSONUtils.queryJSON(json,KEY_BLOGS,new JSONArray());
  for (int i=0; i < siteSettingsArray.length(); i++) {
    try {
      JSONObject siteSetting=siteSettingsArray.getJSONObject(i);
      mBlogSettings.put(siteSetting.optLong(KEY_BLOG_ID),siteSetting);
    }
 catch (    JSONException e) {
      AppLog.e(AppLog.T.NOTIFS,"String_Node_Str");
    }
  }
}
Program: 13458
Project: 13458
Buggy source:
private void setCategories(){
  if (mSiteSettings.isSameCategoryList(mCategoryPref.getEntryValues())) {
    mCategoryPref.setValue(String.valueOf(mSiteSettings.getDefaultCategory()));
    mCategoryPref.setSummary(mSiteSettings.getDefaultCategoryForDisplay());
    return;
  }
  Map<Integer,String> categories=mSiteSettings.getCategoryNames();
  CharSequence[] entries=new CharSequence[categories.size()];
  CharSequence[] values=new CharSequence[categories.size()];
  int i=0;
  for (  Integer key : categories.keySet()) {
    entries[i]=categories.get(key);
    values[i]=String.valueOf(key);
    if (key == UNCATEGORIZED_CATEGORY_ID) {
      CharSequence temp=entries[0];
      entries[0]=entries[i];
      entries[i]=temp;
      temp=values[0];
      values[0]=values[i];
      values[i]=temp;
    }
    ++i;
  }
  mCategoryPref.setEntries(entries);
  mCategoryPref.setEntryValues(values);
  mCategoryPref.setValue(String.valueOf(mSiteSettings.getDefaultCategory()));
  mCategoryPref.setSummary(mSiteSettings.getDefaultCategoryForDisplay());
}

Fixed version (ground truth):
private void setCategories(){
  if (mSiteSettings.isSameCategoryList(mCategoryPref.getEntryValues())) {
    mCategoryPref.setValue(String.valueOf(mSiteSettings.getDefaultCategory()));
    mCategoryPref.setSummary(mSiteSettings.getDefaultCategoryForDisplay());
    return;
  }
  SparseArrayCompat<String> categories=mSiteSettings.getCategoryNames();
  CharSequence[] entries=new CharSequence[categories.size()];
  CharSequence[] values=new CharSequence[categories.size()];
  int i=0;
  int numOfCategories=categories.size();
  for (int j=0; j < numOfCategories; j++) {
    int key=categories.keyAt(j);
    entries[i]=categories.get(key);
    values[i]=String.valueOf(key);
    if (key == UNCATEGORIZED_CATEGORY_ID) {
      CharSequence temp=entries[0];
      entries[0]=entries[i];
      entries[i]=temp;
      temp=values[0];
      values[0]=values[i];
      values[i]=temp;
    }
    ++i;
  }
  mCategoryPref.setEntries(entries);
  mCategoryPref.setEntryValues(values);
  mCategoryPref.setValue(String.valueOf(mSiteSettings.getDefaultCategory()));
  mCategoryPref.setSummary(mSiteSettings.getDefaultCategoryForDisplay());
}
Program: 13459
Project: 13459
Buggy source:
/** 
 * Need to defer loading the cached settings to a thread so it completes after initialization.
 */
private void loadCachedSettings(){
  Cursor localSettings=SiteSettingsTable.getSettings(mSite.getId());
  if (localSettings != null && localSettings.getCount() > 0) {
    mSettings.isInLocalTable=true;
    Map<Integer,CategoryModel> cachedModels=SiteSettingsTable.getAllCategories();
    mSettings.deserializeOptionsDatabaseCursor(localSettings,cachedModels);
    mSettings.language=languageIdToLanguageCode(Integer.toString(mSettings.languageId));
    if (mSettings.language == null) {
      setLanguageCode(LanguageUtils.getPatchedCurrentDeviceLanguage(null));
    }
    mRemoteSettings.language=mSettings.language;
    mRemoteSettings.languageId=mSettings.languageId;
    notifyUpdatedOnUiThread();
  }
 else {
    mSettings.isInLocalTable=false;
    mSettings.localTableId=mSite.getId();
    setAddress(mSite.getUrl());
    setUsername(mSite.getUsername());
    setPassword(mSite.getPassword());
    setTitle(mSite.getName());
  }
  if (!SiteUtils.isAccessedViaWPComRest(mSite)) {
    setUsername(mSite.getUsername());
    setPassword(mSite.getPassword());
  }
  if (localSettings != null) {
    localSettings.close();
  }
}

Fixed version (ground truth):
/** 
 * Need to defer loading the cached settings to a thread so it completes after initialization.
 */
private void loadCachedSettings(){
  Cursor localSettings=SiteSettingsTable.getSettings(mSite.getId());
  if (localSettings != null && localSettings.getCount() > 0) {
    mSettings.isInLocalTable=true;
    SparseArrayCompat<CategoryModel> cachedModels=SiteSettingsTable.getAllCategories();
    mSettings.deserializeOptionsDatabaseCursor(localSettings,cachedModels);
    mSettings.language=languageIdToLanguageCode(Integer.toString(mSettings.languageId));
    if (mSettings.language == null) {
      setLanguageCode(LanguageUtils.getPatchedCurrentDeviceLanguage(null));
    }
    mRemoteSettings.language=mSettings.language;
    mRemoteSettings.languageId=mSettings.languageId;
    notifyUpdatedOnUiThread();
  }
 else {
    mSettings.isInLocalTable=false;
    mSettings.localTableId=mSite.getId();
    setAddress(mSite.getUrl());
    setUsername(mSite.getUsername());
    setPassword(mSite.getPassword());
    setTitle(mSite.getName());
  }
  if (!SiteUtils.isAccessedViaWPComRest(mSite)) {
    setUsername(mSite.getUsername());
    setPassword(mSite.getPassword());
  }
  if (localSettings != null) {
    localSettings.close();
  }
}
Program: 13460
Project: 13460
Buggy source:
public @NonNull Map<Integer,String> getCategoryNames(){
  Map<Integer,String> categoryNames=new HashMap<>();
  if (mSettings.categories != null && mSettings.categories.length > 0) {
    for (    CategoryModel model : mSettings.categories) {
      categoryNames.put(model.id,Html.fromHtml(model.name).toString());
    }
  }
  return categoryNames;
}

Fixed version (ground truth):
public @NonNull SparseArrayCompat<String> getCategoryNames(){
  SparseArrayCompat<String> categoryNames=new SparseArrayCompat<>();
  if (mSettings.categories != null && mSettings.categories.length > 0) {
    for (    CategoryModel model : mSettings.categories) {
      categoryNames.put(model.id,Html.fromHtml(model.name).toString());
    }
  }
  return categoryNames;
}
Program: 13461
Project: 13461
Buggy source:
private float getCurrentMediaProgress(){
  float currentMediaProgress=0.0f;
  int size=sNotificationData.mediaItemToProgressMap.values().size();
  for (  Float itemProgress : sNotificationData.mediaItemToProgressMap.values()) {
    currentMediaProgress+=(itemProgress / size);
  }
  return currentMediaProgress;
}

Fixed version (ground truth):
private float getCurrentMediaProgress(){
  float currentMediaProgress=0.0f;
  int size=sNotificationData.mediaItemToProgressMap.size();
  for (int i=0; i < size; i++) {
    float itemProgress=sNotificationData.mediaItemToProgressMap.get(i);
    currentMediaProgress+=(itemProgress / size);
  }
  return currentMediaProgress;
}
Program: 13463
Project: 13463
Buggy source:
private static String getPageDateHeaderText(Context context,PostModel page){
  if (page.isLocalDraft()) {
    return context.getString(R.string.local_draft);
  }
 else   if (PostStatus.fromPost(page) == PostStatus.SCHEDULED) {
    return DateUtils.formatDateTime(context,DateTimeUtils.timestampFromIso8601Millis(page.getDateCreated()),DateUtils.FORMAT_ABBREV_ALL);
  }
 else {
    Date dtCreated=DateTimeUtils.dateUTCFromIso8601(page.getDateCreated());
    Date dtNow=DateTimeUtils.nowUTC();
    int daysBetween=DateTimeUtils.daysBetween(dtCreated,dtNow);
    if (daysBetween == 0) {
      return context.getString(R.string.today);
    }
 else     if (daysBetween == 1) {
      return context.getString(R.string.yesterday);
    }
 else     if (DateTimeUtils.isSameMonthAndYear(dtCreated,dtNow)) {
      return String.format(context.getString(R.string.days_ago),daysBetween);
    }
 else     if (DateTimeUtils.isSameYear(dtCreated,dtNow)) {
      return new SimpleDateFormat("String_Node_Str").format(dtCreated);
    }
 else {
      return new SimpleDateFormat("String_Node_Str").format(dtCreated);
    }
  }
}

Fixed version (ground truth):
private static String getPageDateHeaderText(Context context,PostModel page){
  if (page.isLocalDraft()) {
    return context.getString(R.string.local_draft);
  }
 else   if (PostStatus.fromPost(page) == PostStatus.SCHEDULED) {
    return DateUtils.formatDateTime(context,DateTimeUtils.timestampFromIso8601Millis(page.getDateCreated()),DateUtils.FORMAT_ABBREV_ALL);
  }
 else {
    Date dtCreated=DateTimeUtils.dateUTCFromIso8601(page.getDateCreated());
    Date dtNow=DateTimeUtils.nowUTC();
    int daysBetween=DateTimeUtils.daysBetween(dtCreated,dtNow);
    if (daysBetween == 0) {
      return context.getString(R.string.today);
    }
 else     if (daysBetween == 1) {
      return context.getString(R.string.yesterday);
    }
 else     if (DateTimeUtils.isSameMonthAndYear(dtCreated,dtNow)) {
      return String.format(context.getString(R.string.days_ago),daysBetween);
    }
 else     if (DateTimeUtils.isSameYear(dtCreated,dtNow)) {
      return new SimpleDateFormat("String_Node_Str",Locale.getDefault()).format(dtCreated);
    }
 else {
      return new SimpleDateFormat("String_Node_Str",Locale.getDefault()).format(dtCreated);
    }
  }
}
Program: 13466
Project: 13466
Buggy source:
/** 
 * Get the current date in the form of "yyyy-MM-dd HH:mm:ss"
 */
private static String getCurrentDatetime(){
  String pattern="String_Node_Str";
  SimpleDateFormat sdf=new SimpleDateFormat(pattern);
  return sdf.format(new Date());
}

Fixed version (ground truth):
/** 
 * Get the current date in the form of "yyyy-MM-dd HH:mm:ss"
 */
private static String getCurrentDatetime(){
  String pattern="String_Node_Str";
  SimpleDateFormat sdf=new SimpleDateFormat(pattern,Locale.ROOT);
  return sdf.format(new Date());
}
Program: 13468
Project: 13468
Buggy source:
private static String getCurrentDateTimeTZ(String blogTimeZoneOption,String pattern){
  Date date=new Date();
  SimpleDateFormat gmtDf=new SimpleDateFormat(pattern);
  if (blogTimeZoneOption == null) {
    AppLog.w(T.UTILS,"String_Node_Str");
    return gmtDf.format(date);
  }
  AppLog.v(T.STATS,"String_Node_Str" + blogTimeZoneOption);
  String timezoneNormalized;
  if (TextUtils.isEmpty(blogTimeZoneOption) || blogTimeZoneOption.equals("String_Node_Str") || blogTimeZoneOption.equals("String_Node_Str")) {
    timezoneNormalized="String_Node_Str";
  }
 else {
    String[] timezoneSplitted=org.apache.commons.lang3.StringUtils.split(blogTimeZoneOption,"String_Node_Str");
    timezoneNormalized=timezoneSplitted[0];
    if (timezoneSplitted.length > 1 && timezoneSplitted[1].equals("String_Node_Str")) {
      timezoneNormalized+="String_Node_Str";
    }
    if (timezoneNormalized.startsWith("String_Node_Str")) {
      timezoneNormalized="String_Node_Str" + timezoneNormalized;
    }
 else {
      if (timezoneNormalized.startsWith("String_Node_Str")) {
        timezoneNormalized="String_Node_Str" + timezoneNormalized;
      }
 else {
        timezoneNormalized="String_Node_Str" + timezoneNormalized;
      }
    }
  }
  AppLog.v(T.STATS,"String_Node_Str" + timezoneNormalized);
  gmtDf.setTimeZone(TimeZone.getTimeZone(timezoneNormalized));
  return gmtDf.format(date);
}

Fixed version (ground truth):
private static String getCurrentDateTimeTZ(String blogTimeZoneOption,String pattern){
  Date date=new Date();
  SimpleDateFormat gmtDf=new SimpleDateFormat(pattern,Locale.ROOT);
  if (blogTimeZoneOption == null) {
    AppLog.w(T.UTILS,"String_Node_Str");
    return gmtDf.format(date);
  }
  AppLog.v(T.STATS,"String_Node_Str" + blogTimeZoneOption);
  String timezoneNormalized;
  if (TextUtils.isEmpty(blogTimeZoneOption) || blogTimeZoneOption.equals("String_Node_Str") || blogTimeZoneOption.equals("String_Node_Str")) {
    timezoneNormalized="String_Node_Str";
  }
 else {
    String[] timezoneSplitted=org.apache.commons.lang3.StringUtils.split(blogTimeZoneOption,"String_Node_Str");
    timezoneNormalized=timezoneSplitted[0];
    if (timezoneSplitted.length > 1 && timezoneSplitted[1].equals("String_Node_Str")) {
      timezoneNormalized+="String_Node_Str";
    }
    if (timezoneNormalized.startsWith("String_Node_Str")) {
      timezoneNormalized="String_Node_Str" + timezoneNormalized;
    }
 else {
      if (timezoneNormalized.startsWith("String_Node_Str")) {
        timezoneNormalized="String_Node_Str" + timezoneNormalized;
      }
 else {
        timezoneNormalized="String_Node_Str" + timezoneNormalized;
      }
    }
  }
  AppLog.v(T.STATS,"String_Node_Str" + timezoneNormalized);
  gmtDf.setTimeZone(TimeZone.getTimeZone(timezoneNormalized));
  return gmtDf.format(date);
}
Program: 13469
Project: 13469
Buggy source:
/** 
 * Get the current date in the form of yyyy-MM-dd (EX: 2013-07-18) 
 */
public static String getCurrentDate(){
  SimpleDateFormat sdf=new SimpleDateFormat(StatsConstants.STATS_INPUT_DATE_FORMAT);
  return sdf.format(new Date());
}

Fixed version (ground truth):
/** 
 * Get the current date in the form of yyyy-MM-dd (EX: 2013-07-18) 
 */
public static String getCurrentDate(){
  SimpleDateFormat sdf=new SimpleDateFormat(StatsConstants.STATS_INPUT_DATE_FORMAT,Locale.ROOT);
  return sdf.format(new Date());
}