nus-yam/ex-repair huggingface dataset:
Program: 14242
Project: 14242
Buggy source:
public WPImageGetter(TextView view,int maxSize,ImageLoader imageLoader,Drawable loadingDrawable,Drawable failedDrawable){
  mWeakView=new WeakReference<>(view);
  mMaxSize=maxSize;
  mImageLoader=imageLoader;
  mLoadingDrawable=loadingDrawable;
  mFailedDrawable=failedDrawable;
}

Fixed version (ground truth):
public WPImageGetter(TextView view,int maxSize,ImageLoader imageLoader,Drawable loadingDrawable,Drawable failedDrawable){
  mWeakView=new WeakReference<TextView>(view);
  mMaxSize=maxSize;
  mImageLoader=imageLoader;
  mLoadingDrawable=loadingDrawable;
  mFailedDrawable=failedDrawable;
}
Program: 14244
Project: 14244
Buggy source:
private String getCloseAfterSummary(int period){
  if (period == 0)   getString(R.string.never);
  return getResources().getQuantityString(R.plurals.days_quantity,period,period);
}

Fixed version (ground truth):
private String getCloseAfterSummary(int period){
  if (period == 0)   return getString(R.string.never);
  return getResources().getQuantityString(R.plurals.days_quantity,period,period);
}
Program: 14245
Project: 14245
Buggy source:
private String getThreadingSummary(int levels){
  if (levels <= 1)   getString(R.string.none);
  return String.format(getString(R.string.levels_quantity),levels);
}

Fixed version (ground truth):
private String getThreadingSummary(int levels){
  if (levels <= 1)   return getString(R.string.none);
  return String.format(getString(R.string.levels_quantity),levels);
}
Program: 14246
Project: 14246
Buggy source:
public static String getPhotonImageUrl(String imageUrl,int width,int height,Quality quality){
  if (TextUtils.isEmpty(imageUrl)) {
    return "String_Node_Str";
  }
  int schemePos=imageUrl.indexOf("String_Node_Str");
  if (schemePos == -1) {
    return imageUrl;
  }
  imageUrl=UrlUtils.removeQuery(imageUrl);
  if (imageUrl.endsWith("String_Node_Str")) {
    return imageUrl;
  }
  if (isMshotsUrl(imageUrl)) {
    return imageUrl + "String_Node_Str" + width+ "String_Node_Str"+ height;
  }
  String query="String_Node_Str";
switch (quality) {
case HIGH:
    query+="String_Node_Str";
  break;
case LOW:
query+="String_Node_Str";
break;
default :
query+="String_Node_Str";
break;
}
if (width > 0 && height > 0) {
query+="String_Node_Str" + width + "String_Node_Str"+ height;
}
 else if (width > 0) {
query+="String_Node_Str" + width;
}
 else if (height > 0) {
query+="String_Node_Str" + height;
}
if (imageUrl.contains("String_Node_Str")) {
if (imageUrl.contains("String_Node_Str") || imageUrl.contains("String_Node_Str") || imageUrl.contains("String_Node_Str")) return imageUrl + query;
}
if (UrlUtils.isHttps(imageUrl)) {
return "String_Node_Str" + imageUrl.substring(schemePos + 3,imageUrl.length()) + query;
}
 else {
return "String_Node_Str" + imageUrl.substring(schemePos + 3,imageUrl.length()) + query;
}
}

Fixed version (ground truth):
public static String getPhotonImageUrl(String imageUrl,int width,int height,Quality quality){
  if (TextUtils.isEmpty(imageUrl)) {
    return "String_Node_Str";
  }
  int schemePos=imageUrl.indexOf("String_Node_Str");
  if (schemePos == -1) {
    return imageUrl;
  }
  imageUrl=UrlUtils.removeQuery(imageUrl);
  if (imageUrl.endsWith("String_Node_Str")) {
    return imageUrl;
  }
  if (isMshotsUrl(imageUrl)) {
    return imageUrl + "String_Node_Str" + width+ "String_Node_Str"+ height;
  }
  String query="String_Node_Str";
switch (quality) {
case HIGH:
    query+="String_Node_Str";
  break;
case LOW:
query+="String_Node_Str";
break;
default :
query+="String_Node_Str";
break;
}
if (width > 0 && height > 0) {
query+="String_Node_Str" + width + "String_Node_Str"+ height;
}
 else if (width > 0) {
query+="String_Node_Str" + width;
}
 else if (height > 0) {
query+="String_Node_Str" + height;
}
if (imageUrl.contains("String_Node_Str")) {
if (imageUrl.contains("String_Node_Str") || imageUrl.contains("String_Node_Str") || imageUrl.contains("String_Node_Str")) return imageUrl + query;
}
if (imageUrl.contains("String_Node_Str")) {
return imageUrl + query;
}
if (UrlUtils.isHttps(imageUrl)) {
return "String_Node_Str" + imageUrl.substring(schemePos + 3,imageUrl.length()) + query;
}
 else {
return "String_Node_Str" + imageUrl.substring(schemePos + 3,imageUrl.length()) + query;
}
}
Program: 14247
Project: 14247
Buggy source:
private void loadThumbnail(final String src,final ImageView thumbnailImage){
  Thread thread=new Thread(new Runnable(){
    @Override public void run(){
      if (isAdded()) {
        final Uri localUri=Utils.downloadExternalMedia(getActivity(),Uri.parse(src));
        getActivity().runOnUiThread(new Runnable(){
          @Override public void run(){
            thumbnailImage.setImageURI(localUri);
          }
        }
);
      }
    }
  }
);
  thread.start();
}

Fixed version (ground truth):
private void loadThumbnail(final String src,final ImageView thumbnailImage){
  Thread thread=new Thread(new Runnable(){
    @Override public void run(){
      if (isAdded()) {
        final Uri localUri=Utils.downloadExternalMedia(getActivity(),Uri.parse(src));
        if (getActivity() != null) {
          getActivity().runOnUiThread(new Runnable(){
            @Override public void run(){
              thumbnailImage.setImageURI(localUri);
            }
          }
);
        }
      }
    }
  }
);
  thread.start();
}
Program: 14249
Project: 14249
Buggy source:
public WPImageGetter(TextView view,int maxSize,ImageLoader imageLoader,Drawable loadingDrawable,Drawable failedDrawable){
  mWeakView=new WeakReference<TextView>(view);
  mMaxSize=maxSize;
  mImageLoader=imageLoader;
  mLoadingDrawable=loadingDrawable;
  mFailedDrawable=failedDrawable;
}

Fixed version (ground truth):
public WPImageGetter(TextView view,int maxSize,ImageLoader imageLoader,Drawable loadingDrawable,Drawable failedDrawable){
  mWeakView=new WeakReference<>(view);
  mMaxSize=maxSize;
  mImageLoader=imageLoader;
  mLoadingDrawable=loadingDrawable;
  mFailedDrawable=failedDrawable;
}
Program: 14251
Project: 14251
Buggy source:
public WPImageGetter(TextView view,int maxSize,ImageLoader imageLoader,Drawable loadingDrawable,Drawable failedDrawable){
  mWeakView=new WeakReference<TextView>(view);
  mMaxSize=maxSize;
  mImageLoader=imageLoader;
  mLoadingDrawable=loadingDrawable;
  mFailedDrawable=failedDrawable;
}

Fixed version (ground truth):
public WPImageGetter(TextView view,int maxSize,ImageLoader imageLoader,Drawable loadingDrawable,Drawable failedDrawable){
  mWeakView=new WeakReference<>(view);
  mMaxSize=maxSize;
  mImageLoader=imageLoader;
  mLoadingDrawable=loadingDrawable;
  mFailedDrawable=failedDrawable;
}
Program: 14252
Project: 14252
Buggy source:
private void toggleViews(boolean enabled){
  mShowHeader.setEnabled(enabled);
  mShowImages.setEnabled(enabled);
  mPreviewHeader.setEnabled(enabled);
  mRelatedPostsListHeader.setEnabled(enabled);
  mRelatedPostsList.setEnabled(enabled);
}

Fixed version (ground truth):
private void toggleViews(boolean enabled){
  mShowHeader.setEnabled(enabled);
  mShowImages.setEnabled(enabled);
  mPreviewHeader.setEnabled(enabled);
  mRelatedPostsListHeader.setEnabled(enabled);
  if (enabled) {
    mRelatedPostsList.setAlpha(1.0f);
  }
 else {
    mRelatedPostsList.setAlpha(0.5f);
  }
}
Program: 14253
Project: 14253
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup root,Bundle savedInstanceState){
  setStyle(STYLE_NORMAL,R.style.Calypso_SiteSettingsTheme);
  getDialog().setTitle(R.string.site_settings_related_posts_title);
  View v=inflater.inflate(R.layout.related_posts_dialog,root,false);
  mShowRelatedPosts=(WPSwitch)v.findViewById(R.id.toggle_related_posts_switch);
  mShowHeader=(CheckBox)v.findViewById(R.id.show_header_checkbox);
  mShowImages=(CheckBox)v.findViewById(R.id.show_images_checkbox);
  mPreviewHeader=(TextView)v.findViewById(R.id.preview_header);
  mRelatedPostsListHeader=(TextView)v.findViewById(R.id.related_posts_list_header);
  mRelatedPostsList=(LinearLayout)v.findViewById(R.id.related_posts_list);
  Bundle args=getArguments();
  if (args != null) {
    mShowRelatedPosts.setChecked(args.getBoolean(SHOW_RELATED_POSTS_KEY));
    mShowHeader.setChecked(args.getBoolean(SHOW_HEADER_KEY));
    mShowImages.setChecked(args.getBoolean(SHOW_IMAGES_KEY));
  }
  mPreviewImages=new ArrayList<>();
  mPreviewImages.add((ImageView)v.findViewById(R.id.related_post_image1));
  mPreviewImages.add((ImageView)v.findViewById(R.id.related_post_image2));
  mPreviewImages.add((ImageView)v.findViewById(R.id.related_post_image3));
  mShowRelatedPosts.setOnCheckedChangeListener(this);
  mShowHeader.setOnCheckedChangeListener(this);
  mShowImages.setOnCheckedChangeListener(this);
  toggleViews(mShowRelatedPosts.isChecked());
  return v;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup root,Bundle savedInstanceState){
  setStyle(STYLE_NORMAL,R.style.Calypso_SiteSettingsTheme);
  getDialog().setTitle(R.string.site_settings_related_posts_title);
  View v=inflater.inflate(R.layout.related_posts_dialog,root,false);
  mShowRelatedPosts=(WPSwitch)v.findViewById(R.id.toggle_related_posts_switch);
  mShowHeader=(CheckBox)v.findViewById(R.id.show_header_checkbox);
  mShowImages=(CheckBox)v.findViewById(R.id.show_images_checkbox);
  mPreviewHeader=(TextView)v.findViewById(R.id.preview_header);
  mRelatedPostsListHeader=(TextView)v.findViewById(R.id.related_posts_list_header);
  mRelatedPostsList=(LinearLayout)v.findViewById(R.id.related_posts_list);
  mPreviewImages=new ArrayList<>();
  mPreviewImages.add((ImageView)v.findViewById(R.id.related_post_image1));
  mPreviewImages.add((ImageView)v.findViewById(R.id.related_post_image2));
  mPreviewImages.add((ImageView)v.findViewById(R.id.related_post_image3));
  Bundle args=getArguments();
  if (args != null) {
    mShowRelatedPosts.setChecked(args.getBoolean(SHOW_RELATED_POSTS_KEY));
    mShowHeader.setChecked(args.getBoolean(SHOW_HEADER_KEY));
    mShowImages.setChecked(args.getBoolean(SHOW_IMAGES_KEY));
  }
  toggleShowHeader(mShowHeader.isChecked());
  toggleShowImages(mShowImages.isChecked());
  mShowRelatedPosts.setOnCheckedChangeListener(this);
  mShowHeader.setOnCheckedChangeListener(this);
  mShowImages.setOnCheckedChangeListener(this);
  toggleViews(mShowRelatedPosts.isChecked());
  return v;
}
Program: 14254
Project: 14254
Buggy source:
public 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,model.name);
    }
  }
  return categoryNames;
}

Fixed version (ground truth):
public 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,model.name);
    }
  }
  return categoryNames;
}
Program: 14256
Project: 14256
Buggy source:
@Override public void onSuccess(long id,Object result){
  credentialsVerified(true);
  if (result != null && result instanceof HashMap) {
    Map<?,?> resultMap=(HashMap<?,?>)result;
    Map allFormats;
    Object[] supportedFormats;
    if (resultMap.containsKey("String_Node_Str")) {
      allFormats=(Map)resultMap.get("String_Node_Str");
      supportedFormats=(Object[])resultMap.get("String_Node_Str");
    }
 else {
      allFormats=resultMap;
      supportedFormats=allFormats.keySet().toArray();
    }
    mRemoteSettings.postFormats=new HashMap<>();
    for (    Object supportedFormat : supportedFormats) {
      if (allFormats.containsKey(supportedFormat)) {
        mRemoteSettings.postFormats.put(supportedFormat.toString(),allFormats.get(supportedFormat).toString());
      }
    }
    mSettings.postFormats=new HashMap<>(mRemoteSettings.postFormats);
    notifyUpdatedOnUiThread(null);
  }
}

Fixed version (ground truth):
@Override public void onSuccess(long id,Object result){
  credentialsVerified(true);
  if (result != null && result instanceof HashMap) {
    Map<?,?> resultMap=(HashMap<?,?>)result;
    Map allFormats;
    Object[] supportedFormats;
    if (resultMap.containsKey("String_Node_Str")) {
      allFormats=(Map)resultMap.get("String_Node_Str");
      supportedFormats=(Object[])resultMap.get("String_Node_Str");
    }
 else {
      allFormats=resultMap;
      supportedFormats=allFormats.keySet().toArray();
    }
    mRemoteSettings.postFormats=new HashMap<>();
    mRemoteSettings.postFormats.put("String_Node_Str","String_Node_Str");
    for (    Object supportedFormat : supportedFormats) {
      if (allFormats.containsKey(supportedFormat)) {
        mRemoteSettings.postFormats.put(supportedFormat.toString(),allFormats.get(supportedFormat).toString());
      }
    }
    mSettings.postFormats=new HashMap<>(mRemoteSettings.postFormats);
    notifyUpdatedOnUiThread(null);
  }
}
Program: 14257
Project: 14257
Buggy source:
@Override public void onMediaUploadCancelClicked(String mediaId){
}

Fixed version (ground truth):
@Override public void onMediaUploadCancelClicked(String mediaId,boolean delete){
}
Program: 14258
Project: 14258
Buggy source:
@Override public void onMediaUploadCancelClicked(String mediaId){
}

Fixed version (ground truth):
@Override public void onMediaUploadCancelClicked(String mediaId,boolean delete){
}
Program: 14259
Project: 14259
Buggy source:
public static String getBlogId(Blog blog){
  if (blog == null) {
    return null;
  }
  if (blog.isDotcomFlag()) {
    return String.valueOf(blog.getRemoteBlogId());
  }
 else {
    return blog.getApi_blogid();
  }
}

Fixed version (ground truth):
public static String getBlogId(Blog blog){
  if (blog == null) {
    return null;
  }
  if (blog.isDotcomFlag()) {
    return String.valueOf(blog.getRemoteBlogId());
  }
 else {
    String remoteID=blog.getApi_blogid();
    if (StringUtils.isEmpty(remoteID)) {
      return null;
    }
    try {
      int parsedBlogID=Integer.parseInt(remoteID);
      if (parsedBlogID < 1) {
        return null;
      }
    }
 catch (    NumberFormatException e) {
      AppLog.e(T.STATS,"String_Node_Str" + remoteID);
      return null;
    }
    return remoteID;
  }
}
Program: 14260
Project: 14260
Buggy source:
protected void handleInvalidUsernameOrPassword(int messageId){
  mErroneousLogInCount+=1;
  if (mErroneousLogInCount >= WPCOM_ERRONEOUS_LOGIN_THRESHOLD) {
    mPasswordEditText.setError(null);
    mUsernameEditText.setError(null);
    showInvalidUsernameOrPasswordDialog();
  }
 else {
    showUsernameError(messageId);
    showPasswordError(messageId);
  }
  endProgress();
}

Fixed version (ground truth):
protected void handleInvalidUsernameOrPassword(int messageId){
  mErroneousLogInCount+=1;
  if (mErroneousLogInCount >= WPCOM_ERRONEOUS_LOGIN_THRESHOLD) {
    mPasswordEditText.setError(null);
    mUsernameEditText.setError(null);
    showInvalidUsernameOrPasswordDialog();
  }
 else {
    showPasswordError(messageId);
    showUsernameError(messageId);
  }
  endProgress();
}
Program: 14261
Project: 14261
Buggy source:
protected boolean isUserDataValid(){
  final String username=EditTextUtils.getText(mUsernameEditText).trim();
  final String password=EditTextUtils.getText(mPasswordEditText).trim();
  boolean retValue=true;
  if (username.equals("String_Node_Str")) {
    mUsernameEditText.setError(getString(R.string.required_field));
    mUsernameEditText.requestFocus();
    retValue=false;
  }
  if (password.equals("String_Node_Str")) {
    mPasswordEditText.setError(getString(R.string.required_field));
    mPasswordEditText.requestFocus();
    retValue=false;
  }
  return retValue;
}

Fixed version (ground truth):
protected boolean isUserDataValid(){
  final String username=EditTextUtils.getText(mUsernameEditText).trim();
  final String password=EditTextUtils.getText(mPasswordEditText).trim();
  boolean retValue=true;
  if (password.equals("String_Node_Str")) {
    mPasswordEditText.setError(getString(R.string.required_field));
    mPasswordEditText.requestFocus();
    retValue=false;
  }
  if (username.equals("String_Node_Str")) {
    mUsernameEditText.setError(getString(R.string.required_field));
    mUsernameEditText.requestFocus();
    retValue=false;
  }
  return retValue;
}
Program: 14262
Project: 14262
Buggy source:
protected boolean specificShowError(int messageId){
switch (getErrorType(messageId)) {
case USERNAME:
case PASSWORD:
    showUsernameError(messageId);
  showPasswordError(messageId);
return true;
default :
return false;
}
}

Fixed version (ground truth):
protected boolean specificShowError(int messageId){
switch (getErrorType(messageId)) {
case USERNAME:
case PASSWORD:
    showPasswordError(messageId);
  showUsernameError(messageId);
return true;
default :
return false;
}
}
Program: 14263
Project: 14263
Buggy source:
@Override public void onMediaUploadProgress(final String mediaId,final float progress){
  mWebView.post(new Runnable(){
    @Override public void run(){
      String progressString=String.format("String_Node_Str",progress);
      mWebView.execJavaScriptFromString("String_Node_Str" + mediaId + "String_Node_Str"+ progressString+ "String_Node_Str");
    }
  }
);
}

Fixed version (ground truth):
@Override public void onMediaUploadProgress(final String mediaId,final float progress){
  mWebView.post(new Runnable(){
    @Override public void run(){
      String progressString=String.format(Locale.US,"String_Node_Str",progress);
      mWebView.execJavaScriptFromString("String_Node_Str" + mediaId + "String_Node_Str"+ progressString+ "String_Node_Str");
    }
  }
);
}
Program: 14264
Project: 14264
Buggy source:
private void addFragment(){
  if (mIsInSearchMode) {
    addSearchFragment();
  }
 else {
    addBrowserFragment();
  }
}

Fixed version (ground truth):
private void addFragment(){
  if (mIsInSearchMode) {
    addBrowserFragment();
    addSearchFragment();
  }
 else {
    addBrowserFragment();
  }
}
Program: 14265
Project: 14265
Buggy source:
private void addBrowserFragment(){
  FragmentTransaction fragmentTransaction=getFragmentManager().beginTransaction();
  fragmentTransaction.add(R.id.theme_browser_container,mThemeBrowserFragment);
  fragmentTransaction.addToBackStack(null);
  fragmentTransaction.commit();
}

Fixed version (ground truth):
private void addBrowserFragment(){
  FragmentTransaction fragmentTransaction=getFragmentManager().beginTransaction();
  fragmentTransaction.add(R.id.theme_browser_container,mThemeBrowserFragment);
  fragmentTransaction.commit();
}
Program: 14266
Project: 14266
Buggy source:
@Override public void run(){
  mFetchingThemes=false;
  if (result == null) {
    mThemeBrowserFragment.mEmptyView.setText("String_Node_Str");
    mThemeSearchFragment.mEmptyView.setText("String_Node_Str");
  }
  mThemeBrowserFragment.setRefreshing(false);
  mThemeSearchFragment.setRefreshing(false);
}

Fixed version (ground truth):
@Override public void run(){
  mFetchingThemes=false;
  if (mThemeBrowserFragment.isVisible()) {
    mThemeBrowserFragment.mEmptyView.setText("String_Node_Str");
    mThemeBrowserFragment.setRefreshing(false);
  }
 else   if (mThemeSearchFragment.isVisible()) {
    mThemeSearchFragment.mEmptyView.setText("String_Node_Str");
    mThemeSearchFragment.setRefreshing(false);
  }
}
Program: 14267
Project: 14267
Buggy source:
@Override public void onSearchClicked(){
  FragmentTransaction fragmentTransaction=getFragmentManager().beginTransaction();
  fragmentTransaction.replace(R.id.theme_browser_container,mThemeSearchFragment);
  fragmentTransaction.addToBackStack(null);
  fragmentTransaction.commit();
}

Fixed version (ground truth):
@Override public void onSearchClicked(){
  mIsInSearchMode=true;
  addSearchFragment();
}
Program: 14268
Project: 14268
Buggy source:
@Override protected void onPostExecute(final ArrayList<Theme> result){
  runOnUiThread(new Runnable(){
    @Override public void run(){
      mFetchingThemes=false;
      if (result == null) {
        mThemeBrowserFragment.mEmptyView.setText("String_Node_Str");
        mThemeSearchFragment.mEmptyView.setText("String_Node_Str");
      }
      mThemeBrowserFragment.setRefreshing(false);
      mThemeSearchFragment.setRefreshing(false);
    }
  }
);
}

Fixed version (ground truth):
@Override protected void onPostExecute(final ArrayList<Theme> result){
  runOnUiThread(new Runnable(){
    @Override public void run(){
      mFetchingThemes=false;
      if (mThemeBrowserFragment.isVisible()) {
        mThemeBrowserFragment.mEmptyView.setText("String_Node_Str");
        mThemeBrowserFragment.setRefreshing(false);
      }
 else       if (mThemeSearchFragment.isVisible()) {
        mThemeSearchFragment.mEmptyView.setText("String_Node_Str");
        mThemeSearchFragment.setRefreshing(false);
      }
    }
  }
);
}
Program: 14269
Project: 14269
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (WordPress.wpDB == null) {
    Toast.makeText(this,R.string.fatal_db_error,Toast.LENGTH_LONG).show();
    finish();
    return;
  }
  if (savedInstanceState == null) {
    AnalyticsTracker.track(AnalyticsTracker.Stat.THEMES_ACCESSED_THEMES_BROWSER);
  }
  setContentView(R.layout.theme_browser_activity);
  configureToolbar();
  addBrowserFragment();
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (WordPress.wpDB == null) {
    Toast.makeText(this,R.string.fatal_db_error,Toast.LENGTH_LONG).show();
    finish();
    return;
  }
  if (savedInstanceState == null) {
    AnalyticsTracker.track(AnalyticsTracker.Stat.THEMES_ACCESSED_THEMES_BROWSER);
  }
  setContentView(R.layout.theme_browser_activity);
  configureToolbar();
  mThemeBrowserFragment=new ThemeBrowserFragment();
  mThemeSearchFragment=new ThemeSearchFragment();
  addFragment();
}
Program: 14270
Project: 14270
Buggy source:
@Override protected void onResume(){
  super.onResume();
  mIsRunning=true;
  mThemeSearchFragment=new ThemeSearchFragment();
  ActivityId.trackLastActivity(ActivityId.THEMES);
  fetchThemesIfNoneAvailable();
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  mIsRunning=true;
  ActivityId.trackLastActivity(ActivityId.THEMES);
  fetchThemesIfNoneAvailable();
}
Program: 14271
Project: 14271
Buggy source:
private void addBrowserFragment(){
  FragmentTransaction fragmentTransaction=getFragmentManager().beginTransaction();
  mThemeBrowserFragment=new ThemeBrowserFragment();
  fragmentTransaction.add(R.id.theme_browser_container,mThemeBrowserFragment);
  fragmentTransaction.commit();
}

Fixed version (ground truth):
private void addBrowserFragment(){
  FragmentTransaction fragmentTransaction=getFragmentManager().beginTransaction();
  fragmentTransaction.add(R.id.theme_browser_container,mThemeBrowserFragment);
  fragmentTransaction.addToBackStack(null);
  fragmentTransaction.commit();
}
Program: 14272
Project: 14272
Buggy source:
@Override public boolean onMenuItemActionCollapse(MenuItem item){
  getActivity().getFragmentManager().popBackStack();
  return true;
}

Fixed version (ground truth):
@Override public boolean onMenuItemActionCollapse(MenuItem item){
  ((ThemeBrowserActivity)getActivity()).setIsInSearchMode(false);
  getActivity().getFragmentManager().popBackStack();
  return true;
}
Program: 14273
Project: 14273
Buggy source:
private void configureBucketAndAdapter(){
  mBucket=SimperiumUtils.getNotesBucket();
  if (mBucket != null) {
    if (mNotesAdapter == null) {
      mNotesAdapter=new NotesAdapter(getActivity(),mBucket);
      mNotesAdapter.setOnNoteClickListener(mOnNoteClickListener);
      mRecyclerView.setAdapter(mNotesAdapter);
    }
  }
 else {
    if (!AccountHelper.isSignedInWordPressDotCom()) {
      showEmptyView(R.string.notifications_account_required,true);
    }
 else {
      showEmptyView(R.string.error_refresh_notifications,false);
    }
  }
}

Fixed version (ground truth):
private void configureBucketAndAdapter(){
  mBucket=SimperiumUtils.getNotesBucket();
  if (mBucket != null) {
    if (mNotesAdapter == null) {
      mNotesAdapter=new NotesAdapter(getActivity(),mBucket);
      mNotesAdapter.setOnNoteClickListener(mOnNoteClickListener);
    }
    if (mRecyclerView.getAdapter() == null) {
      mRecyclerView.setAdapter(mNotesAdapter);
    }
  }
 else {
    if (!AccountHelper.isSignedInWordPressDotCom()) {
      showEmptyView(R.string.notifications_account_required,true);
    }
 else {
      showEmptyView(R.string.error_refresh_notifications,false);
    }
  }
}
Program: 14275
Project: 14275
Buggy source:
@Override public void run(){
  if (!isTagValid) {
    AppLog.d(T.READER,"String_Node_Str");
    setCurrentTag(ReaderTag.getDefaultTag(),true);
  }
 else   if (timeToAutoUpdate && !isUpdating()) {
    AppLog.d(T.READER,"String_Node_Str");
    updateCurrentTag();
  }
 else {
    refreshPosts();
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (!isAdded())   return;
  if (!isTagValid) {
    AppLog.d(T.READER,"String_Node_Str");
    setCurrentTag(ReaderTag.getDefaultTag(),true);
  }
 else   if (timeToAutoUpdate && !isUpdating()) {
    AppLog.d(T.READER,"String_Node_Str");
    updateCurrentTag();
  }
 else {
    refreshPosts();
  }
}
Program: 14276
Project: 14276
Buggy source:
@Override public void onResume(){
  super.onResume();
  checkAdapter();
  if (mWasPaused) {
    AppLog.d(T.READER,"String_Node_Str");
    mWasPaused=false;
    if (getPostListType().equals(ReaderPostListType.TAG_FOLLOWED)) {
      new Thread(){
        @Override public void run(){
          final boolean isTagValid=ReaderTagTable.tagExists(getCurrentTag());
          final boolean timeToAutoUpdate=isTagValid && ReaderTagTable.shouldAutoUpdateTag(getCurrentTag());
          getActivity().runOnUiThread(new Runnable(){
            @Override public void run(){
              if (!isTagValid) {
                AppLog.d(T.READER,"String_Node_Str");
                setCurrentTag(ReaderTag.getDefaultTag(),true);
              }
 else               if (timeToAutoUpdate && !isUpdating()) {
                AppLog.d(T.READER,"String_Node_Str");
                updateCurrentTag();
              }
 else {
                refreshPosts();
              }
            }
          }
);
        }
      }
.start();
    }
 else {
      refreshPosts();
    }
  }
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  checkAdapter();
  if (mWasPaused) {
    AppLog.d(T.READER,"String_Node_Str");
    mWasPaused=false;
    if (getPostListType().equals(ReaderPostListType.TAG_FOLLOWED)) {
      resumeFollowedTag();
    }
 else {
      refreshPosts();
    }
  }
}
Program: 14277
Project: 14277
Buggy source:
public static void askForSslTrust(final Context ctx,final GenericCallback<Void> certificateTrusted){
  AlertDialog.Builder alert=new AlertDialog.Builder(ctx);
  alert.setTitle(ctx.getString(R.string.ssl_certificate_error));
  alert.setMessage(ctx.getString(R.string.ssl_certificate_ask_trust));
  alert.setPositiveButton(R.string.yes,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      SelfSignedSSLCertsManager selfSignedSSLCertsManager;
      try {
        selfSignedSSLCertsManager=SelfSignedSSLCertsManager.getInstance(ctx);
        selfSignedSSLCertsManager.addCertificates(selfSignedSSLCertsManager.getLastFailureChain());
      }
 catch (      GeneralSecurityException e) {
        AppLog.e(T.API,e);
      }
catch (      IOException e) {
        AppLog.e(T.API,e);
      }
      if (certificateTrusted != null) {
        certificateTrusted.callback(null);
      }
    }
  }
);
  alert.setNeutralButton(R.string.ssl_certificate_details,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      ActivityLauncher.viewSSLCerts(ctx);
    }
  }
);
  alert.setNegativeButton(R.string.no,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
    }
  }
);
  alert.show();
}

Fixed version (ground truth):
public static void askForSslTrust(final Context ctx,final GenericCallback<Void> certificateTrusted){
  AlertDialog.Builder alert=new AlertDialog.Builder(ctx);
  alert.setTitle(ctx.getString(R.string.ssl_certificate_error));
  alert.setMessage(ctx.getString(R.string.ssl_certificate_ask_trust));
  alert.setPositiveButton(R.string.yes,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      SelfSignedSSLCertsManager selfSignedSSLCertsManager;
      try {
        selfSignedSSLCertsManager=SelfSignedSSLCertsManager.getInstance(ctx);
        X509Certificate[] certificates=selfSignedSSLCertsManager.getLastFailureChain();
        AppLog.i(T.NUX,"String_Node_Str" + Arrays.toString(certificates));
        selfSignedSSLCertsManager.addCertificates(certificates);
      }
 catch (      GeneralSecurityException e) {
        AppLog.e(T.API,e);
      }
catch (      IOException e) {
        AppLog.e(T.API,e);
      }
      if (certificateTrusted != null) {
        certificateTrusted.callback(null);
      }
    }
  }
);
  alert.setNeutralButton(R.string.ssl_certificate_details,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      ActivityLauncher.viewSSLCerts(ctx);
    }
  }
);
  alert.setNegativeButton(R.string.no,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
    }
  }
);
  alert.show();
}
Program: 14278
Project: 14278
Buggy source:
/** 
 * Synchronous method to fetch the String content at the specified HTTP URL.
 * @param stringUrl URL to fetch contents for.
 * @return content of the resource, or null if URL was invalid or resource could not be retrieved.
 */
public static String getResponse(final String stringUrl) throws SSLHandshakeException {
  try {
    URL url=new URL(stringUrl);
    HttpURLConnection urlConnection=(HttpURLConnection)url.openConnection();
    urlConnection.setInstanceFollowRedirects(true);
    InputStream inputStream=urlConnection.getInputStream();
    BufferedReader r=new BufferedReader(new InputStreamReader(inputStream));
    StringBuilder sb=new StringBuilder();
    String line;
    while ((line=r.readLine()) != null) {
      sb.append(line);
    }
    return sb.toString();
  }
 catch (  SSLHandshakeException e) {
    throw e;
  }
catch (  IOException e) {
    AppLog.e(T.API,e);
  }
  return null;
}

Fixed version (ground truth):
public static String getResponse(final String stringUrl,int numberOfRedirects) throws SSLHandshakeException {
  RequestFuture<String> future=RequestFuture.newFuture();
  StringRequest request=new StringRequest(stringUrl,future,future);
  request.setRetryPolicy(new DefaultRetryPolicy(XMLRPCClient.DEFAULT_SOCKET_TIMEOUT,0,1));
  WordPress.requestQueue.add(request);
  try {
    return future.get(XMLRPCClient.DEFAULT_SOCKET_TIMEOUT,TimeUnit.SECONDS);
  }
 catch (  InterruptedException e) {
    AppLog.e(T.API,e);
  }
catch (  ExecutionException e) {
    if (e.getCause() != null && e.getCause() instanceof RedirectError) {
      if (numberOfRedirects > 5) {
        AppLog.e(T.API,"String_Node_Str",e);
        return null;
      }
      RedirectError re=(RedirectError)e.getCause();
      if (re.networkResponse != null) {
        String newURL=getRedirectURL(stringUrl,re.networkResponse);
        if (newURL == null) {
          AppLog.e(T.API,"String_Node_Str",e);
          return null;
        }
        if (URLUtil.isHttpsUrl(stringUrl) && !URLUtil.isHttpsUrl(newURL)) {
          AppLog.e(T.API,"String_Node_Str",e);
          return null;
        }
        AppLog.i(T.API,"String_Node_Str" + stringUrl + "String_Node_Str"+ newURL);
        return getResponse(newURL,numberOfRedirects + 1);
      }
    }
 else {
      AppLog.e(T.API,e);
    }
  }
catch (  TimeoutException e) {
    AppLog.e(T.API,e);
  }
  return null;
}
Program: 14279
Project: 14279
Buggy source:
private DefaultHttpClient instantiateClientForUri(URI uri,UsernamePasswordCredentials usernamePasswordCredentials){
  DefaultHttpClient client=null;
  if (uri != null && uri.getHost() != null && uri.getHost().endsWith("String_Node_Str")) {
    mIsWpcom=true;
  }
  if (mIsWpcom || (uri == null || uri.getScheme() == null || uri.getScheme().equals("String_Node_Str"))) {
    client=new DefaultHttpClient();
  }
 else {
    int port=uri.getPort();
    if (port == -1) {
      port=443;
    }
    try {
      client=new ConnectionClient(port);
    }
 catch (    GeneralSecurityException e) {
      AppLog.e(T.API,"String_Node_Str",e);
      client=null;
    }
catch (    IOException e) {
      AppLog.e(T.API,"String_Node_Str",e);
      client=null;
    }
    if (client == null) {
      client=new DefaultHttpClient();
    }
  }
  HttpConnectionParams.setConnectionTimeout(client.getParams(),DEFAULT_CONNECTION_TIMEOUT);
  HttpConnectionParams.setSoTimeout(client.getParams(),DEFAULT_SOCKET_TIMEOUT);
  if (usernamePasswordCredentials != null) {
    BasicCredentialsProvider cP=new BasicCredentialsProvider();
    cP.setCredentials(AuthScope.ANY,usernamePasswordCredentials);
    client.setCredentialsProvider(cP);
  }
  return client;
}

Fixed version (ground truth):
private DefaultHttpClient instantiateClientForUri(URI uri,UsernamePasswordCredentials usernamePasswordCredentials){
  DefaultHttpClient client=null;
  if (uri != null && uri.getHost() != null && uri.getHost().endsWith("String_Node_Str")) {
    mIsWpcom=true;
  }
  if (mIsWpcom) {
    client=new DefaultHttpClient();
  }
 else {
    int port=uri.getPort();
    if (port == -1) {
      port=443;
    }
    try {
      client=new ConnectionClient(port);
    }
 catch (    GeneralSecurityException e) {
      AppLog.e(T.API,"String_Node_Str",e);
      client=null;
    }
catch (    IOException e) {
      AppLog.e(T.API,"String_Node_Str",e);
      client=null;
    }
    if (client == null) {
      client=new DefaultHttpClient();
    }
  }
  HttpConnectionParams.setConnectionTimeout(client.getParams(),DEFAULT_CONNECTION_TIMEOUT);
  HttpConnectionParams.setSoTimeout(client.getParams(),DEFAULT_SOCKET_TIMEOUT);
  if (usernamePasswordCredentials != null) {
    BasicCredentialsProvider cP=new BasicCredentialsProvider();
    cP.setCredentials(AuthScope.ANY,usernamePasswordCredentials);
    client.setCredentialsProvider(cP);
  }
  return client;
}
Program: 14280
Project: 14280
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  final ReaderTag tag=mTags.get(position);
  final TagViewHolder holder;
  if (convertView == null) {
    convertView=mInflater.inflate(R.layout.reader_tag_toolbar_menu_item,parent,false);
    holder=new TagViewHolder(convertView);
    convertView.setTag(holder);
  }
 else {
    holder=(TagViewHolder)convertView.getTag();
  }
  holder.textView.setText(tag.getCapitalizedTagName());
  if (isCurrentTag(tag)) {
    holder.textView.setBackground(mSelectedBackground);
  }
 else {
    holder.textView.setBackground(null);
  }
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  final ReaderTag tag=mTags.get(position);
  final TagViewHolder holder;
  if (convertView == null) {
    convertView=mInflater.inflate(R.layout.reader_tag_toolbar_menu_item,parent,false);
    holder=new TagViewHolder(convertView);
    convertView.setTag(holder);
  }
 else {
    holder=(TagViewHolder)convertView.getTag();
  }
  holder.textView.setText(tag.getCapitalizedTagName());
  if (isCurrentTag(tag)) {
    holder.textView.setBackgroundDrawable(mSelectedBackground);
  }
 else {
    holder.textView.setBackgroundDrawable(null);
  }
  return convertView;
}
Program: 14281
Project: 14281
Buggy source:
private void launchWithNoteId(){
  if (isFinishing() || getIntent() == null)   return;
  if (getIntent().hasExtra(NotificationsUtils.ARG_PUSH_AUTH_TOKEN)) {
    Bundle extras=getIntent().getExtras();
    String token=extras.getString(NotificationsUtils.ARG_PUSH_AUTH_TOKEN,"String_Node_Str");
    String title=extras.getString(NotificationsUtils.ARG_PUSH_AUTH_TITLE,"String_Node_Str");
    String message=extras.getString(NotificationsUtils.ARG_PUSH_AUTH_MESSAGE,"String_Node_Str");
    long expires=extras.getLong(NotificationsUtils.ARG_PUSH_AUTH_EXPIRES,0);
    long now=System.currentTimeMillis() / 1000;
    if (expires > 0 && now > expires) {
      ToastUtils.showToast(this,R.string.push_auth_expired,ToastUtils.Duration.LONG);
      AnalyticsTracker.track(AnalyticsTracker.Stat.PUSH_AUTHENTICATION_EXPIRED);
    }
 else {
      NotificationsUtils.showPushAuthAlert(this,token,title,message);
    }
  }
  mViewPager.setCurrentItem(WPMainTabAdapter.TAB_NOTIFS);
  String noteId=getIntent().getStringExtra(NotificationsListFragment.NOTE_ID_EXTRA);
  boolean shouldShowKeyboard=getIntent().getBooleanExtra(NotificationsListFragment.NOTE_INSTANT_REPLY_EXTRA,false);
  if (!TextUtils.isEmpty(noteId)) {
    NotificationsListFragment.openNote(this,noteId,shouldShowKeyboard,false);
    GCMIntentService.clearNotificationsMap();
  }
}

Fixed version (ground truth):
private void launchWithNoteId(){
  if (isFinishing() || getIntent() == null)   return;
  if (getIntent().hasExtra(NotificationsUtils.ARG_PUSH_AUTH_TOKEN)) {
    Bundle extras=getIntent().getExtras();
    String token=extras.getString(NotificationsUtils.ARG_PUSH_AUTH_TOKEN,"String_Node_Str");
    String title=extras.getString(NotificationsUtils.ARG_PUSH_AUTH_TITLE,"String_Node_Str");
    String message=extras.getString(NotificationsUtils.ARG_PUSH_AUTH_MESSAGE,"String_Node_Str");
    long expires=extras.getLong(NotificationsUtils.ARG_PUSH_AUTH_EXPIRES,0);
    long now=System.currentTimeMillis() / 1000;
    if (expires > 0 && now > expires) {
      ToastUtils.showToast(this,R.string.push_auth_expired,ToastUtils.Duration.LONG);
      AnalyticsTracker.track(AnalyticsTracker.Stat.PUSH_AUTHENTICATION_EXPIRED);
    }
 else {
      NotificationsUtils.showPushAuthAlert(this,token,title,message);
    }
  }
  mViewPager.setCurrentItem(WPMainTabAdapter.TAB_NOTIFS);
  boolean shouldShowKeyboard=getIntent().getBooleanExtra(NotificationsListFragment.NOTE_INSTANT_REPLY_EXTRA,false);
  if (GCMIntentService.getNotificationsMap().size() == 1) {
    String noteId=getIntent().getStringExtra(NotificationsListFragment.NOTE_ID_EXTRA);
    if (!TextUtils.isEmpty(noteId)) {
      NotificationsListFragment.openNote(this,noteId,shouldShowKeyboard,false);
    }
  }
  GCMIntentService.clearNotificationsMap();
}
Program: 14283
Project: 14283
Buggy source:
private void handleResponseToSelfHostedSettingsSetRequest(Map result){
  AppLog.d(AppLog.T.API,"String_Node_Str");
  mBlog.setBlogName(getNestedMapValue(result,"String_Node_Str"));
  WordPress.wpDB.saveBlog(mBlog);
  EventBus.getDefault().post(new CoreEvents.BlogListChanged());
}

Fixed version (ground truth):
private void handleResponseToSelfHostedSettingsSetRequest(Map result){
  AppLog.d(AppLog.T.API,"String_Node_Str");
  mBlog.setBlogName(StringUtils.unescapeHTML(getNestedMapValue(result,"String_Node_Str")));
  WordPress.wpDB.saveBlog(mBlog);
  EventBus.getDefault().post(new CoreEvents.BlogListChanged());
}
Program: 14284
Project: 14284
Buggy source:
private HashMap<String,String> generateSelfHostedParams(){
  HashMap<String,String> params=new HashMap<>();
  if (mTitlePreference != null && !mTitlePreference.getText().equals(mRemoteTitle)) {
    params.put("String_Node_Str",mTitlePreference.getText());
  }
  if (mTaglinePreference != null && !mTaglinePreference.getText().equals(mRemoteTagline)) {
    params.put("String_Node_Str",mTaglinePreference.getText());
  }
  return params;
}

Fixed version (ground truth):
private HashMap<String,String> generateSelfHostedParams(){
  HashMap<String,String> params=new HashMap<>();
  if (mTitlePreference != null && !mTitlePreference.getText().equals(StringUtils.unescapeHTML(mRemoteTitle))) {
    params.put("String_Node_Str",mTitlePreference.getText());
  }
  if (mTaglinePreference != null && !mTaglinePreference.getText().equals(StringUtils.unescapeHTML(mRemoteTagline))) {
    params.put("String_Node_Str",mTaglinePreference.getText());
  }
  return params;
}
Program: 14285
Project: 14285
Buggy source:
private void handleResponseToSelfHostedSettingsSetRequest(Map result){
  AppLog.d(AppLog.T.API,"String_Node_Str");
  mBlog.setBlogName(StringUtils.unescapeHTML(getNestedMapValue(result,"String_Node_Str")));
  WordPress.wpDB.saveBlog(mBlog);
  EventBus.getDefault().post(new CoreEvents.BlogListChanged());
}

Fixed version (ground truth):
private void handleResponseToSelfHostedSettingsSetRequest(Map result){
  AppLog.d(AppLog.T.API,"String_Node_Str");
  if (result.containsKey("String_Node_Str")) {
    String titleResult=getNestedMapValue(result,"String_Node_Str");
    if (TextUtils.isEmpty(titleResult)) {
      titleResult=mBlog.getUrl();
    }
    mBlog.setBlogName(StringUtils.unescapeHTML(titleResult));
    WordPress.wpDB.saveBlog(mBlog);
    EventBus.getDefault().post(new CoreEvents.BlogListChanged());
  }
}
Program: 14286
Project: 14286
Buggy source:
private void changeSelection(RadioButton radioButton,int position){
  CharSequence[] values=getEntryValues();
  if (radioButton != null && mSelectedIndex != position && values != null && position < values.length) {
    mSelectedIndex=position;
    radioButton.setChecked(true);
    callChangeListener(values[position]);
  }
}

Fixed version (ground truth):
private void changeSelection(RadioButton radioButton,int position){
  CharSequence[] values=getEntryValues();
  if (radioButton != null && values != null && position < values.length) {
    mSelectedIndex=position;
    radioButton.setChecked(true);
    callChangeListener(values[position]);
  }
}
Program: 14287
Project: 14287
Buggy source:
@Override protected void onDialogClosed(boolean positiveResult){
  CharSequence[] values=getEntryValues();
  if (values != null && mSelectedIndex < values.length && mSelectedIndex != mStartingIndex) {
    String value=values[positiveResult ? mSelectedIndex : mStartingIndex].toString();
    setValue(value);
    callChangeListener(value);
  }
}

Fixed version (ground truth):
@Override protected void onDialogClosed(boolean positiveResult){
  CharSequence[] values=getEntryValues();
  if (values != null && mSelectedIndex < values.length) {
    String value=values[positiveResult ? mSelectedIndex : mStartingIndex].toString();
    callChangeListener(value);
  }
}
Program: 14288
Project: 14288
Buggy source:
@Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent,int viewType){
switch (viewType) {
case VIEW_TYPE_HEADER:
    View headerView=new ReaderCommentsPostHeaderView(parent.getContext());
  return new PostHeaderHolder(headerView);
default :
View commentView=LayoutInflater.from(parent.getContext()).inflate(R.layout.reader_listitem_comment,parent,false);
return new CommentHolder(commentView);
}
}

Fixed version (ground truth):
@Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent,int viewType){
switch (viewType) {
case VIEW_TYPE_HEADER:
    View headerView=new ReaderCommentsPostHeaderView(parent.getContext());
  headerView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT));
return new PostHeaderHolder(headerView);
default :
View commentView=LayoutInflater.from(parent.getContext()).inflate(R.layout.reader_listitem_comment,parent,false);
return new CommentHolder(commentView);
}
}
Program: 14290
Project: 14290
Buggy source:
public ReaderBlogInfoView(Context context,AttributeSet attrs,int defStyleAttr,int defStyleRes){
  super(context,attrs,defStyleAttr,defStyleRes);
  initView(context,attrs);
}

Fixed version (ground truth):
public ReaderBlogInfoView(Context context,AttributeSet attrs,int defStyleAttr){
  super(context,attrs,defStyleAttr);
  initView(context,attrs);
}
Program: 14292
Project: 14292
Buggy source:
private void setupTab(LinearLayout currentTab,String total,final StatsVisitorsAndViewsFragment.OverviewLabel itemType){
  final TextView label;
  final TextView value;
  final ImageView icon;
  currentTab.setTag(itemType);
  currentTab.setOnClickListener(ButtonsOnClickListener);
  label=(TextView)currentTab.findViewById(R.id.stats_visitors_and_views_tab_label);
  label.setText(itemType.getLabel());
  value=(TextView)currentTab.findViewById(R.id.stats_visitors_and_views_tab_value);
  value.setText(total);
  label.setTextColor(getResources().getColor(R.color.grey_darken_20));
  value.setTextColor(getResources().getColor(R.color.blue_wordpress));
  icon=(ImageView)currentTab.findViewById(R.id.stats_visitors_and_views_tab_icon);
  icon.setImageDrawable(getTabIcon(itemType));
  if (itemType == StatsVisitorsAndViewsFragment.OverviewLabel.COMMENTS) {
    currentTab.setBackgroundResource(R.drawable.stats_visitors_and_views_button_latest_white);
  }
 else {
    currentTab.setBackgroundResource(R.drawable.stats_visitors_and_views_button_white);
  }
}

Fixed version (ground truth):
private void setupTab(LinearLayout currentTab,String total,final StatsVisitorsAndViewsFragment.OverviewLabel itemType){
  final TextView label;
  final TextView value;
  final ImageView icon;
  currentTab.setTag(itemType);
  if (itemType == StatsVisitorsAndViewsFragment.OverviewLabel.VIEWS) {
    currentTab.setOnClickListener(ViewsTabOnClickListener);
  }
 else {
    currentTab.setClickable(false);
  }
  label=(TextView)currentTab.findViewById(R.id.stats_visitors_and_views_tab_label);
  label.setText(itemType.getLabel());
  label.setTextColor(getResources().getColor(R.color.grey_darken_20));
  value=(TextView)currentTab.findViewById(R.id.stats_visitors_and_views_tab_value);
  value.setText(total);
  if (total.equals("String_Node_Str")) {
    value.setTextColor(getResources().getColor(R.color.grey));
  }
 else {
    if (itemType == StatsVisitorsAndViewsFragment.OverviewLabel.VIEWS) {
      value.setTextColor(getResources().getColor(R.color.blue_wordpress));
    }
 else {
      value.setTextColor(getResources().getColor(R.color.grey_darken_30));
    }
  }
  icon=(ImageView)currentTab.findViewById(R.id.stats_visitors_and_views_tab_icon);
  icon.setImageDrawable(getTabIcon(itemType));
  if (itemType == StatsVisitorsAndViewsFragment.OverviewLabel.COMMENTS) {
    currentTab.setBackgroundResource(R.drawable.stats_visitors_and_views_button_latest_white);
  }
 else {
    currentTab.setBackgroundResource(R.drawable.stats_visitors_and_views_button_white);
  }
}
Program: 14293
Project: 14293
Buggy source:
private void setupTab(LinearLayout currentTab,String total,final StatsVisitorsAndViewsFragment.OverviewLabel itemType){
  final TextView label;
  final TextView value;
  final ImageView icon;
  currentTab.setTag(itemType);
  currentTab.setOnClickListener(ButtonsOnClickListener);
  label=(TextView)currentTab.findViewById(R.id.stats_visitors_and_views_tab_label);
  label.setText(itemType.getLabel());
  value=(TextView)currentTab.findViewById(R.id.stats_visitors_and_views_tab_value);
  value.setText(total);
  label.setTextColor(getResources().getColor(R.color.grey_darken_20));
  value.setTextColor(getResources().getColor(R.color.blue_wordpress));
  icon=(ImageView)currentTab.findViewById(R.id.stats_visitors_and_views_tab_icon);
  icon.setImageDrawable(getTabIcon(itemType));
  if (itemType == StatsVisitorsAndViewsFragment.OverviewLabel.COMMENTS) {
    currentTab.setBackgroundResource(R.drawable.stats_visitors_and_views_button_latest_white);
  }
 else {
    currentTab.setBackgroundResource(R.drawable.stats_visitors_and_views_button_white);
  }
}

Fixed version (ground truth):
private void setupTab(LinearLayout currentTab,String total,final StatsVisitorsAndViewsFragment.OverviewLabel itemType){
  final TextView label;
  final TextView value;
  final ImageView icon;
  currentTab.setTag(itemType);
  currentTab.setOnClickListener(ButtonsOnClickListener);
  label=(TextView)currentTab.findViewById(R.id.stats_visitors_and_views_tab_label);
  label.setText(itemType.getLabel());
  label.setTextColor(getResources().getColor(R.color.grey_darken_20));
  value=(TextView)currentTab.findViewById(R.id.stats_visitors_and_views_tab_value);
  value.setText(total);
  if (total.equals("String_Node_Str")) {
    value.setTextColor(getResources().getColor(R.color.grey));
  }
 else {
    value.setTextColor(getResources().getColor(R.color.blue_wordpress));
  }
  icon=(ImageView)currentTab.findViewById(R.id.stats_visitors_and_views_tab_icon);
  icon.setImageDrawable(getTabIcon(itemType));
  if (itemType == StatsVisitorsAndViewsFragment.OverviewLabel.COMMENTS) {
    currentTab.setBackgroundResource(R.drawable.stats_visitors_and_views_button_latest_white);
  }
 else {
    currentTab.setBackgroundResource(R.drawable.stats_visitors_and_views_button_white);
  }
}