nus-yam/ex-repair huggingface dataset:
Program: 14294
Project: 14294
Buggy source:
public void updateBackGroundAndIcon(){
  if (isChecked) {
    label.setTextColor(getResources().getColor(R.color.grey_dark));
    value.setTextColor(getResources().getColor(R.color.orange_jazzy));
  }
 else {
    label.setTextColor(getResources().getColor(R.color.grey_darken_20));
    value.setTextColor(getResources().getColor(R.color.blue_wordpress));
  }
  icon.setImageDrawable(getTabIcon());
  if (isLastItem) {
    if (isChecked) {
      tab.setBackgroundResource(R.drawable.stats_visitors_and_views_button_latest_white);
    }
 else {
      tab.setBackgroundResource(R.drawable.stats_visitors_and_views_button_latest_blue_light);
    }
  }
 else {
    if (isChecked) {
      tab.setBackgroundResource(R.drawable.stats_visitors_and_views_button_white);
    }
 else {
      tab.setBackgroundResource(R.drawable.stats_visitors_and_views_button_blue_light);
    }
  }
}

Fixed version (ground truth):
public void updateBackGroundAndIcon(int currentValue){
  if (isChecked) {
    label.setTextColor(getResources().getColor(R.color.grey_dark));
    value.setTextColor(getResources().getColor(R.color.orange_jazzy));
  }
 else {
    label.setTextColor(getResources().getColor(R.color.grey_darken_20));
    if (currentValue == 0) {
      value.setTextColor(getResources().getColor(R.color.grey));
    }
 else {
      value.setTextColor(getResources().getColor(R.color.blue_wordpress));
    }
  }
  icon.setImageDrawable(getTabIcon());
  if (isLastItem) {
    if (isChecked) {
      tab.setBackgroundResource(R.drawable.stats_visitors_and_views_button_latest_white);
    }
 else {
      tab.setBackgroundResource(R.drawable.stats_visitors_and_views_button_latest_blue_light);
    }
  }
 else {
    if (isChecked) {
      tab.setBackgroundResource(R.drawable.stats_visitors_and_views_button_white);
    }
 else {
      tab.setBackgroundResource(R.drawable.stats_visitors_and_views_button_blue_light);
    }
  }
}
Program: 14295
Project: 14295
Buggy source:
public TabViewHolder(LinearLayout currentTab,OverviewLabel labelItem,boolean checked,boolean isLastItem){
  tab=currentTab;
  innerContainer=(LinearLayout)currentTab.findViewById(R.id.stats_visitors_and_views_tab_inner_container);
  label=(TextView)currentTab.findViewById(R.id.stats_visitors_and_views_tab_label);
  label.setText(labelItem.getLabel());
  value=(TextView)currentTab.findViewById(R.id.stats_visitors_and_views_tab_value);
  icon=(ImageView)currentTab.findViewById(R.id.stats_visitors_and_views_tab_icon);
  this.labelItem=labelItem;
  this.isChecked=checked;
  this.isLastItem=isLastItem;
  updateBackGroundAndIcon();
}

Fixed version (ground truth):
public TabViewHolder(LinearLayout currentTab,OverviewLabel labelItem,boolean checked,boolean isLastItem){
  tab=currentTab;
  innerContainer=(LinearLayout)currentTab.findViewById(R.id.stats_visitors_and_views_tab_inner_container);
  label=(TextView)currentTab.findViewById(R.id.stats_visitors_and_views_tab_label);
  label.setText(labelItem.getLabel());
  value=(TextView)currentTab.findViewById(R.id.stats_visitors_and_views_tab_value);
  icon=(ImageView)currentTab.findViewById(R.id.stats_visitors_and_views_tab_icon);
  this.labelItem=labelItem;
  this.isChecked=checked;
  this.isLastItem=isLastItem;
  updateBackGroundAndIcon(0);
}
Program: 14296
Project: 14296
Buggy source:
private void updateUIBelowTheGraph(int itemPosition){
  if (!isAdded()) {
    return;
  }
  if (mVisitsData == null) {
    setupNoResultsUI(false);
    return;
  }
  if (mVisitsData instanceof VolleyError) {
    setupNoResultsUI(false);
    return;
  }
  final VisitModel[] dataToShowOnGraph=getDataToShowOnGraph((VisitsModel)mVisitsData);
  if (dataToShowOnGraph.length == 0) {
    return;
  }
  if (dataToShowOnGraph.length <= itemPosition || itemPosition == -1) {
    itemPosition=dataToShowOnGraph.length - 1;
  }
  String date=mStatsDate[itemPosition];
  if (date == null) {
    AppLog.w(AppLog.T.STATS,"String_Node_Str");
    return;
  }
  mDateTextView.setText(getDateForDisplayInLabels(date,getTimeframe()));
  VisitModel modelTapped=dataToShowOnGraph[itemPosition];
  for (int i=0; i < mModuleButtonsContainer.getChildCount(); i++) {
    View o=mModuleButtonsContainer.getChildAt(i);
    if (o instanceof LinearLayout && o.getTag() instanceof TabViewHolder) {
      TabViewHolder tabViewHolder=(TabViewHolder)o.getTag();
      tabViewHolder.updateBackGroundAndIcon();
switch (tabViewHolder.labelItem) {
case VIEWS:
        tabViewHolder.value.setText(FormatUtils.formatDecimal(modelTapped.getViews()));
      break;
case VISITORS:
    tabViewHolder.value.setText(FormatUtils.formatDecimal(modelTapped.getVisitors()));
  break;
case LIKES:
tabViewHolder.value.setText(FormatUtils.formatDecimal(modelTapped.getLikes()));
break;
case COMMENTS:
tabViewHolder.value.setText(FormatUtils.formatDecimal(modelTapped.getComments()));
break;
}
}
}
}

Fixed version (ground truth):
private void updateUIBelowTheGraph(int itemPosition){
  if (!isAdded()) {
    return;
  }
  if (mVisitsData == null) {
    setupNoResultsUI(false);
    return;
  }
  if (mVisitsData instanceof VolleyError) {
    setupNoResultsUI(false);
    return;
  }
  final VisitModel[] dataToShowOnGraph=getDataToShowOnGraph((VisitsModel)mVisitsData);
  if (dataToShowOnGraph.length == 0) {
    return;
  }
  if (dataToShowOnGraph.length <= itemPosition || itemPosition == -1) {
    itemPosition=dataToShowOnGraph.length - 1;
  }
  String date=mStatsDate[itemPosition];
  if (date == null) {
    AppLog.w(AppLog.T.STATS,"String_Node_Str");
    return;
  }
  mDateTextView.setText(getDateForDisplayInLabels(date,getTimeframe()));
  VisitModel modelTapped=dataToShowOnGraph[itemPosition];
  for (int i=0; i < mModuleButtonsContainer.getChildCount(); i++) {
    View o=mModuleButtonsContainer.getChildAt(i);
    if (o instanceof LinearLayout && o.getTag() instanceof TabViewHolder) {
      TabViewHolder tabViewHolder=(TabViewHolder)o.getTag();
      int currentValue=0;
switch (tabViewHolder.labelItem) {
case VIEWS:
        currentValue=modelTapped.getViews();
      break;
case VISITORS:
    currentValue=modelTapped.getVisitors();
  break;
case LIKES:
currentValue=modelTapped.getLikes();
break;
case COMMENTS:
currentValue=modelTapped.getComments();
break;
}
tabViewHolder.value.setText(FormatUtils.formatDecimal(currentValue));
tabViewHolder.updateBackGroundAndIcon(currentValue);
}
}
}
Program: 14297
Project: 14297
Buggy source:
public InsightsLatestPostModel(String blogID,JSONObject response) throws JSONException {
  this.mBlogID=blogID;
  mPostsFound=response.optInt("String_Node_Str",0);
  if (mPostsFound == 0) {
    return;
  }
  JSONArray postsObject=response.getJSONArray("String_Node_Str");
  if (postsObject.length() == 0) {
    throw new JSONException("String_Node_Str");
  }
  JSONObject firstPostObject=postsObject.getJSONObject(0);
  this.mPostID=firstPostObject.getInt("String_Node_Str");
  this.mPostTitle=firstPostObject.getString("String_Node_Str");
  this.mPostDate=firstPostObject.getString("String_Node_Str");
  this.mPostURL=firstPostObject.getString("String_Node_Str");
  this.mPostLikeCount=firstPostObject.getInt("String_Node_Str");
  JSONObject discussionObject=response.optJSONObject("String_Node_Str");
  if (discussionObject != null) {
    this.mPostCommentCount=discussionObject.optInt("String_Node_Str",0);
  }
}

Fixed version (ground truth):
public InsightsLatestPostModel(String blogID,JSONObject response) throws JSONException {
  this.mBlogID=blogID;
  mPostsFound=response.optInt("String_Node_Str",0);
  if (mPostsFound == 0) {
    return;
  }
  JSONArray postsObject=response.getJSONArray("String_Node_Str");
  if (postsObject.length() == 0) {
    throw new JSONException("String_Node_Str");
  }
  JSONObject firstPostObject=postsObject.getJSONObject(0);
  this.mPostID=firstPostObject.getInt("String_Node_Str");
  this.mPostTitle=firstPostObject.getString("String_Node_Str");
  this.mPostDate=firstPostObject.getString("String_Node_Str");
  this.mPostURL=firstPostObject.getString("String_Node_Str");
  this.mPostLikeCount=firstPostObject.getInt("String_Node_Str");
  JSONObject discussionObject=firstPostObject.optJSONObject("String_Node_Str");
  if (discussionObject != null) {
    this.mPostCommentCount=discussionObject.optInt("String_Node_Str",0);
  }
}
Program: 14298
Project: 14298
Buggy source:
public void updateSettingForChannelAndType(Channel channel,Type type,String settingName,boolean newValue,long blogId){
  String typeName=type.toString();
  try {
switch (channel) {
case BLOGS:
      JSONObject blogJson=getBlogSettings().get(blogId);
    if (blogJson != null) {
      JSONObject blogSetting=JSONUtils.queryJSON(blogJson,typeName,new JSONObject());
      blogSetting.put(settingName,newValue);
      blogJson.put(typeName,blogSetting);
      getBlogSettings().put(blogId,blogJson);
    }
  break;
case OTHER:
JSONObject otherSetting=JSONUtils.queryJSON(getOtherSettings(),typeName,new JSONObject());
otherSetting.put(settingName,newValue);
getOtherSettings().put(typeName,otherSetting);
break;
case DOTCOM:
JSONObject dotcomSetting=JSONUtils.queryJSON(getDotcomSettings(),typeName,new JSONObject());
dotcomSetting.put(settingName,newValue);
getDotcomSettings().put(typeName,dotcomSetting);
}
}
 catch (JSONException e) {
AppLog.e(AppLog.T.NOTIFS,"String_Node_Str");
}
}

Fixed version (ground truth):
public void updateSettingForChannelAndType(Channel channel,Type type,String settingName,boolean newValue,long blogId){
  String typeName=type.toString();
  try {
switch (channel) {
case BLOGS:
      JSONObject blogJson=getBlogSettings().get(blogId);
    if (blogJson != null) {
      JSONObject blogSetting=JSONUtils.queryJSON(blogJson,typeName,new JSONObject());
      blogSetting.put(settingName,newValue);
      blogJson.put(typeName,blogSetting);
      getBlogSettings().put(blogId,blogJson);
    }
  break;
case OTHER:
JSONObject otherSetting=JSONUtils.queryJSON(getOtherSettings(),typeName,new JSONObject());
otherSetting.put(settingName,newValue);
getOtherSettings().put(typeName,otherSetting);
break;
case DOTCOM:
getDotcomSettings().put(settingName,newValue);
}
}
 catch (JSONException e) {
AppLog.e(AppLog.T.NOTIFS,"String_Node_Str");
}
}
Program: 14300
Project: 14300
Buggy source:
private void configureBlogsSettings(){
  if (mNotificationsSettings == null || mNotificationsSettings.getBlogSettings() == null) {
    return;
  }
  List<Map<String,Object>> blogs=WordPress.wpDB.getBlogsBy("String_Node_Str",null,0,false);
  Context context=getActivity();
  PreferenceCategory blogsCategory=(PreferenceCategory)findPreference(getString(R.string.pref_notification_blogs));
  for (  Map blog : blogs) {
    if (context == null)     return;
    String siteUrl=MapUtils.getMapStr(blog,"String_Node_Str");
    String title=MapUtils.getMapStr(blog,"String_Node_Str");
    long blogId=MapUtils.getMapLong(blog,"String_Node_Str");
    PreferenceScreen prefScreen=getPreferenceManager().createPreferenceScreen(context);
    prefScreen.setTitle(title);
    prefScreen.setSummary(UrlUtils.getDomainFromUrl(siteUrl));
    addPreferencesForPreferenceScreen(prefScreen,Channel.BLOGS,blogId);
    blogsCategory.addPreference(prefScreen);
  }
}

Fixed version (ground truth):
private void configureBlogsSettings(){
  if (mNotificationsSettings == null || mNotificationsSettings.getBlogSettings() == null) {
    return;
  }
  String args=String.format("String_Node_Str",WordPressDB.encryptPassword("String_Node_Str"));
  List<Map<String,Object>> blogs=WordPress.wpDB.getBlogsBy(args,null,0,false);
  Context context=getActivity();
  PreferenceCategory blogsCategory=(PreferenceCategory)findPreference(getString(R.string.pref_notification_blogs));
  for (  Map blog : blogs) {
    if (context == null)     return;
    String siteUrl=MapUtils.getMapStr(blog,"String_Node_Str");
    String title=MapUtils.getMapStr(blog,"String_Node_Str");
    long blogId=MapUtils.getMapLong(blog,"String_Node_Str");
    PreferenceScreen prefScreen=getPreferenceManager().createPreferenceScreen(context);
    prefScreen.setTitle(title);
    prefScreen.setSummary(UrlUtils.getDomainFromUrl(siteUrl));
    addPreferencesForPreferenceScreen(prefScreen,Channel.BLOGS,blogId);
    blogsCategory.addPreference(prefScreen);
  }
}
Program: 14301
Project: 14301
Buggy source:
@Override public boolean onPreferenceChange(Preference preference,Object newValue){
  if (newValue == null)   return false;
  if (preference == mTitlePreference) {
    changeEditTextPreferenceValue(mTitlePreference,newValue.toString());
    return true;
  }
 else   if (preference == mTaglinePreference) {
    changeEditTextPreferenceValue(mTaglinePreference,newValue.toString());
    return true;
  }
 else   if (preference == mAddressPreference) {
    changeEditTextPreferenceValue(mAddressPreference,newValue.toString());
    return true;
  }
 else   if (preference == mLanguagePreference) {
    changeLanguageValue(newValue.toString());
    return true;
  }
 else   if (preference == mPrivacyPreference) {
    mPrivacyPreference.setSummary(privacyStringForValue(Integer.valueOf(newValue.toString())));
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean onPreferenceChange(Preference preference,Object newValue){
  if (newValue == null)   return false;
  if (preference == mTitlePreference) {
    changeEditTextPreferenceValue(mTitlePreference,newValue.toString());
    return true;
  }
 else   if (preference == mTaglinePreference) {
    changeEditTextPreferenceValue(mTaglinePreference,newValue.toString());
    return true;
  }
 else   if (preference == mAddressPreference) {
    changeEditTextPreferenceValue(mAddressPreference,newValue.toString());
    return true;
  }
 else   if (preference == mLanguagePreference) {
    changeLanguageValue(newValue.toString());
    return true;
  }
 else   if (preference == mPrivacyPreference) {
    changePrivacyValue(Integer.valueOf(newValue.toString()));
    return true;
  }
  return false;
}
Program: 14303
Project: 14303
Buggy source:
private void changePrivacyValue(int newValue){
  if (mPrivacyPreference != null && Integer.valueOf(mPrivacyPreference.getValue()) == newValue) {
    mPrivacyPreference.setValue(String.valueOf(newValue));
    mPrivacyPreference.setSummary(privacyStringForValue(newValue));
  }
}

Fixed version (ground truth):
private void changePrivacyValue(int newValue){
  if (mPrivacyPreference != null && Integer.valueOf(mPrivacyPreference.getValue()) != newValue) {
    mPrivacyPreference.setValue(String.valueOf(newValue));
    mPrivacyPreference.setSummary(privacyStringForValue(newValue));
    mPrivacyPreference.refreshAdapter();
  }
}
Program: 14304
Project: 14304
Buggy source:
@SuppressWarnings("String_Node_Str") public static boolean isNotificationsEnabled(Context context){
  AppOpsManager mAppOps=(AppOpsManager)context.getSystemService(Context.APP_OPS_SERVICE);
  ApplicationInfo appInfo=context.getApplicationInfo();
  String pkg=context.getApplicationContext().getPackageName();
  int uid=appInfo.uid;
  Class appOpsClass;
  try {
    appOpsClass=Class.forName(AppOpsManager.class.getName());
    Method checkOpNoThrowMethod=appOpsClass.getMethod(CHECK_OP_NO_THROW,Integer.TYPE,Integer.TYPE,String.class);
    Field opPostNotificationValue=appOpsClass.getDeclaredField(OP_POST_NOTIFICATION);
    int value=(int)opPostNotificationValue.get(Integer.class);
    return ((int)checkOpNoThrowMethod.invoke(mAppOps,value,uid,pkg) == AppOpsManager.MODE_ALLOWED);
  }
 catch (  ClassNotFoundException|NoSuchFieldException|NoSuchMethodException|IllegalAccessException|InvocationTargetException e) {
    e.printStackTrace();
  }
  return false;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @TargetApi(19) public static boolean isNotificationsEnabled(Context context){
  if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    AppOpsManager mAppOps=(AppOpsManager)context.getSystemService(Context.APP_OPS_SERVICE);
    ApplicationInfo appInfo=context.getApplicationInfo();
    String pkg=context.getApplicationContext().getPackageName();
    int uid=appInfo.uid;
    Class appOpsClass;
    try {
      appOpsClass=Class.forName(AppOpsManager.class.getName());
      Method checkOpNoThrowMethod=appOpsClass.getMethod(CHECK_OP_NO_THROW,Integer.TYPE,Integer.TYPE,String.class);
      Field opPostNotificationValue=appOpsClass.getDeclaredField(OP_POST_NOTIFICATION);
      int value=(int)opPostNotificationValue.get(Integer.class);
      return ((int)checkOpNoThrowMethod.invoke(mAppOps,value,uid,pkg) == AppOpsManager.MODE_ALLOWED);
    }
 catch (    ClassNotFoundException|NoSuchFieldException|NoSuchMethodException|IllegalAccessException|InvocationTargetException e) {
      e.printStackTrace();
    }
  }
  return true;
}
Program: 14305
Project: 14305
Buggy source:
public ReaderPostViewHolder(View itemView){
  super(itemView);
  cardView=(CardView)itemView.findViewById(R.id.card_view);
  txtTitle=(TextView)itemView.findViewById(R.id.text_title);
  txtText=(TextView)itemView.findViewById(R.id.text_excerpt);
  txtBlogName=(TextView)itemView.findViewById(R.id.text_blog_name);
  txtDate=(TextView)itemView.findViewById(R.id.text_date);
  txtTag=(TextView)itemView.findViewById(R.id.text_tag);
  commentCount=(ReaderIconCountView)itemView.findViewById(R.id.count_comments);
  likeCount=(ReaderIconCountView)itemView.findViewById(R.id.count_likes);
  imgFeatured=(WPNetworkImageView)itemView.findViewById(R.id.image_featured);
  imgAvatar=(WPNetworkImageView)itemView.findViewById(R.id.image_avatar);
  imgMore=(ImageView)itemView.findViewById(R.id.image_more);
  layoutPostHeader=(ViewGroup)itemView.findViewById(R.id.layout_post_header);
  layoutDiscover=(ViewGroup)itemView.findViewById(R.id.layout_discover);
  imgDiscoverAvatar=(WPNetworkImageView)layoutDiscover.findViewById(R.id.image_discover_avatar);
  txtDiscover=(TextView)layoutDiscover.findViewById(R.id.text_discover);
  if (getPostListType() == ReaderTypes.ReaderPostListType.BLOG_PREVIEW) {
    txtBlogName.setTextColor(R.color.grey_lighten_10);
  }
}

Fixed version (ground truth):
public ReaderPostViewHolder(View itemView){
  super(itemView);
  cardView=(CardView)itemView.findViewById(R.id.card_view);
  txtTitle=(TextView)itemView.findViewById(R.id.text_title);
  txtText=(TextView)itemView.findViewById(R.id.text_excerpt);
  txtBlogName=(TextView)itemView.findViewById(R.id.text_blog_name);
  txtDate=(TextView)itemView.findViewById(R.id.text_date);
  txtTag=(TextView)itemView.findViewById(R.id.text_tag);
  commentCount=(ReaderIconCountView)itemView.findViewById(R.id.count_comments);
  likeCount=(ReaderIconCountView)itemView.findViewById(R.id.count_likes);
  imgFeatured=(WPNetworkImageView)itemView.findViewById(R.id.image_featured);
  imgAvatar=(WPNetworkImageView)itemView.findViewById(R.id.image_avatar);
  imgMore=(ImageView)itemView.findViewById(R.id.image_more);
  layoutPostHeader=(ViewGroup)itemView.findViewById(R.id.layout_post_header);
  layoutDiscover=(ViewGroup)itemView.findViewById(R.id.layout_discover);
  imgDiscoverAvatar=(WPNetworkImageView)layoutDiscover.findViewById(R.id.image_discover_avatar);
  txtDiscover=(TextView)layoutDiscover.findViewById(R.id.text_discover);
  if (getPostListType() == ReaderTypes.ReaderPostListType.BLOG_PREVIEW) {
    int color=itemView.getContext().getResources().getColor(R.color.grey_lighten_10);
    txtBlogName.setTextColor(color);
  }
}
Program: 14306
Project: 14306
Buggy source:
public static void viewCurrentSite(Context context){
  Intent intent=new Intent(context,ViewSiteActivity.class);
  slideInFromRight(context,intent);
}

Fixed version (ground truth):
public static void viewCurrentSite(Context context){
  Intent intent=new Intent(context,ViewSiteActivity.class);
  slideInFromRight(context,intent);
  AnalyticsTracker.track(AnalyticsTracker.Stat.OPENED_VIEW_SITE);
}
Program: 14307
Project: 14307
Buggy source:
public static void viewBlogSettingsForResult(Activity activity,Blog blog){
  if (blog == null)   return;
  Intent intent=new Intent(activity,BlogPreferencesActivity.class);
  intent.putExtra(BlogPreferencesActivity.ARG_LOCAL_BLOG_ID,blog.getLocalTableBlogId());
  slideInFromRightForResult(activity,intent,RequestCodes.BLOG_SETTINGS);
}

Fixed version (ground truth):
public static void viewBlogSettingsForResult(Activity activity,Blog blog){
  if (blog == null)   return;
  Intent intent=new Intent(activity,BlogPreferencesActivity.class);
  intent.putExtra(BlogPreferencesActivity.ARG_LOCAL_BLOG_ID,blog.getLocalTableBlogId());
  slideInFromRightForResult(activity,intent,RequestCodes.BLOG_SETTINGS);
  AnalyticsTracker.track(AnalyticsTracker.Stat.OPENED_SETTINGS);
}
Program: 14308
Project: 14308
Buggy source:
public static void viewCurrentBlogPages(Context context){
  Intent intent=new Intent(context,PagesListActivity.class);
  intent.putExtra(PostsListActivity.EXTRA_VIEW_PAGES,true);
  slideInFromRight(context,intent);
}

Fixed version (ground truth):
public static void viewCurrentBlogPages(Context context){
  Intent intent=new Intent(context,PagesListActivity.class);
  intent.putExtra(PostsListActivity.EXTRA_VIEW_PAGES,true);
  slideInFromRight(context,intent);
  AnalyticsTracker.track(AnalyticsTracker.Stat.OPENED_PAGES);
}
Program: 14309
Project: 14309
Buggy source:
public static void viewCurrentBlogComments(Context context){
  Intent intent=new Intent(context,CommentsActivity.class);
  slideInFromRight(context,intent);
}

Fixed version (ground truth):
public static void viewCurrentBlogComments(Context context){
  Intent intent=new Intent(context,CommentsActivity.class);
  slideInFromRight(context,intent);
  AnalyticsTracker.track(AnalyticsTracker.Stat.OPENED_COMMENTS);
}
Program: 14310
Project: 14310
Buggy source:
public static void viewCurrentBlogPosts(Context context){
  Intent intent=new Intent(context,PostsListActivity.class);
  slideInFromRight(context,intent);
}

Fixed version (ground truth):
public static void viewCurrentBlogPosts(Context context){
  Intent intent=new Intent(context,PostsListActivity.class);
  slideInFromRight(context,intent);
  AnalyticsTracker.track(AnalyticsTracker.Stat.OPENED_POSTS);
}
Program: 14311
Project: 14311
Buggy source:
public static void viewCurrentBlogMedia(Context context){
  Intent intent=new Intent(context,MediaBrowserActivity.class);
  slideInFromRight(context,intent);
}

Fixed version (ground truth):
public static void viewCurrentBlogMedia(Context context){
  Intent intent=new Intent(context,MediaBrowserActivity.class);
  slideInFromRight(context,intent);
  AnalyticsTracker.track(AnalyticsTracker.Stat.OPENED_MEDIA_LIBRARY);
}
Program: 14312
Project: 14312
Buggy source:
private void trackLastVisibleTab(int position){
switch (position) {
case WPMainTabAdapter.TAB_MY_SITE:
    ActivityId.trackLastActivity(ActivityId.MY_SITE);
  break;
case WPMainTabAdapter.TAB_READER:
ActivityId.trackLastActivity(ActivityId.READER);
break;
case WPMainTabAdapter.TAB_ME:
ActivityId.trackLastActivity(ActivityId.ME);
break;
case WPMainTabAdapter.TAB_NOTIFS:
ActivityId.trackLastActivity(ActivityId.NOTIFICATIONS);
break;
default :
break;
}
}

Fixed version (ground truth):
private void trackLastVisibleTab(int position){
switch (position) {
case WPMainTabAdapter.TAB_MY_SITE:
    ActivityId.trackLastActivity(ActivityId.MY_SITE);
  AnalyticsTracker.track(AnalyticsTracker.Stat.MY_SITE_ACCESSED);
break;
case WPMainTabAdapter.TAB_READER:
ActivityId.trackLastActivity(ActivityId.READER);
AnalyticsTracker.track(AnalyticsTracker.Stat.READER_ACCESSED);
break;
case WPMainTabAdapter.TAB_ME:
ActivityId.trackLastActivity(ActivityId.ME);
AnalyticsTracker.track(AnalyticsTracker.Stat.ME_ACCESSED);
break;
case WPMainTabAdapter.TAB_NOTIFS:
ActivityId.trackLastActivity(ActivityId.NOTIFICATIONS);
AnalyticsTracker.track(AnalyticsTracker.Stat.NOTIFICATIONS_ACCESSED);
break;
default :
break;
}
}
Program: 14313
Project: 14313
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (savedInstanceState == null) {
    AnalyticsTracker.track(AnalyticsTracker.Stat.OPENED_SETTINGS);
  }
  addPreferencesFromResource(R.xml.settings);
  OnPreferenceChangeListener preferenceChangeListener=new OnPreferenceChangeListener(){
    @Override public boolean onPreferenceChange(    Preference preference,    Object newValue){
      if (newValue != null) {
        preference.setSummary(newValue.toString());
      }
      ActivityUtils.hideKeyboard(getActivity());
      return true;
    }
  }
;
  mTaglineTextPreference=(WPEditTextPreference)findPreference(getString(R.string.pref_key_post_sig));
  if (mTaglineTextPreference != null) {
    mTaglineTextPreference.setOnPreferenceChangeListener(preferenceChangeListener);
  }
  findPreference(getString(R.string.pref_key_language)).setOnPreferenceClickListener(this);
  findPreference(getString(R.string.pref_key_app_about)).setOnPreferenceClickListener(this);
  findPreference(getString(R.string.pref_key_notifications)).setOnPreferenceClickListener(this);
  findPreference(getString(R.string.pref_key_oss_licenses)).setOnPreferenceClickListener(this);
  findPreference(getString(R.string.pref_key_reset_shared_pref)).setOnPreferenceClickListener(this);
  mSettings=PreferenceManager.getDefaultSharedPreferences(getActivity());
  initNotifications();
  updatePostSignature();
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.settings);
  OnPreferenceChangeListener preferenceChangeListener=new OnPreferenceChangeListener(){
    @Override public boolean onPreferenceChange(    Preference preference,    Object newValue){
      if (newValue != null) {
        preference.setSummary(newValue.toString());
      }
      ActivityUtils.hideKeyboard(getActivity());
      return true;
    }
  }
;
  mTaglineTextPreference=(WPEditTextPreference)findPreference(getString(R.string.pref_key_post_sig));
  if (mTaglineTextPreference != null) {
    mTaglineTextPreference.setOnPreferenceChangeListener(preferenceChangeListener);
  }
  findPreference(getString(R.string.pref_key_language)).setOnPreferenceClickListener(this);
  findPreference(getString(R.string.pref_key_app_about)).setOnPreferenceClickListener(this);
  findPreference(getString(R.string.pref_key_notifications)).setOnPreferenceClickListener(this);
  findPreference(getString(R.string.pref_key_oss_licenses)).setOnPreferenceClickListener(this);
  findPreference(getString(R.string.pref_key_reset_shared_pref)).setOnPreferenceClickListener(this);
  mSettings=PreferenceManager.getDefaultSharedPreferences(getActivity());
  initNotifications();
  updatePostSignature();
}
Program: 14314
Project: 14314
Buggy source:
private void readIntent(Intent intent,Bundle savedInstanceState){
  if (intent == null) {
    return;
  }
  ReaderTypes.ReaderPostListType postListType;
  if (intent.hasExtra(ReaderConstants.ARG_POST_LIST_TYPE)) {
    postListType=(ReaderTypes.ReaderPostListType)intent.getSerializableExtra(ReaderConstants.ARG_POST_LIST_TYPE);
  }
 else {
    postListType=ReaderTypes.DEFAULT_POST_LIST_TYPE;
  }
  if (savedInstanceState == null) {
    AnalyticsTracker.track(AnalyticsTracker.Stat.READER_ACCESSED);
    if (postListType == ReaderTypes.ReaderPostListType.BLOG_PREVIEW) {
      long blogId=intent.getLongExtra(ReaderConstants.ARG_BLOG_ID,0);
      long feedId=intent.getLongExtra(ReaderConstants.ARG_FEED_ID,0);
      if (feedId != 0) {
        showListFragmentForFeed(feedId);
      }
 else {
        showListFragmentForBlog(blogId);
      }
    }
 else {
      ReaderTag tag;
      if (intent.hasExtra(ReaderConstants.ARG_TAG)) {
        tag=(ReaderTag)intent.getSerializableExtra(ReaderConstants.ARG_TAG);
      }
 else {
        tag=AppPrefs.getReaderTag();
      }
      if (postListType == ReaderTypes.ReaderPostListType.TAG_FOLLOWED && !ReaderTagTable.tagExists(tag)) {
        tag=ReaderTag.getDefaultTag();
      }
      showListFragmentForTag(tag,postListType);
    }
  }
switch (postListType) {
case TAG_PREVIEW:
    setTitle(R.string.reader_title_tag_preview);
  break;
case BLOG_PREVIEW:
setTitle(R.string.reader_title_blog_preview);
break;
default :
break;
}
}

Fixed version (ground truth):
private void readIntent(Intent intent,Bundle savedInstanceState){
  if (intent == null) {
    return;
  }
  ReaderTypes.ReaderPostListType postListType;
  if (intent.hasExtra(ReaderConstants.ARG_POST_LIST_TYPE)) {
    postListType=(ReaderTypes.ReaderPostListType)intent.getSerializableExtra(ReaderConstants.ARG_POST_LIST_TYPE);
  }
 else {
    postListType=ReaderTypes.DEFAULT_POST_LIST_TYPE;
  }
  if (savedInstanceState == null) {
    if (postListType == ReaderTypes.ReaderPostListType.BLOG_PREVIEW) {
      long blogId=intent.getLongExtra(ReaderConstants.ARG_BLOG_ID,0);
      long feedId=intent.getLongExtra(ReaderConstants.ARG_FEED_ID,0);
      if (feedId != 0) {
        showListFragmentForFeed(feedId);
      }
 else {
        showListFragmentForBlog(blogId);
      }
    }
 else {
      ReaderTag tag;
      if (intent.hasExtra(ReaderConstants.ARG_TAG)) {
        tag=(ReaderTag)intent.getSerializableExtra(ReaderConstants.ARG_TAG);
      }
 else {
        tag=AppPrefs.getReaderTag();
      }
      if (postListType == ReaderTypes.ReaderPostListType.TAG_FOLLOWED && !ReaderTagTable.tagExists(tag)) {
        tag=ReaderTag.getDefaultTag();
      }
      showListFragmentForTag(tag,postListType);
    }
  }
switch (postListType) {
case TAG_PREVIEW:
    setTitle(R.string.reader_title_tag_preview);
  break;
case BLOG_PREVIEW:
setTitle(R.string.reader_title_blog_preview);
break;
default :
break;
}
}
Program: 14320
Project: 14320
Buggy source:
public PostsListPost(Post post){
  postId=post.getLocalTablePostId();
  blogId=post.getLocalTableBlogId();
  featuredImageId=post.getFeaturedImageId();
  title=post.getTitle();
  description=post.getDescription();
  excerpt=post.getPostExcerpt();
  status=post.getPostStatus();
  isLocalDraft=post.isLocalDraft();
  hasLocalChanges=post.hasChangedFromLocalDraftToPublished();
  isUploading=post.isUploading();
  setDateCreatedGmt(post.getDate_created_gmt());
  if (!hasExcerpt() && hasDescription()) {
    excerpt=makeExcerpt(description);
  }
}

Fixed version (ground truth):
public PostsListPost(Post post){
  postId=post.getLocalTablePostId();
  blogId=post.getLocalTableBlogId();
  featuredImageId=post.getFeaturedImageId();
  title=post.getTitle();
  description=post.getDescription();
  excerpt=post.getPostExcerpt();
  status=post.getPostStatus();
  isLocalDraft=post.isLocalDraft();
  hasLocalChanges=post.isLocalChange();
  isUploading=post.isUploading();
  setDateCreatedGmt(post.getDate_created_gmt());
  if (!hasExcerpt() && hasDescription()) {
    excerpt=makeExcerpt(description);
  }
}
Program: 14321
Project: 14321
Buggy source:
private void refreshPosts(){
  if (!isAdded())   return;
  Blog currentBlog=WordPress.getCurrentBlog();
  if (currentBlog == null) {
    ToastUtils.showToast(getActivity(),mIsPage ? R.string.error_refresh_pages : R.string.error_refresh_posts,Duration.LONG);
    return;
  }
  boolean hasLocalChanges=WordPress.wpDB.findLocalChanges(currentBlog.getLocalTableBlogId(),mIsPage);
  if (hasLocalChanges) {
    AlertDialog.Builder dialogBuilder=new AlertDialog.Builder(getActivity());
    dialogBuilder.setTitle(getResources().getText(R.string.local_changes));
    dialogBuilder.setMessage(getResources().getText(R.string.overwrite_local_changes));
    dialogBuilder.setPositiveButton(getResources().getText(R.string.yes),new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int whichButton){
        setRefreshing(true);
        requestPosts(false);
      }
    }
);
    dialogBuilder.setNegativeButton(getResources().getText(R.string.no),new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int whichButton){
        setRefreshing(false);
      }
    }
);
    dialogBuilder.setCancelable(true);
    dialogBuilder.create().show();
  }
 else {
    setRefreshing(true);
    requestPosts(false);
  }
}

Fixed version (ground truth):
private void refreshPosts(){
  if (!isAdded())   return;
  if (hasLocalChanges()) {
    AlertDialog.Builder dialogBuilder=new AlertDialog.Builder(getActivity());
    dialogBuilder.setTitle(getResources().getText(R.string.local_changes));
    dialogBuilder.setMessage(getResources().getText(R.string.overwrite_local_changes));
    dialogBuilder.setPositiveButton(getResources().getText(R.string.yes),new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int whichButton){
        setRefreshing(true);
        requestPosts(false);
      }
    }
);
    dialogBuilder.setNegativeButton(getResources().getText(R.string.no),new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int whichButton){
        setRefreshing(false);
      }
    }
);
    dialogBuilder.setCancelable(true);
    dialogBuilder.create().show();
  }
 else {
    setRefreshing(true);
    requestPosts(false);
  }
}
Program: 14323
Project: 14323
Buggy source:
@Override public void onActivityCreated(Bundle bundle){
  super.onActivityCreated(bundle);
  initSwipeToRefreshHelper();
  if (WordPress.getCurrentBlog() != null && mRecyclerView.getAdapter() == null) {
    mRecyclerView.setAdapter(getPostListAdapter());
  }
  if (bundle == null) {
    loadPosts();
    if (NetworkUtils.checkConnection(getActivity())) {
      requestPosts(false);
    }
  }
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle bundle){
  super.onActivityCreated(bundle);
  initSwipeToRefreshHelper();
  if (WordPress.getCurrentBlog() != null && mRecyclerView.getAdapter() == null) {
    mRecyclerView.setAdapter(getPostListAdapter());
  }
  if (bundle == null) {
    loadPosts();
    if (!hasLocalChanges() && NetworkUtils.checkConnection(getActivity())) {
      requestPosts(false);
    }
  }
}
Program: 14324
Project: 14324
Buggy source:
public static void getPushNotificationSettings(Context context,RestRequest.Listener listener,RestRequest.ErrorListener errorListener){
  if (!AccountHelper.isSignedInWordPressDotCom()) {
    return;
  }
  String gcmToken=GCMRegistrar.getRegistrationId(context);
  if (TextUtils.isEmpty(gcmToken)) {
    AppLog.e(T.NOTIFS,"String_Node_Str");
    return;
  }
  SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(context);
  String deviceID=settings.getString(WPCOM_PUSH_DEVICE_SERVER_ID,null);
  if (TextUtils.isEmpty(deviceID)) {
    AppLog.e(T.NOTIFS,"String_Node_Str");
    return;
  }
  WordPress.getRestClientUtilsV1_1().get("String_Node_Str" + deviceID,listener,errorListener);
}

Fixed version (ground truth):
public static void getPushNotificationSettings(Context context,RestRequest.Listener listener,RestRequest.ErrorListener errorListener){
  if (!AccountHelper.isSignedInWordPressDotCom()) {
    return;
  }
  String gcmToken=GCMRegistrar.getRegistrationId(context);
  if (TextUtils.isEmpty(gcmToken)) {
    AppLog.e(T.NOTIFS,"String_Node_Str");
    if (errorListener != null) {
      errorListener.onErrorResponse(new VolleyError("String_Node_Str"));
    }
    return;
  }
  SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(context);
  String deviceID=settings.getString(WPCOM_PUSH_DEVICE_SERVER_ID,null);
  if (TextUtils.isEmpty(deviceID)) {
    AppLog.e(T.NOTIFS,"String_Node_Str");
    if (errorListener != null) {
      errorListener.onErrorResponse(new VolleyError("String_Node_Str"));
    }
    return;
  }
  WordPress.getRestClientUtilsV1_1().get("String_Node_Str" + deviceID,listener,errorListener);
}
Program: 14325
Project: 14325
Buggy source:
@SuppressWarnings("String_Node_Str") public void onEventMainThread(NotificationEvents.NotificationsSettingsStatusChanged event){
  if (TextUtils.isEmpty(event.getMessage())) {
    mMessageTextView.setVisibility(View.GONE);
  }
 else {
    mMessageTextView.setVisibility(View.VISIBLE);
    mMessageTextView.setText(event.getMessage());
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void onEventMainThread(NotificationEvents.NotificationsSettingsStatusChanged event){
  if (TextUtils.isEmpty(event.getMessage())) {
    mMessageContainer.setVisibility(View.GONE);
  }
 else {
    mMessageContainer.setVisibility(View.VISIBLE);
    mMessageTextView.setText(event.getMessage());
  }
}
Program: 14326
Project: 14326
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  ActionBar actionBar=getSupportActionBar();
  if (actionBar != null) {
    actionBar.setElevation(0.0f);
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);
  }
  setContentView(R.layout.notifications_settings_activity);
  setTitle(R.string.notifications);
  FragmentManager fragmentManager=getFragmentManager();
  if (savedInstanceState == null) {
    fragmentManager.beginTransaction().add(R.id.fragment_container,new NotificationsSettingsFragment()).commit();
  }
  mMessageTextView=(TextView)findViewById(R.id.notifications_settings_message);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  ActionBar actionBar=getSupportActionBar();
  if (actionBar != null) {
    actionBar.setElevation(0.0f);
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);
  }
  setContentView(R.layout.notifications_settings_activity);
  setTitle(R.string.notifications);
  FragmentManager fragmentManager=getFragmentManager();
  if (savedInstanceState == null) {
    fragmentManager.beginTransaction().add(R.id.fragment_container,new NotificationsSettingsFragment()).commit();
  }
  mMessageContainer=findViewById(R.id.notifications_settings_message_container);
  mMessageTextView=(TextView)findViewById(R.id.notifications_settings_message);
}
Program: 14327
Project: 14327
Buggy source:
public PostsListPost(Post post){
  postId=post.getLocalTablePostId();
  blogId=post.getLocalTableBlogId();
  featuredImageId=post.getFeaturedImageId();
  title=post.getTitle();
  description=post.getDescription();
  excerpt=post.getPostExcerpt();
  status=post.getPostStatus();
  isLocalDraft=post.isLocalDraft();
  hasLocalChanges=post.hasChangedFromLocalDraftToPublished();
  isUploading=post.isUploading();
  setDateCreatedGmt(post.getDate_created_gmt());
  if (!hasExcerpt() && hasDescription()) {
    excerpt=makeExcerpt(description);
  }
}

Fixed version (ground truth):
public PostsListPost(Post post){
  postId=post.getLocalTablePostId();
  blogId=post.getLocalTableBlogId();
  featuredImageId=post.getFeaturedImageId();
  title=post.getTitle();
  description=post.getDescription();
  excerpt=post.getPostExcerpt();
  status=post.getPostStatus();
  isLocalDraft=post.isLocalDraft();
  hasLocalChanges=post.isLocalChange();
  isUploading=post.isUploading();
  setDateCreatedGmt(post.getDate_created_gmt());
  if (!hasExcerpt() && hasDescription()) {
    excerpt=makeExcerpt(description);
  }
}
Program: 14328
Project: 14328
Buggy source:
private void refreshPosts(){
  if (!isAdded())   return;
  Blog currentBlog=WordPress.getCurrentBlog();
  if (currentBlog == null) {
    ToastUtils.showToast(getActivity(),mIsPage ? R.string.error_refresh_pages : R.string.error_refresh_posts,Duration.LONG);
    return;
  }
  boolean hasLocalChanges=WordPress.wpDB.findLocalChanges(currentBlog.getLocalTableBlogId(),mIsPage);
  if (hasLocalChanges) {
    AlertDialog.Builder dialogBuilder=new AlertDialog.Builder(getActivity());
    dialogBuilder.setTitle(getResources().getText(R.string.local_changes));
    dialogBuilder.setMessage(getResources().getText(R.string.overwrite_local_changes));
    dialogBuilder.setPositiveButton(getResources().getText(R.string.yes),new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int whichButton){
        setRefreshing(true);
        requestPosts(false);
      }
    }
);
    dialogBuilder.setNegativeButton(getResources().getText(R.string.no),new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int whichButton){
        setRefreshing(false);
      }
    }
);
    dialogBuilder.setCancelable(true);
    dialogBuilder.create().show();
  }
 else {
    setRefreshing(true);
    requestPosts(false);
  }
}

Fixed version (ground truth):
private void refreshPosts(){
  if (!isAdded())   return;
  if (hasLocalChanges()) {
    AlertDialog.Builder dialogBuilder=new AlertDialog.Builder(getActivity());
    dialogBuilder.setTitle(getResources().getText(R.string.local_changes));
    dialogBuilder.setMessage(getResources().getText(R.string.overwrite_local_changes));
    dialogBuilder.setPositiveButton(getResources().getText(R.string.yes),new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int whichButton){
        setRefreshing(true);
        requestPosts(false);
      }
    }
);
    dialogBuilder.setNegativeButton(getResources().getText(R.string.no),new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int whichButton){
        setRefreshing(false);
      }
    }
);
    dialogBuilder.setCancelable(true);
    dialogBuilder.create().show();
  }
 else {
    setRefreshing(true);
    requestPosts(false);
  }
}
Program: 14330
Project: 14330
Buggy source:
@Override public void onActivityCreated(Bundle bundle){
  super.onActivityCreated(bundle);
  initSwipeToRefreshHelper();
  if (WordPress.getCurrentBlog() != null && mRecyclerView.getAdapter() == null) {
    mRecyclerView.setAdapter(getPostListAdapter());
  }
  if (bundle == null) {
    loadPosts();
    if (NetworkUtils.checkConnection(getActivity())) {
      requestPosts(false);
    }
  }
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle bundle){
  super.onActivityCreated(bundle);
  initSwipeToRefreshHelper();
  if (WordPress.getCurrentBlog() != null && mRecyclerView.getAdapter() == null) {
    mRecyclerView.setAdapter(getPostListAdapter());
  }
  if (bundle == null) {
    loadPosts();
    if (!hasLocalChanges() && NetworkUtils.checkConnection(getActivity())) {
      requestPosts(false);
    }
  }
}
Program: 14331
Project: 14331
Buggy source:
@Override public void onLoadMore(){
  if (mCanLoadMorePosts && !mIsFetchingPosts)   requestPosts(true);
}

Fixed version (ground truth):
@Override public void onLoadMore(){
  if (mCanLoadMorePosts && !mIsFetchingPosts) {
    requestPosts(true);
  }
}
Program: 14332
Project: 14332
Buggy source:
private void initSwipeToRefreshHelper(){
  mSwipeToRefreshHelper=new SwipeToRefreshHelper(getActivity(),(CustomSwipeRefreshLayout)getView().findViewById(R.id.ptr_layout),new RefreshListener(){
    @Override public void onRefreshStarted(){
      if (!isAdded()) {
        return;
      }
      if (!NetworkUtils.checkConnection(getActivity())) {
        setRefreshing(false);
        updateEmptyView(EmptyViewMessageType.NETWORK_ERROR);
        return;
      }
      refreshPosts();
    }
  }
);
}

Fixed version (ground truth):
private void initSwipeToRefreshHelper(){
  mSwipeToRefreshHelper=new SwipeToRefreshHelper(getActivity(),(CustomSwipeRefreshLayout)getView().findViewById(R.id.ptr_layout),new RefreshListener(){
    @Override public void onRefreshStarted(){
      if (!isAdded()) {
        return;
      }
      if (!NetworkUtils.checkConnection(getActivity())) {
        setRefreshing(false);
        updateEmptyView(EmptyViewMessageType.NETWORK_ERROR);
        return;
      }
      if (hasLocalChanges()) {
        confirmRequestPosts();
      }
 else {
        requestPosts(false);
      }
    }
  }
);
}
Program: 14334
Project: 14334
Buggy source:
@Override public void onRefreshStarted(){
  if (!isAdded()) {
    return;
  }
  if (!NetworkUtils.checkConnection(getActivity())) {
    setRefreshing(false);
    updateEmptyView(EmptyViewMessageType.NETWORK_ERROR);
    return;
  }
  refreshPosts();
}

Fixed version (ground truth):
@Override public void onRefreshStarted(){
  if (!isAdded()) {
    return;
  }
  if (!NetworkUtils.checkConnection(getActivity())) {
    setRefreshing(false);
    updateEmptyView(EmptyViewMessageType.NETWORK_ERROR);
    return;
  }
  if (hasLocalChanges()) {
    confirmRequestPosts();
  }
 else {
    requestPosts(false);
  }
}
Program: 14335
Project: 14335
Buggy source:
@Override public void onActivityCreated(Bundle bundle){
  super.onActivityCreated(bundle);
  initSwipeToRefreshHelper();
  if (WordPress.getCurrentBlog() != null && mRecyclerView.getAdapter() == null) {
    mRecyclerView.setAdapter(getPostListAdapter());
  }
  if (bundle == null) {
    loadPosts();
    if (NetworkUtils.checkConnection(getActivity())) {
      requestPosts(false);
    }
  }
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle bundle){
  super.onActivityCreated(bundle);
  initSwipeToRefreshHelper();
  if (WordPress.getCurrentBlog() != null && mRecyclerView.getAdapter() == null) {
    mRecyclerView.setAdapter(getPostListAdapter());
  }
  if (bundle == null) {
    loadPosts();
    if (NetworkUtils.checkConnection(getActivity()) && !hasLocalChanges()) {
      requestPosts(false);
    }
  }
}
Program: 14336
Project: 14336
Buggy source:
public PostsListPost(Post post){
  postId=post.getLocalTablePostId();
  blogId=post.getLocalTableBlogId();
  featuredImageId=post.getFeaturedImageId();
  title=post.getTitle();
  description=post.getDescription();
  excerpt=post.getPostExcerpt();
  status=post.getPostStatus();
  isLocalDraft=post.isLocalDraft();
  hasLocalChanges=post.hasChangedFromLocalDraftToPublished();
  isUploading=post.isUploading();
  setDateCreatedGmt(post.getDate_created_gmt());
  if (!hasExcerpt() && hasDescription()) {
    excerpt=makeExcerpt(description);
  }
}

Fixed version (ground truth):
public PostsListPost(Post post){
  postId=post.getLocalTablePostId();
  blogId=post.getLocalTableBlogId();
  featuredImageId=post.getFeaturedImageId();
  title=post.getTitle();
  description=post.getDescription();
  excerpt=post.getPostExcerpt();
  status=post.getPostStatus();
  isLocalDraft=post.isLocalDraft();
  hasLocalChanges=post.isLocalChange();
  isUploading=post.isUploading();
  setDateCreatedGmt(post.getDate_created_gmt());
  if (!hasExcerpt() && hasDescription()) {
    excerpt=makeExcerpt(description);
  }
}