nus-yam/ex-repair huggingface dataset:
Program: 14811
Project: 14811
Buggy source:
public void loadPost(Post post){
  if (post == null || post.getTitle() == null)   return;
  String postTitle="String_Node_Str" + post.getTitle() + "String_Node_Str";
  String postContent=postTitle + post.getDescription() + "String_Node_Str"+ post.getMt_text_more();
  if (post.isLocalDraft()) {
    mTextView.setVisibility(View.VISIBLE);
    mWebView.setVisibility(View.GONE);
    mTextView.setText(WPHtml.fromHtml(postContent.replaceAll("String_Node_Str","String_Node_Str"),getActivity(),post));
  }
 else {
    mTextView.setVisibility(View.GONE);
    mWebView.setVisibility(View.VISIBLE);
    String htmlText="String_Node_Str";
    htmlText=String.format(htmlText,StringUtils.addPTags(postContent));
    mWebView.loadDataWithBaseURL("String_Node_Str",htmlText,"String_Node_Str","String_Node_Str",null);
  }
}

Fixed version (ground truth):
public void loadPost(Post post){
  if (post == null)   return;
  String postTitle="String_Node_Str" + post.getTitle() + "String_Node_Str";
  String postContent=postTitle + post.getDescription() + "String_Node_Str"+ post.getMoreText();
  if (post.isLocalDraft()) {
    mTextView.setVisibility(View.VISIBLE);
    mWebView.setVisibility(View.GONE);
    mTextView.setText(WPHtml.fromHtml(postContent.replaceAll("String_Node_Str","String_Node_Str"),getActivity(),post));
  }
 else {
    mTextView.setVisibility(View.GONE);
    mWebView.setVisibility(View.VISIBLE);
    String htmlText="String_Node_Str";
    htmlText=String.format(htmlText,StringUtils.addPTags(postContent));
    mWebView.loadDataWithBaseURL("String_Node_Str",htmlText,"String_Node_Str","String_Node_Str",null);
  }
}
Program: 14815
Project: 14815
Buggy source:
public void newPost(){
  WPMobileStatsUtil.trackEventForWPCom(statEventForNewPost());
  if (WordPress.getCurrentBlog() == null) {
    if (!isFinishing())     Toast.makeText(this,R.string.blog_not_found,Toast.LENGTH_SHORT).show();
    return;
  }
  Post newPost=new Post(WordPress.getCurrentBlog().getLocalTableBlogId(),mIsPage);
  Intent i=new Intent(this,EditPostActivity.class);
  i.putExtra(EditPostActivity.EXTRA_POSTID,newPost.getId());
  i.putExtra(EditPostActivity.EXTRA_IS_PAGE,mIsPage);
  i.putExtra(EditPostActivity.EXTRA_IS_NEW_POST,true);
  startActivityForResult(i,ACTIVITY_EDIT_POST);
}

Fixed version (ground truth):
public void newPost(){
  WPMobileStatsUtil.trackEventForWPCom(statEventForNewPost());
  if (WordPress.getCurrentBlog() == null) {
    if (!isFinishing())     Toast.makeText(this,R.string.blog_not_found,Toast.LENGTH_SHORT).show();
    return;
  }
  Post newPost=new Post(WordPress.getCurrentBlog().getLocalTableBlogId(),mIsPage);
  WordPress.wpDB.savePost(newPost);
  Intent i=new Intent(this,EditPostActivity.class);
  i.putExtra(EditPostActivity.EXTRA_POSTID,newPost.getLocalTablePostId());
  i.putExtra(EditPostActivity.EXTRA_IS_PAGE,mIsPage);
  i.putExtra(EditPostActivity.EXTRA_IS_NEW_POST,true);
  startActivityForResult(i,ACTIVITY_EDIT_POST);
}
Program: 14816
Project: 14816
Buggy source:
private void showPost(long selectedID){
  if (WordPress.getCurrentBlog() == null)   return;
  Post post=new Post(WordPress.getCurrentLocalTableBlogId(),selectedID,mIsPage);
  if (post.getId() >= 0) {
    WordPress.currentPost=post;
    mOnPostSelectedListener.onPostSelected(post);
    mPostsListAdapter.notifyDataSetChanged();
  }
 else {
    if (!getActivity().isFinishing()) {
      FragmentTransaction ft=getFragmentManager().beginTransaction();
      WPAlertDialogFragment alert=WPAlertDialogFragment.newAlertDialog(getString(R.string.post_not_found));
      ft.add(alert,"String_Node_Str");
      ft.commitAllowingStateLoss();
    }
  }
}

Fixed version (ground truth):
private void showPost(long selectedId){
  if (WordPress.getCurrentBlog() == null)   return;
  Post post=WordPress.wpDB.getPostForLocalTablePostId(selectedId);
  if (post != null) {
    WordPress.currentPost=post;
    mOnPostSelectedListener.onPostSelected(post);
  }
 else {
    if (!getActivity().isFinishing()) {
      FragmentTransaction ft=getFragmentManager().beginTransaction();
      WPAlertDialogFragment alert=WPAlertDialogFragment.newAlertDialog(getString(R.string.post_not_found));
      ft.add(alert,"String_Node_Str");
      ft.commitAllowingStateLoss();
    }
  }
}
Program: 14817
Project: 14817
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Bundle extras=getIntent().getExtras();
  boolean isPage=getIntent().getBooleanExtra("String_Node_Str",false);
  if (isPage) {
    this.setTitle(StringUtils.unescapeHTML(WordPress.getCurrentBlog().getBlogName()) + "String_Node_Str" + getResources().getText(R.string.preview_page));
  }
 else {
    this.setTitle(StringUtils.unescapeHTML(WordPress.getCurrentBlog().getBlogName()) + "String_Node_Str" + getResources().getText(R.string.preview_post));
  }
  mWebView.setWebChromeClient(new WordPressWebChromeClient(this));
  mWebView.getSettings().setJavaScriptEnabled(true);
  if (extras != null) {
    long mPostID=extras.getLong("String_Node_Str");
    int mBlogID=extras.getInt("String_Node_Str");
    Post post=new Post(mBlogID,mPostID,isPage);
    if (post.getId() < 0)     Toast.makeText(this,R.string.post_not_found,Toast.LENGTH_SHORT).show();
 else     loadPostPreview(post);
  }
 else   if (WordPress.currentPost != null) {
    loadPostPreview(WordPress.currentPost);
  }
 else {
    Toast.makeText(this,R.string.post_not_found,Toast.LENGTH_SHORT).show();
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Bundle extras=getIntent().getExtras();
  boolean isPage=getIntent().getBooleanExtra("String_Node_Str",false);
  if (isPage) {
    this.setTitle(StringUtils.unescapeHTML(WordPress.getCurrentBlog().getBlogName()) + "String_Node_Str" + getResources().getText(R.string.preview_page));
  }
 else {
    this.setTitle(StringUtils.unescapeHTML(WordPress.getCurrentBlog().getBlogName()) + "String_Node_Str" + getResources().getText(R.string.preview_post));
  }
  mWebView.setWebChromeClient(new WordPressWebChromeClient(this));
  mWebView.getSettings().setJavaScriptEnabled(true);
  if (extras != null) {
    long mPostID=extras.getLong("String_Node_Str");
    Post post=WordPress.wpDB.getPostForLocalTablePostId(mPostID);
    if (post == null)     Toast.makeText(this,R.string.post_not_found,Toast.LENGTH_SHORT).show();
 else     loadPostPreview(post);
  }
 else   if (WordPress.currentPost != null) {
    loadPostPreview(WordPress.currentPost);
  }
 else {
    Toast.makeText(this,R.string.post_not_found,Toast.LENGTH_SHORT).show();
  }
}
Program: 14818
Project: 14818
Buggy source:
/** 
 * Load the post preview. If the post is in a non-public state (e.g. draft status, part of a non-public blog, etc), load the preview as an authenticated URL. Otherwise, just load the preview normally.
 * @param post Post to load the preview for.
 */
private void loadPostPreview(Post post){
  if (post != null) {
    String url=post.getPermaLink();
    Date d=new Date();
    if (WordPress.getCurrentBlog().isPrivate() || post.isLocalDraft() || post.isLocalChange()|| post.getDate_created_gmt() > d.getTime() || !post.getPost_status().equals("String_Node_Str")) {
      if (-1 == url.indexOf('?')) {
        url=url.concat("String_Node_Str");
      }
 else {
        url=url.concat("String_Node_Str");
      }
      loadAuthenticatedUrl(url);
    }
 else {
      loadUrl(url);
    }
  }
}

Fixed version (ground truth):
/** 
 * Load the post preview. If the post is in a non-public state (e.g. draft status, part of a non-public blog, etc), load the preview as an authenticated URL. Otherwise, just load the preview normally.
 * @param post Post to load the preview for.
 */
private void loadPostPreview(Post post){
  if (post != null) {
    String url=post.getPermaLink();
    Date d=new Date();
    if (WordPress.getCurrentBlog().isPrivate() || post.isLocalDraft() || post.isLocalChange()|| post.getDate_created_gmt() > d.getTime() || post.getStatusEnum() != PostStatus.PUBLISHED) {
      if (-1 == url.indexOf('?')) {
        url=url.concat("String_Node_Str");
      }
 else {
        url=url.concat("String_Node_Str");
      }
      loadAuthenticatedUrl(url);
    }
 else {
      loadUrl(url);
    }
  }
}
Program: 14819
Project: 14819
Buggy source:
public void emptyLocalKeyStoreFile(){
  if (localTrustStoreFile.exists()) {
    localTrustStoreFile.delete();
  }
  try {
    createLocalKeyStoreFile();
    localKeyStore=KeyStore.getInstance("String_Node_Str");
  }
 catch (  GeneralSecurityException e) {
  }
catch (  IOException e) {
  }
}

Fixed version (ground truth):
public void emptyLocalKeyStoreFile(){
  if (localTrustStoreFile.exists()) {
    localTrustStoreFile.delete();
  }
  try {
    createLocalKeyStoreFile();
  }
 catch (  GeneralSecurityException e) {
    AppLog.e(T.API,"String_Node_Str",e);
  }
catch (  IOException e) {
    AppLog.e(T.API,"String_Node_Str",e);
  }
}
Program: 14820
Project: 14820
Buggy source:
public String getSnippet(){
  if (mSnippet == null) {
    mSnippet=queryJSON("String_Node_Str","String_Node_Str");
  }
  return mSnippet;
}

Fixed version (ground truth):
String getSnippet(){
  if (mSnippet == null) {
    mSnippet=queryJSON("String_Node_Str","String_Node_Str");
  }
  return mSnippet;
}
Program: 14821
Project: 14821
Buggy source:
/** 
 * Gets the comment's text with getCommentText() and sends it through HTML.fromHTML
 */
public Spanned getCommentBody(){
  return mComment;
}

Fixed version (ground truth):
/** 
 * Gets the comment's text with getCommentText() and sends it through HTML.fromHTML
 */
Spanned getCommentBody(){
  return mComment;
}
Program: 14822
Project: 14822
Buggy source:
public Map<String,JSONObject> getActions(){
  if (mActions == null) {
    try {
      JSONArray actions=queryJSON("String_Node_Str",new JSONArray());
      mActions=new HashMap<String,JSONObject>(actions.length());
      for (int i=0; i < actions.length(); i++) {
        JSONObject action=actions.getJSONObject(i);
        String actionType=JSONUtil.queryJSON(action,"String_Node_Str","String_Node_Str");
        if (!actionType.equals("String_Node_Str")) {
          mActions.put(actionType,action);
        }
      }
    }
 catch (    JSONException e) {
      AppLog.e(T.NOTIFS,"String_Node_Str",e);
      mActions=new HashMap<String,JSONObject>();
    }
  }
  return mActions;
}

Fixed version (ground truth):
Map<String,JSONObject> getActions(){
  if (mActions == null) {
    try {
      JSONArray actions=queryJSON("String_Node_Str",new JSONArray());
      mActions=new HashMap<String,JSONObject>(actions.length());
      for (int i=0; i < actions.length(); i++) {
        JSONObject action=actions.getJSONObject(i);
        String actionType=JSONUtil.queryJSON(action,"String_Node_Str","String_Node_Str");
        if (!actionType.equals("String_Node_Str")) {
          mActions.put(actionType,action);
        }
      }
    }
 catch (    JSONException e) {
      AppLog.e(T.NOTIFS,"String_Node_Str",e);
      mActions=new HashMap<String,JSONObject>();
    }
  }
  return mActions;
}
Program: 14823
Project: 14823
Buggy source:
public View getView(int position,View cachedView,ViewGroup parent){
  View v;
  if (cachedView == null) {
    v=getActivity().getLayoutInflater().inflate(R.layout.notifications_follow_row,null);
  }
 else {
    v=cachedView;
  }
  JSONObject noteItem=getItem(position + 1);
  JSONObject followAction=JSONUtil.queryJSON(noteItem,"String_Node_Str",new JSONObject());
  FollowRow row=(FollowRow)v;
  row.setFollowListener(new FollowListener());
  row.setAction(followAction);
  row.setText(JSONUtil.queryJSON(noteItem,"String_Node_Str","String_Node_Str"));
  row.getImageView().setImageUrl(JSONUtil.queryJSON(noteItem,"String_Node_Str","String_Node_Str"),WordPress.imageLoader);
  return v;
}

Fixed version (ground truth):
public View getView(int position,View cachedView,ViewGroup parent){
  View v;
  if (cachedView == null) {
    v=getActivity().getLayoutInflater().inflate(R.layout.notifications_follow_row,null);
  }
 else {
    v=cachedView;
  }
  JSONObject noteItem=getItem(position + 1);
  JSONObject followAction=JSONUtil.queryJSON(noteItem,"String_Node_Str",new JSONObject());
  FollowRow row=(FollowRow)v;
  row.setFollowListener(new FollowListener());
  row.setAction(followAction);
  row.setNameText(JSONUtil.queryJSON(noteItem,"String_Node_Str","String_Node_Str"));
  row.getImageView().setImageUrl(JSONUtil.queryJSON(noteItem,"String_Node_Str","String_Node_Str"),WordPress.imageLoader);
  return v;
}
Program: 14824
Project: 14824
Buggy source:
public View getView(int position,View cachedView,ViewGroup parent){
  View v;
  if (cachedView == null) {
    v=getActivity().getLayoutInflater().inflate(R.layout.notifications_follow_row,null);
  }
 else {
    v=cachedView;
  }
  JSONObject noteItem=getItem(position);
  JSONObject followAction=JSONUtil.queryJSON(noteItem,"String_Node_Str",new JSONObject());
  FollowRow row=(FollowRow)v;
  row.setFollowListener(new FollowListener());
  row.setAction(followAction);
  row.setText(JSONUtil.queryJSON(noteItem,"String_Node_Str","String_Node_Str"));
  row.getImageView().setImageUrl(JSONUtil.queryJSON(noteItem,"String_Node_Str","String_Node_Str"),WordPress.imageLoader);
  return v;
}

Fixed version (ground truth):
public View getView(int position,View cachedView,ViewGroup parent){
  View v;
  if (cachedView == null) {
    v=getActivity().getLayoutInflater().inflate(R.layout.notifications_follow_row,null);
  }
 else {
    v=cachedView;
  }
  JSONObject noteItem=getItem(position);
  JSONObject followAction=JSONUtil.queryJSON(noteItem,"String_Node_Str",new JSONObject());
  FollowRow row=(FollowRow)v;
  row.setFollowListener(new FollowListener());
  row.setAction(followAction);
  String headerText=JSONUtil.queryJSON(noteItem,"String_Node_Str","String_Node_Str");
  if (TextUtils.isEmpty(headerText)) {
    headerText=HtmlUtils.fastStripHtml(JSONUtil.queryJSON(noteItem,"String_Node_Str","String_Node_Str"));
  }
  row.setNameText(headerText);
  row.getImageView().setImageUrl(JSONUtil.queryJSON(noteItem,"String_Node_Str","String_Node_Str"),WordPress.imageLoader);
  return v;
}
Program: 14825
Project: 14825
Buggy source:
protected static String fastUnescapeHtml(final String text){
  if (text == null || !text.contains("String_Node_Str"))   return text;
  return StringEscapeUtils.unescapeHtml(text);
}

Fixed version (ground truth):
public static String fastUnescapeHtml(final String text){
  if (text == null || !text.contains("String_Node_Str"))   return text;
  return StringEscapeUtils.unescapeHtml(text);
}
Program: 14826
Project: 14826
Buggy source:
private void showCommentForNote(Note note){
  mEnabledActions=note.getEnabledActions();
  Map<String,JSONObject> actions=note.getActions();
  if (actions.size() > 0) {
    String firstKey=actions.keySet().iterator().next();
    JSONObject jsonAction=actions.get(firstKey);
    JSONObject jsonParams=jsonAction.optJSONObject("String_Node_Str");
    if (jsonParams != null) {
      mRemoteBlogId=jsonParams.optInt("String_Node_Str");
      int commentId=jsonParams.optInt("String_Node_Str");
      int localBlogId=WordPress.wpDB.getLocalTableBlogIdForRemoteBlogId(mRemoteBlogId);
      Comment comment=CommentTable.getComment(localBlogId,commentId);
      if (comment != null) {
        setComment(localBlogId,comment);
      }
 else {
        requestComment(localBlogId,mRemoteBlogId,commentId);
      }
    }
  }
 else {
    if (hasActivity())     ToastUtils.showToast(getActivity(),R.string.reader_toast_err_get_comment,ToastUtils.Duration.LONG);
  }
}

Fixed version (ground truth):
private void showCommentForNote(Note note){
  mEnabledActions=note.getEnabledActions();
  mRemoteBlogId=note.getBlogId();
  long commentId=note.getCommentId();
  int localBlogId=WordPress.wpDB.getLocalTableBlogIdForRemoteBlogId(mRemoteBlogId);
  Comment comment=CommentTable.getComment(localBlogId,commentId);
  if (comment != null) {
    setComment(localBlogId,comment);
  }
 else {
    requestComment(localBlogId,mRemoteBlogId,commentId);
  }
}
Program: 14827
Project: 14827
Buggy source:
private void requestComment(final int localBlogId,final int remoteBlogId,final int commentId){
  final ProgressBar progress=(hasActivity() ? (ProgressBar)getView().findViewById(R.id.progress_loading) : null);
  if (progress != null)   progress.setVisibility(View.VISIBLE);
  RestRequest.Listener restListener=new RestRequest.Listener(){
    @Override public void onResponse(    JSONObject jsonObject){
      mIsRequestingComment=false;
      if (hasActivity()) {
        if (progress != null)         progress.setVisibility(View.GONE);
        Comment comment=Comment.fromJSON(jsonObject);
        if (comment != null) {
          CommentTable.addComment(localBlogId,comment);
          setComment(localBlogId,comment);
        }
      }
    }
  }
;
  RestRequest.ErrorListener restErrListener=new RestRequest.ErrorListener(){
    @Override public void onErrorResponse(    VolleyError volleyError){
      mIsRequestingComment=false;
      AppLog.e(T.COMMENTS,VolleyUtils.errStringFromVolleyError(volleyError),volleyError);
      if (hasActivity()) {
        if (progress != null)         progress.setVisibility(View.GONE);
        ToastUtils.showToast(getActivity(),R.string.reader_toast_err_get_comment,ToastUtils.Duration.LONG);
      }
    }
  }
;
  final String path=String.format("String_Node_Str",remoteBlogId,commentId);
  mIsRequestingComment=true;
  WordPress.getRestClientUtils().get(path,restListener,restErrListener);
}

Fixed version (ground truth):
private void requestComment(final int localBlogId,final int remoteBlogId,final long commentId){
  final ProgressBar progress=(hasActivity() ? (ProgressBar)getView().findViewById(R.id.progress_loading) : null);
  if (progress != null)   progress.setVisibility(View.VISIBLE);
  RestRequest.Listener restListener=new RestRequest.Listener(){
    @Override public void onResponse(    JSONObject jsonObject){
      mIsRequestingComment=false;
      if (hasActivity()) {
        if (progress != null)         progress.setVisibility(View.GONE);
        Comment comment=Comment.fromJSON(jsonObject);
        if (comment != null) {
          CommentTable.addComment(localBlogId,comment);
          setComment(localBlogId,comment);
        }
      }
    }
  }
;
  RestRequest.ErrorListener restErrListener=new RestRequest.ErrorListener(){
    @Override public void onErrorResponse(    VolleyError volleyError){
      mIsRequestingComment=false;
      AppLog.e(T.COMMENTS,VolleyUtils.errStringFromVolleyError(volleyError),volleyError);
      if (hasActivity()) {
        if (progress != null)         progress.setVisibility(View.GONE);
        ToastUtils.showToast(getActivity(),R.string.reader_toast_err_get_comment,ToastUtils.Duration.LONG);
      }
    }
  }
;
  final String path=String.format("String_Node_Str",remoteBlogId,commentId);
  mIsRequestingComment=true;
  WordPress.getRestClientUtils().get(path,restListener,restErrListener);
}
Program: 14829
Project: 14829
Buggy source:
@Override public void run(){
  if (start) {
    attemptToSelectPost();
    mShouldAnimateRefreshButton=true;
    startAnimatingRefreshButton(mRefreshMenuItem);
    mIsRefreshing=true;
  }
 else {
    mShouldAnimateRefreshButton=false;
    stopAnimatingRefreshButton(mRefreshMenuItem);
    mIsRefreshing=false;
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (start) {
    mShouldAnimateRefreshButton=true;
    startAnimatingRefreshButton(mRefreshMenuItem);
    mIsRefreshing=true;
  }
 else {
    mShouldAnimateRefreshButton=false;
    stopAnimatingRefreshButton(mRefreshMenuItem);
    mIsRefreshing=false;
  }
}
Program: 14830
Project: 14830
Buggy source:
protected void checkForLocalChanges(boolean shouldPrompt){
  if (WordPress.getCurrentBlog() == null)   return;
  boolean hasLocalChanges=WordPress.wpDB.findLocalChanges(WordPress.getCurrentBlog().getLocalTableBlogId(),mIsPage);
  if (hasLocalChanges) {
    if (!shouldPrompt)     return;
    AlertDialog.Builder dialogBuilder=new AlertDialog.Builder(PostsActivity.this);
    dialogBuilder.setTitle(getResources().getText(R.string.local_changes));
    dialogBuilder.setMessage(getResources().getText(R.string.remote_changes));
    dialogBuilder.setPositiveButton(getResources().getText(R.string.yes),new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int whichButton){
        popPostDetail();
        attemptToSelectPost();
        mPostList.requestPosts(false);
      }
    }
);
    dialogBuilder.setNegativeButton(getResources().getText(R.string.no),new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int whichButton){
      }
    }
);
    dialogBuilder.setCancelable(true);
    if (!isFinishing()) {
      dialogBuilder.create().show();
    }
  }
 else {
    popPostDetail();
    attemptToSelectPost();
    mShouldAnimateRefreshButton=true;
    mPostList.requestPosts(false);
  }
}

Fixed version (ground truth):
protected void checkForLocalChanges(boolean shouldPrompt){
  if (WordPress.getCurrentBlog() == null)   return;
  boolean hasLocalChanges=WordPress.wpDB.findLocalChanges(WordPress.getCurrentBlog().getLocalTableBlogId(),mIsPage);
  if (hasLocalChanges) {
    if (!shouldPrompt)     return;
    AlertDialog.Builder dialogBuilder=new AlertDialog.Builder(PostsActivity.this);
    dialogBuilder.setTitle(getResources().getText(R.string.local_changes));
    dialogBuilder.setMessage(getResources().getText(R.string.remote_changes));
    dialogBuilder.setPositiveButton(getResources().getText(R.string.yes),new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int whichButton){
        popPostDetail();
        attemptToSelectPost();
        mPostList.requestPosts(false);
      }
    }
);
    dialogBuilder.setNegativeButton(getResources().getText(R.string.no),new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int whichButton){
      }
    }
);
    dialogBuilder.setCancelable(true);
    if (!isFinishing()) {
      dialogBuilder.create().show();
    }
  }
 else {
    popPostDetail();
    mShouldAnimateRefreshButton=true;
    mPostList.requestPosts(false);
  }
}
Program: 14832
Project: 14832
Buggy source:
@Override public void onRefresh(final boolean start){
  runOnUiThread(new Runnable(){
    @Override public void run(){
      if (start) {
        attemptToSelectPost();
        mShouldAnimateRefreshButton=true;
        startAnimatingRefreshButton(mRefreshMenuItem);
        mIsRefreshing=true;
      }
 else {
        mShouldAnimateRefreshButton=false;
        stopAnimatingRefreshButton(mRefreshMenuItem);
        mIsRefreshing=false;
      }
    }
  }
);
}

Fixed version (ground truth):
@Override public void onRefresh(final boolean start){
  runOnUiThread(new Runnable(){
    @Override public void run(){
      if (start) {
        mShouldAnimateRefreshButton=true;
        startAnimatingRefreshButton(mRefreshMenuItem);
        mIsRefreshing=true;
      }
 else {
        mShouldAnimateRefreshButton=false;
        stopAnimatingRefreshButton(mRefreshMenuItem);
        mIsRefreshing=false;
      }
    }
  }
);
}
Program: 14833
Project: 14833
Buggy source:
@Override protected void onResume(){
  super.onResume();
  if (WordPress.isSignedIn(PostsActivity.this)) {
    showReaderIfNoBlog();
  }
  if (WordPress.postsShouldRefresh) {
    checkForLocalChanges(false);
    WordPress.postsShouldRefresh=false;
  }
  attemptToSelectPost();
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  if (WordPress.isSignedIn(PostsActivity.this)) {
    showReaderIfNoBlog();
  }
  if (WordPress.postsShouldRefresh) {
    checkForLocalChanges(false);
    WordPress.postsShouldRefresh=false;
  }
}
Program: 14834
Project: 14834
Buggy source:
@Override public void OnPostUploaded(String postId){
  if (!hasActivity())   return;
  if (!NetworkUtils.checkConnection(getActivity()))   return;
  if (!TextUtils.isEmpty(postId)) {
    List<Object> apiArgs=new Vector<Object>();
    apiArgs.add(WordPress.getCurrentBlog());
    apiArgs.add(postId);
    apiArgs.add(mIsPage);
    ApiHelper.FetchSinglePostTask fetchPostTask=new ApiHelper.FetchSinglePostTask(new ApiHelper.FetchSinglePostTask.Callback(){
      @Override public void onSuccess(){
        if (!hasActivity())         return;
        mIsFetchingPosts=false;
        mOnRefreshListener.onRefresh(false);
        getPostListAdapter().loadPosts();
      }
      @Override public void onFailure(      ApiHelper.ErrorType errorType,      String errorMessage,      Throwable throwable){
        if (!hasActivity())         return;
        Toast.makeText(getActivity(),R.string.error_refresh_posts,Toast.LENGTH_SHORT).show();
        mIsFetchingPosts=false;
        mOnRefreshListener.onRefresh(false);
      }
    }
);
    mOnRefreshListener.onRefresh(true);
    mIsFetchingPosts=true;
    fetchPostTask.execute(apiArgs);
  }
}

Fixed version (ground truth):
@Override public void OnPostUploaded(String postId){
  if (!hasActivity())   return;
  if (!NetworkUtils.checkConnection(getActivity()))   return;
  if (!TextUtils.isEmpty(postId)) {
    List<Object> apiArgs=new Vector<Object>();
    apiArgs.add(WordPress.getCurrentBlog());
    apiArgs.add(postId);
    apiArgs.add(mIsPage);
    ApiHelper.FetchSinglePostTask fetchPostTask=new ApiHelper.FetchSinglePostTask(new ApiHelper.FetchSinglePostTask.Callback(){
      @Override public void onSuccess(){
        if (!hasActivity())         return;
        mIsFetchingPosts=false;
        mOnRefreshListener.onRefresh(false);
        getPostListAdapter().loadPosts();
        mOnSinglePostLoadedListener.onSinglePostLoaded();
      }
      @Override public void onFailure(      ApiHelper.ErrorType errorType,      String errorMessage,      Throwable throwable){
        if (!hasActivity())         return;
        Toast.makeText(getActivity(),R.string.error_refresh_posts,Toast.LENGTH_SHORT).show();
        mIsFetchingPosts=false;
        mOnRefreshListener.onRefresh(false);
      }
    }
);
    mOnRefreshListener.onRefresh(true);
    mIsFetchingPosts=true;
    fetchPostTask.execute(apiArgs);
  }
}
Program: 14835
Project: 14835
Buggy source:
public PostsListAdapter getPostListAdapter(){
  if (mPostsListAdapter == null) {
    PostsListAdapter.OnLoadMoreListener loadMoreListener=new PostsListAdapter.OnLoadMoreListener(){
      @Override public void onLoadMore(){
        if (mCanLoadMorePosts && !mIsFetchingPosts)         requestPosts(true);
      }
    }
;
    PostsListAdapter.OnPostsLoadedListener postsLoadedListener=new PostsListAdapter.OnPostsLoadedListener(){
      @Override public void onPostsLoaded(      int postCount){
        if (postCount == 0 && mCanLoadMorePosts) {
          requestPosts(false);
        }
 else         if (mShouldSelectFirstPost) {
          mShouldSelectFirstPost=false;
          if (mPostsListAdapter.getCount() > 0) {
            PostsListPost postsListPost=(PostsListPost)mPostsListAdapter.getItem(0);
            if (postsListPost != null) {
              showPost(postsListPost.getPostId());
              getListView().setItemChecked(0,true);
            }
          }
        }
      }
    }
;
    mPostsListAdapter=new PostsListAdapter(getActivity(),mIsPage,loadMoreListener,postsLoadedListener);
  }
  return mPostsListAdapter;
}

Fixed version (ground truth):
public PostsListAdapter getPostListAdapter(){
  if (mPostsListAdapter == null) {
    PostsListAdapter.OnLoadMoreListener loadMoreListener=new PostsListAdapter.OnLoadMoreListener(){
      @Override public void onLoadMore(){
        if (mCanLoadMorePosts && !mIsFetchingPosts)         requestPosts(true);
      }
    }
;
    PostsListAdapter.OnPostsLoadedListener postsLoadedListener=new PostsListAdapter.OnPostsLoadedListener(){
      @Override public void onPostsLoaded(      int postCount){
        if (postCount == 0 && mCanLoadMorePosts) {
          requestPosts(false);
        }
 else         if (mShouldSelectFirstPost) {
          mShouldSelectFirstPost=false;
          if (mPostsListAdapter.getCount() > 0) {
            PostsListPost postsListPost=(PostsListPost)mPostsListAdapter.getItem(0);
            if (postsListPost != null) {
              showPost(postsListPost.getPostId());
              getListView().setItemChecked(0,true);
            }
          }
        }
 else         if (Utils.isTablet()) {
          int selectedPosition=getListView().getCheckedItemPosition();
          if (selectedPosition != ListView.INVALID_POSITION && selectedPosition < mPostsListAdapter.getCount()) {
            PostsListPost postsListPost=(PostsListPost)mPostsListAdapter.getItem(selectedPosition);
            if (postsListPost != null) {
              showPost(postsListPost.getPostId());
            }
          }
        }
      }
    }
;
    mPostsListAdapter=new PostsListAdapter(getActivity(),mIsPage,loadMoreListener,postsLoadedListener);
  }
  return mPostsListAdapter;
}
Program: 14836
Project: 14836
Buggy source:
public void onAttach(Activity activity){
  super.onAttach(activity);
  try {
    mOnPostSelectedListener=(OnPostSelectedListener)activity;
    mOnRefreshListener=(OnRefreshListener)activity;
  }
 catch (  ClassCastException e) {
    activity.finish();
    throw new ClassCastException(activity.toString() + "String_Node_Str");
  }
}

Fixed version (ground truth):
public void onAttach(Activity activity){
  super.onAttach(activity);
  try {
    mOnPostSelectedListener=(OnPostSelectedListener)activity;
    mOnRefreshListener=(OnRefreshListener)activity;
    mOnSinglePostLoadedListener=(OnSinglePostLoadedListener)activity;
  }
 catch (  ClassCastException e) {
    activity.finish();
    throw new ClassCastException(activity.toString() + "String_Node_Str");
  }
}
Program: 14837
Project: 14837
Buggy source:
@Override public void onPostsLoaded(int postCount){
  if (postCount == 0 && mCanLoadMorePosts) {
    requestPosts(false);
  }
 else   if (mShouldSelectFirstPost) {
    mShouldSelectFirstPost=false;
    if (mPostsListAdapter.getCount() > 0) {
      PostsListPost postsListPost=(PostsListPost)mPostsListAdapter.getItem(0);
      if (postsListPost != null) {
        showPost(postsListPost.getPostId());
        getListView().setItemChecked(0,true);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onPostsLoaded(int postCount){
  if (postCount == 0 && mCanLoadMorePosts) {
    requestPosts(false);
  }
 else   if (mShouldSelectFirstPost) {
    mShouldSelectFirstPost=false;
    if (mPostsListAdapter.getCount() > 0) {
      PostsListPost postsListPost=(PostsListPost)mPostsListAdapter.getItem(0);
      if (postsListPost != null) {
        showPost(postsListPost.getPostId());
        getListView().setItemChecked(0,true);
      }
    }
  }
 else   if (Utils.isTablet()) {
    int selectedPosition=getListView().getCheckedItemPosition();
    if (selectedPosition != ListView.INVALID_POSITION && selectedPosition < mPostsListAdapter.getCount()) {
      PostsListPost postsListPost=(PostsListPost)mPostsListAdapter.getItem(selectedPosition);
      if (postsListPost != null) {
        showPost(postsListPost.getPostId());
      }
    }
  }
}
Program: 14838
Project: 14838
Buggy source:
@Override public void onSuccess(){
  if (!hasActivity())   return;
  mIsFetchingPosts=false;
  mOnRefreshListener.onRefresh(false);
  getPostListAdapter().loadPosts();
}

Fixed version (ground truth):
@Override public void onSuccess(){
  if (!hasActivity())   return;
  mIsFetchingPosts=false;
  mOnRefreshListener.onRefresh(false);
  getPostListAdapter().loadPosts();
  mOnSinglePostLoadedListener.onSinglePostLoaded();
}
Program: 14839
Project: 14839
Buggy source:
private void setGroupChevron(boolean isGroupExpanded,View groupView,boolean animate){
  final ImageView chevron=(ImageView)groupView.findViewById(R.id.stats_list_cell_chevron);
  if (chevron == null)   return;
  if (animate) {
    float start=(isGroupExpanded ? 0.0f : 90.0f);
    float end=(isGroupExpanded ? 90.0f : 0.0f);
    Animation rotate=new RotateAnimation(start,end,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
    rotate.setDuration(ANIM_DURATION);
    rotate.setInterpolator(getInterpolator());
    rotate.setFillAfter(true);
    chevron.startAnimation(rotate);
  }
 else {
    chevron.setImageResource(isGroupExpanded ? R.drawable.stats_chevron_down : R.drawable.stats_chevron_right);
  }
}

Fixed version (ground truth):
private void setGroupChevron(final boolean isGroupExpanded,View groupView,boolean animate){
  final ImageView chevron=(ImageView)groupView.findViewById(R.id.stats_list_cell_chevron);
  if (chevron == null)   return;
  if (animate) {
    chevron.setImageResource(isGroupExpanded ? R.drawable.stats_chevron_right : R.drawable.stats_chevron_down);
    float start=(isGroupExpanded ? 0.0f : 0.0f);
    float end=(isGroupExpanded ? 90.0f : -90.0f);
    Animation rotate=new RotateAnimation(start,end,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
    rotate.setDuration(ANIM_DURATION);
    rotate.setInterpolator(getInterpolator());
    rotate.setFillAfter(true);
    chevron.startAnimation(rotate);
  }
 else {
    chevron.setImageResource(isGroupExpanded ? R.drawable.stats_chevron_down : R.drawable.stats_chevron_right);
  }
}
Program: 14840
Project: 14840
Buggy source:
@Override public boolean onOptionsItemSelected(final MenuItem item){
switch (item.getItemId()) {
case R.id.menu_refresh:
    updateCommentList();
  return true;
case android.R.id.home:
if (isLarge()) {
  return super.onOptionsItemSelected(item);
}
 else {
  FragmentManager fm=getSupportFragmentManager();
  if (fm.getBackStackEntryCount() > 0) {
    fm.popBackStack();
    return true;
  }
}
break;
}
return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(final MenuItem item){
switch (item.getItemId()) {
case R.id.menu_refresh:
    updateCommentList();
  return true;
case android.R.id.home:
if (isLargeOrXLarge()) {
  return super.onOptionsItemSelected(item);
}
 else {
  FragmentManager fm=getSupportFragmentManager();
  if (fm.getBackStackEntryCount() > 0) {
    fm.popBackStack();
    return true;
  }
}
break;
}
return super.onOptionsItemSelected(item);
}
Program: 14841
Project: 14841
Buggy source:
@Override public boolean onOptionsItemSelected(final MenuItem item){
switch (item.getItemId()) {
case R.id.menu_refresh:
    refreshNotes();
  return true;
case android.R.id.home:
if (isLarge()) {
  return super.onOptionsItemSelected(item);
}
 else {
  FragmentManager fm=getSupportFragmentManager();
  if (fm.getBackStackEntryCount() > 0) {
    popNoteDetail();
    return true;
  }
 else {
    return super.onOptionsItemSelected(item);
  }
}
default :
return super.onOptionsItemSelected(item);
}
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(final MenuItem item){
switch (item.getItemId()) {
case R.id.menu_refresh:
    refreshNotes();
  return true;
case android.R.id.home:
if (isLargeOrXLarge()) {
  return super.onOptionsItemSelected(item);
}
 else {
  FragmentManager fm=getSupportFragmentManager();
  if (fm.getBackStackEntryCount() > 0) {
    popNoteDetail();
    return true;
  }
 else {
    return super.onOptionsItemSelected(item);
  }
}
default :
return super.onOptionsItemSelected(item);
}
}
Program: 14842
Project: 14842
Buggy source:
public void run(){
  if (getActivity() == null)   return;
  mPostsCountView.setText(fmtPosts);
  mCategoriesCountView.setText(fmtCategories);
  mTagsCountView.setText(fmtTags);
  mFollowersCountView.setText(fmtFollowers);
  mCommentsCountView.setText(fmtComments);
  mSharesCountView.setText(fmtShares);
}

Fixed version (ground truth):
public void run(){
  refreshSummary(stats);
}
Program: 14843
Project: 14843
Buggy source:
@Override public void onResume(){
  super.onResume();
  refreshSummary();
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  LocalBroadcastManager lbm=LocalBroadcastManager.getInstance(getActivity());
  lbm.registerReceiver(mReceiver,new IntentFilter(StatsService.ACTION_STATS_SUMMARY_UPDATED));
  refreshSummary();
}
Program: 14844
Project: 14844
Buggy source:
private void refreshSummary(){
  final Handler handler=new Handler();
  new Thread(){
    @Override public void run(){
      if (WordPress.getCurrentBlog() == null)       return;
      String blogId=WordPress.getCurrentBlog().getDotComBlogId();
      if (TextUtils.isEmpty(blogId))       blogId="String_Node_Str";
      StatsSummary stats=StatUtils.getSummary(blogId);
      int posts=(stats != null ? stats.getPosts() : 0);
      int categories=(stats != null ? stats.getCategories() : 0);
      int tags=(stats != null ? stats.getTags() : 0);
      int followers=(stats != null ? stats.getFollowersBlog() : 0);
      int comments=(stats != null ? stats.getFollowersComments() : 0);
      int shares=(stats != null ? stats.getShares() : 0);
      final String fmtPosts=FormatUtils.formatDecimal(posts);
      final String fmtCategories=FormatUtils.formatDecimal(categories);
      final String fmtTags=FormatUtils.formatDecimal(tags);
      final String fmtFollowers=FormatUtils.formatDecimal(followers);
      final String fmtComments=FormatUtils.formatDecimal(comments);
      final String fmtShares=FormatUtils.formatDecimal(shares);
      handler.post(new Runnable(){
        public void run(){
          if (getActivity() == null)           return;
          mPostsCountView.setText(fmtPosts);
          mCategoriesCountView.setText(fmtCategories);
          mTagsCountView.setText(fmtTags);
          mFollowersCountView.setText(fmtFollowers);
          mCommentsCountView.setText(fmtComments);
          mSharesCountView.setText(fmtShares);
        }
      }
);
    }
  }
.start();
}

Fixed version (ground truth):
private void refreshSummary(final StatsSummary stats){
  if (getActivity() == null)   return;
  if (stats == null) {
    mPostsCountView.setText("String_Node_Str");
    mCategoriesCountView.setText("String_Node_Str");
    mTagsCountView.setText("String_Node_Str");
    mFollowersCountView.setText("String_Node_Str");
    mCommentsCountView.setText("String_Node_Str");
    mSharesCountView.setText("String_Node_Str");
  }
 else {
    mPostsCountView.setText(FormatUtils.formatDecimal(stats.getPosts()));
    mCategoriesCountView.setText(FormatUtils.formatDecimal(stats.getCategories()));
    mTagsCountView.setText(FormatUtils.formatDecimal(stats.getTags()));
    mFollowersCountView.setText(FormatUtils.formatDecimal(stats.getFollowersBlog()));
    mCommentsCountView.setText(FormatUtils.formatDecimal(stats.getFollowersComments()));
    mSharesCountView.setText(FormatUtils.formatDecimal(stats.getShares()));
  }
}
Program: 14845
Project: 14845
Buggy source:
@Override public String getTitle(){
  return getString(R.string.stats_view_visitors_and_views);
}

Fixed version (ground truth):
@Override protected String getTitle(){
  return getString(R.string.stats_view_visitors_and_views);
}
Program: 14846
Project: 14846
Buggy source:
public void run(){
  refreshViews(summary);
}

Fixed version (ground truth):
public void run(){
  refreshSummary(summary);
}
Program: 14847
Project: 14847
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  String action=StringUtils.notNullStr(intent.getAction());
  if (action.equals(StatUtils.ACTION_STATS_SUMMARY_UPDATED)) {
    AppLog.i(AppLog.T.STATS,"String_Node_Str");
    StatsSummary summary=(StatsSummary)intent.getSerializableExtra(StatUtils.STATS_SUMMARY_UPDATED_EXTRA);
    refreshViews(summary);
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  String action=StringUtils.notNullStr(intent.getAction());
  if (action.equals(StatsService.ACTION_STATS_SUMMARY_UPDATED)) {
    Serializable serial=intent.getSerializableExtra(StatsService.STATS_SUMMARY_UPDATED_EXTRA);
    if (serial instanceof StatsSummary) {
      refreshSummary((StatsSummary)serial);
    }
  }
}
Program: 14848
Project: 14848
Buggy source:
@Override public void onResume(){
  super.onResume();
  LocalBroadcastManager lbm=LocalBroadcastManager.getInstance(getActivity());
  lbm.registerReceiver(mReceiver,new IntentFilter(StatUtils.ACTION_STATS_SUMMARY_UPDATED));
  refreshSummary();
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  LocalBroadcastManager lbm=LocalBroadcastManager.getInstance(getActivity());
  lbm.registerReceiver(mReceiver,new IntentFilter(StatsService.ACTION_STATS_SUMMARY_UPDATED));
  refreshSummary();
}
Program: 14849
Project: 14849
Buggy source:
private void refreshSummary(){
  if (WordPress.getCurrentBlog() == null)   return;
  final Handler handler=new Handler();
  new Thread(){
    @Override public void run(){
      String blogId=WordPress.getCurrentBlog().getDotComBlogId();
      if (TextUtils.isEmpty(blogId))       blogId="String_Node_Str";
      final StatsSummary summary=StatUtils.getSummary(blogId);
      handler.post(new Runnable(){
        public void run(){
          refreshViews(summary);
        }
      }
);
    }
  }
.start();
}

Fixed version (ground truth):
private void refreshSummary(final StatsSummary stats){
  if (getActivity() == null)   return;
  if (stats == null) {
    mVisitorsToday.setText("String_Node_Str");
    mViewsToday.setText("String_Node_Str");
    mViewsBestEver.setText("String_Node_Str");
    mViewsAllTime.setText("String_Node_Str");
    mCommentsAllTime.setText("String_Node_Str");
  }
 else {
    mVisitorsToday.setText(FormatUtils.formatDecimal(stats.getVisitorsToday()));
    mViewsToday.setText(FormatUtils.formatDecimal(stats.getViewsToday()));
    mViewsBestEver.setText(FormatUtils.formatDecimal(stats.getViewsBestDayTotal()));
    mViewsAllTime.setText(FormatUtils.formatDecimal(stats.getViewsAllTime()));
    mCommentsAllTime.setText(FormatUtils.formatDecimal(stats.getCommentsAllTime()));
  }
}
Program: 14850
Project: 14850
Buggy source:
@Override public void onResponse(final JSONObject response){
  new Thread(){
    @Override public void run(){
      parseResponse(response);
      notifyResponseReceived();
    }
  }
.start();
}

Fixed version (ground truth):
@Override public void onResponse(final JSONObject response){
  AppLog.d(AppLog.T.STATS,getTaskName() + "String_Node_Str");
  new Thread(){
    @Override public void run(){
      parseResponse(response);
      notifyResponseReceived();
    }
  }
.start();
}
Program: 14851
Project: 14851
Buggy source:
ContentResolver getContentResolver(){
  return WordPress.getContext().getContentResolver();
}

Fixed version (ground truth):
ContentResolver getContentResolver(){
  return getContext().getContentResolver();
}
Program: 14853
Project: 14853
Buggy source:
@Override public void run(){
  final String today=StatUtils.getCurrentDate();
  final String yesterday=StatUtils.getYesterdaysDate();
  executor.submit(new SummaryTask(blogId));
  executor.submit(new BarChartTask(blogId,StatsBarChartUnit.WEEK));
  executor.submit(new BarChartTask(blogId,StatsBarChartUnit.MONTH));
  executor.submit(new TopPostsAndPagesTask(blogId,today));
  executor.submit(new TopPostsAndPagesTask(blogId,yesterday));
  executor.submit(new ViewsByCountryTask(blogId,today));
  executor.submit(new ViewsByCountryTask(blogId,yesterday));
  executor.submit(new ClicksTask(blogId,today));
  executor.submit(new ClicksTask(blogId,yesterday));
  executor.submit(new ReferrersTask(blogId,today));
  executor.submit(new ReferrersTask(blogId,yesterday));
  executor.submit(new SearchEngineTermsTask(blogId,today));
  executor.submit(new SearchEngineTermsTask(blogId,yesterday));
  AppLog.i(T.STATS,"String_Node_Str");
  broadcastUpdate(true);
  try {
    executor.shutdown();
    if (!executor.awaitTermination(EXECUTOR_TIMEOUT_SECONDS,TimeUnit.SECONDS)) {
      AppLog.w(T.STATS,"String_Node_Str");
      executor.shutdownNow();
    }
  }
 catch (  InterruptedException e) {
    AppLog.e(T.STATS,e);
    executor.shutdownNow();
    Thread.currentThread().interrupt();
  }
 finally {
    AppLog.i(T.STATS,"String_Node_Str");
    broadcastUpdate(false);
  }
}

Fixed version (ground truth):
@Override public void run(){
  final String today=StatUtils.getCurrentDate();
  final String yesterday=StatUtils.getYesterdaysDate();
  executor.submit(new SummaryTask(blogId));
  executor.submit(new BarChartTask(blogId,StatsBarChartUnit.WEEK));
  executor.submit(new BarChartTask(blogId,StatsBarChartUnit.MONTH));
  executor.submit(new TopPostsAndPagesTask(blogId,today));
  executor.submit(new TopPostsAndPagesTask(blogId,yesterday));
  executor.submit(new ViewsByCountryTask(blogId,today));
  executor.submit(new ViewsByCountryTask(blogId,yesterday));
  executor.submit(new ClicksTask(blogId,today));
  executor.submit(new ClicksTask(blogId,yesterday));
  executor.submit(new ReferrersTask(blogId,today));
  executor.submit(new ReferrersTask(blogId,yesterday));
  executor.submit(new SearchEngineTermsTask(blogId,today));
  executor.submit(new SearchEngineTermsTask(blogId,yesterday));
  AppLog.i(T.STATS,"String_Node_Str");
  broadcastUpdate(true);
  try {
    executor.shutdown();
    if (!executor.awaitTermination(EXECUTOR_TIMEOUT_SECONDS,TimeUnit.SECONDS)) {
      AppLog.w(T.STATS,"String_Node_Str");
      executor.shutdownNow();
    }
  }
 catch (  InterruptedException e) {
    AppLog.w(T.STATS,"String_Node_Str");
    executor.shutdownNow();
    Thread.currentThread().interrupt();
  }
 finally {
    AppLog.i(T.STATS,"String_Node_Str");
    broadcastUpdate(false);
  }
}
Program: 14854
Project: 14854
Buggy source:
@Override void parseResponse(JSONObject response){
  if (response == null)   return;
  StatUtils.saveSummary(mBlogId,response);
  StatUtils.broadcastSummaryUpdated(StatUtils.getSummary(mBlogId));
}

Fixed version (ground truth):
@Override void parseResponse(JSONObject response){
  if (response == null)   return;
  StatUtils.saveSummary(mBlogId,response);
  StatsSummary stats=StatUtils.getSummary(mBlogId);
  if (stats != null) {
    LocalBroadcastManager lbm=LocalBroadcastManager.getInstance(getContext());
    Intent intent=new Intent(StatsService.ACTION_STATS_SUMMARY_UPDATED);
    intent.putExtra(StatsService.STATS_SUMMARY_UPDATED_EXTRA,stats);
    lbm.sendBroadcast(intent);
  }
}
Program: 14855
Project: 14855
Buggy source:
@Override public void onCommentSelected(Comment comment){
  if (comment == null)   return;
  FragmentManager fm=getSupportFragmentManager();
  fm.executePendingTransactions();
  CommentDetailFragment detailFragment=getDetailFragment();
  CommentsListFragment listFragment=getListFragment();
  if (detailFragment == null) {
    FragmentTransaction ft=fm.beginTransaction();
    String tagForFragment=getString(R.string.fragment_tag_comment_detail);
    detailFragment=CommentDetailFragment.newInstance(WordPress.getCurrentLocalTableBlogId(),comment.commentID);
    ft.add(R.id.layout_fragment_container,detailFragment,tagForFragment).addToBackStack(tagForFragment).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    if (listFragment != null)     ft.hide(listFragment);
    ft.commitAllowingStateLoss();
    mMenuDrawer.setDrawerIndicatorEnabled(false);
  }
 else {
    detailFragment.setComment(WordPress.getCurrentLocalTableBlogId(),comment.commentID);
    if (listFragment != null)     listFragment.setHighlightedCommentId(comment.commentID);
  }
}

Fixed version (ground truth):
@Override public void onCommentSelected(Comment comment){
  if (comment == null)   return;
  FragmentManager fm=getSupportFragmentManager();
  fm.executePendingTransactions();
  CommentDetailFragment detailFragment=getDetailFragment();
  CommentsListFragment listFragment=getListFragment();
  if (detailFragment == null) {
    FragmentTransaction ft=fm.beginTransaction();
    String tagForFragment=getString(R.string.fragment_tag_comment_detail);
    detailFragment=CommentDetailFragment.newInstance(WordPress.getCurrentLocalTableBlogId(),comment.commentID);
    ft.add(R.id.layout_fragment_container,detailFragment,tagForFragment).addToBackStack(tagForFragment).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    if (listFragment != null)     ft.hide(listFragment);
    ft.commitAllowingStateLoss();
    mMenuDrawer.setDrawerIndicatorEnabled(false);
  }
 else {
    if (hasReaderFragment())     fm.popBackStackImmediate();
    detailFragment.setComment(WordPress.getCurrentLocalTableBlogId(),comment.commentID);
    if (listFragment != null)     listFragment.setHighlightedCommentId(comment.commentID);
  }
}