Program: 14867
Project: 14867
Buggy source:
public void requestPosts(boolean loadMore){
  if (WordPress.getCurrentBlog() == null)   return;
  int postCount=getPostListAdapter().getRemotePostCount() + POSTS_REQUEST_COUNT;
  if (!loadMore) {
    mOnRefreshListener.onRefresh(true);
    postCount=POSTS_REQUEST_COUNT;
  }
  List<Object> apiArgs=new Vector<Object>();
  apiArgs.add(WordPress.getCurrentBlog());
  apiArgs.add(mIsPage);
  apiArgs.add(postCount);
  apiArgs.add(loadMore);
  if (mProgressFooterView != null && loadMore) {
    mProgressFooterView.setVisibility(View.VISIBLE);
  }
  ApiHelper.FetchPostsTask fetchPostsTaskTask=new ApiHelper.FetchPostsTask(new ApiHelper.FetchPostsTask.Callback(){
    @Override public void onSuccess(    int postCount){
      if (!hasActivity())       return;
      mOnRefreshListener.onRefresh(false);
      if (postCount == 0) {
        mCanLoadMorePosts=false;
        return;
      }
 else       if (postCount == getPostListAdapter().getRemotePostCount() && postCount != POSTS_REQUEST_COUNT) {
        mCanLoadMorePosts=false;
        if (mProgressFooterView != null) {
          mProgressFooterView.setVisibility(View.GONE);
        }
        return;
      }
      getPostListAdapter().loadPosts();
    }
    @Override public void onFailure(    ApiHelper.ErrorType errorType,    String errorMessage,    Throwable throwable){
      if (!hasActivity())       return;
      mOnRefreshListener.onRefresh(false);
      if (mProgressFooterView != null)       mProgressFooterView.setVisibility(View.GONE);
      if (!TextUtils.isEmpty(errorMessage) && !getActivity().isFinishing()) {
        FragmentTransaction ft=getFragmentManager().beginTransaction();
        WPAlertDialogFragment alert=WPAlertDialogFragment.newAlertDialog(mIsPage ? getString(R.string.error_refresh_pages) : getString(R.string.error_refresh_posts));
        try {
          alert.show(ft,"String_Node_Str");
        }
 catch (        Exception e) {
          e.printStackTrace();
        }
      }
    }
  }
);
  fetchPostsTaskTask.execute(apiArgs);
}

Fixed version (ground truth):
public void requestPosts(boolean loadMore){
  if (WordPress.getCurrentBlog() == null)   return;
  int postCount=getPostListAdapter().getRemotePostCount() + POSTS_REQUEST_COUNT;
  if (!loadMore) {
    mOnRefreshListener.onRefresh(true);
    postCount=POSTS_REQUEST_COUNT;
  }
  List<Object> apiArgs=new Vector<Object>();
  apiArgs.add(WordPress.getCurrentBlog());
  apiArgs.add(mIsPage);
  apiArgs.add(postCount);
  apiArgs.add(loadMore);
  if (mProgressFooterView != null && loadMore) {
    mProgressFooterView.setVisibility(View.VISIBLE);
  }
  ApiHelper.FetchPostsTask fetchPostsTaskTask=new ApiHelper.FetchPostsTask(new ApiHelper.FetchPostsTask.Callback(){
    @Override public void onSuccess(    int postCount){
      mIsFetchingPosts=false;
      if (!hasActivity())       return;
      mOnRefreshListener.onRefresh(false);
      if (postCount == 0) {
        mCanLoadMorePosts=false;
      }
 else       if (postCount == getPostListAdapter().getRemotePostCount() && postCount != POSTS_REQUEST_COUNT) {
        mCanLoadMorePosts=false;
        if (mProgressFooterView != null) {
          mProgressFooterView.setVisibility(View.GONE);
        }
        return;
      }
      getPostListAdapter().loadPosts();
    }
    @Override public void onFailure(    ApiHelper.ErrorType errorType,    String errorMessage,    Throwable throwable){
      mIsFetchingPosts=false;
      if (!hasActivity())       return;
      mOnRefreshListener.onRefresh(false);
      if (mProgressFooterView != null)       mProgressFooterView.setVisibility(View.GONE);
      if (!TextUtils.isEmpty(errorMessage) && !getActivity().isFinishing()) {
        FragmentTransaction ft=getFragmentManager().beginTransaction();
        WPAlertDialogFragment alert=WPAlertDialogFragment.newAlertDialog(mIsPage ? getString(R.string.error_refresh_pages) : getString(R.string.error_refresh_posts));
        try {
          alert.show(ft,"String_Node_Str");
        }
 catch (        Exception e) {
          e.printStackTrace();
        }
      }
    }
  }
);
  mIsFetchingPosts=true;
  fetchPostsTaskTask.execute(apiArgs);
}