nus-yam/ex-repair huggingface dataset:
Program: 14711
Project: 14711
Buggy source:
private void refreshStats(){
  if (WordPress.getCurrentBlog() == null) {
    mPullToRefreshHelper.setRefreshing(false);
    return;
  }
  if (!NetworkUtils.isNetworkAvailable(this)) {
    mPullToRefreshHelper.setRefreshing(false);
    return;
  }
  if (mIsUpdatingStats) {
    mPullToRefreshHelper.setRefreshing(false);
    AppLog.w(T.STATS,"String_Node_Str");
    return;
  }
  final String blogId;
  if (WordPress.getCurrentBlog().isDotcomFlag() && dotComCredentialsMatch()) {
    blogId=String.valueOf(WordPress.getCurrentBlog().getRemoteBlogId());
  }
 else {
    blogId=getBlogId();
    if (blogId == null) {
      new ApiHelper.RefreshBlogContentTask(this,WordPress.getCurrentBlog(),new VerifyJetpackSettingsCallback(StatsActivity.this)).execute(false);
      return;
    }
  }
  if (!mHasVerifiedCreds) {
    verifyCredentials(blogId);
  }
  Intent intent=new Intent(this,StatsService.class);
  intent.putExtra(StatsService.ARG_BLOG_ID,blogId);
  startService(intent);
  WordPress.statsLastPingDate=new Date();
}

Fixed version (ground truth):
private void refreshStats(){
  if (WordPress.getCurrentBlog() == null) {
    mPullToRefreshHelper.setRefreshing(false);
    return;
  }
  if (!NetworkUtils.isNetworkAvailable(this)) {
    mPullToRefreshHelper.setRefreshing(false);
    return;
  }
  if (mIsUpdatingStats) {
    mPullToRefreshHelper.setRefreshing(false);
    AppLog.w(T.STATS,"String_Node_Str");
    return;
  }
  final String blogId;
  if (WordPress.getCurrentBlog().isDotcomFlag() && dotComCredentialsMatch()) {
    blogId=String.valueOf(WordPress.getCurrentBlog().getRemoteBlogId());
  }
 else {
    blogId=getBlogId();
    if (blogId == null) {
      new ApiHelper.RefreshBlogContentTask(this,WordPress.getCurrentBlog(),new VerifyJetpackSettingsCallback(StatsActivity.this)).execute(false);
      return;
    }
  }
  if (!mHasVerifiedCreds) {
    verifyCredentials(blogId);
  }
  Intent intent=new Intent(this,StatsService.class);
  intent.putExtra(StatsService.ARG_BLOG_ID,blogId);
  startService(intent);
}
Program: 14712
Project: 14712
Buggy source:
public static void setIsFollowedBlogUrl(String url,boolean isFollowed){
  if (TextUtils.isEmpty(url))   return;
  SQLiteDatabase db=ReaderDatabase.getWritableDb();
  db.beginTransaction();
  try {
    final String normUrl=UrlUtils.normalizeUrl(url);
    SQLiteStatement stmt=db.compileStatement("String_Node_Str");
    try {
      stmt.bindString(1,normUrl);
      stmt.bindLong(2,SqlUtils.boolToSql(isFollowed));
      stmt.execute();
    }
  finally {
      SqlUtils.closeStatement(stmt);
    }
    ContentValues values=new ContentValues();
    values.put("String_Node_Str",SqlUtils.boolToSql(isFollowed));
    String[] args={normUrl};
    db.update("String_Node_Str",values,"String_Node_Str",args);
    db.setTransactionSuccessful();
  }
  finally {
    db.endTransaction();
  }
}

Fixed version (ground truth):
private static void setIsFollowedBlogUrl(String url,boolean isFollowed,boolean updateBlogInfoTable){
  if (TextUtils.isEmpty(url)) {
    return;
  }
  String normUrl=UrlUtils.normalizeUrl(url);
  long sqlIsFollowed=SqlUtils.boolToSql(isFollowed);
  SQLiteStatement stmt=ReaderDatabase.getWritableDb().compileStatement("String_Node_Str");
  try {
    stmt.bindString(1,normUrl);
    stmt.bindLong(2,sqlIsFollowed);
    stmt.execute();
  }
  finally {
    SqlUtils.closeStatement(stmt);
  }
  if (updateBlogInfoTable) {
    ContentValues values=new ContentValues();
    values.put("String_Node_Str",sqlIsFollowed);
    String[] args={normUrl};
    ReaderDatabase.getWritableDb().update("String_Node_Str",values,"String_Node_Str",args);
  }
}
Program: 14713
Project: 14713
Buggy source:
public static boolean isFollowedBlogUrl(String url){
  if (TextUtils.isEmpty(url))   return false;
  String[] args={UrlUtils.normalizeUrl(url)};
  return SqlUtils.boolForQuery(ReaderDatabase.getReadableDb(),"String_Node_Str",args);
}

Fixed version (ground truth):
public static boolean isFollowedBlogUrl(String url){
  if (TextUtils.isEmpty(url)) {
    return false;
  }
  String[] args={UrlUtils.normalizeUrl(url)};
  return SqlUtils.boolForQuery(ReaderDatabase.getReadableDb(),"String_Node_Str",args);
}
Program: 14714
Project: 14714
Buggy source:
public static void setBlogInfo(ReaderBlogInfo blog){
  if (blog == null)   return;
  String sql="String_Node_Str" + "String_Node_Str" + "String_Node_Str";
  SQLiteStatement stmt=ReaderDatabase.getWritableDb().compileStatement(sql);
  try {
    stmt.bindLong(1,blog.blogId);
    stmt.bindString(2,UrlUtils.normalizeUrl(blog.getUrl()));
    stmt.bindString(3,blog.getName());
    stmt.bindString(4,blog.getDescription());
    stmt.bindLong(5,SqlUtils.boolToSql(blog.isPrivate));
    stmt.bindLong(6,SqlUtils.boolToSql(blog.isJetpack));
    stmt.bindLong(7,SqlUtils.boolToSql(blog.isFollowing));
    stmt.bindLong(8,blog.numSubscribers);
    stmt.execute();
    stmt.clearBindings();
  }
  finally {
    SqlUtils.closeStatement(stmt);
  }
}

Fixed version (ground truth):
public static void setBlogInfo(ReaderBlogInfo blogInfo){
  if (blogInfo == null) {
    return;
  }
  String sql="String_Node_Str" + "String_Node_Str" + "String_Node_Str";
  SQLiteStatement stmt=ReaderDatabase.getWritableDb().compileStatement(sql);
  try {
    stmt.bindLong(1,blogInfo.blogId);
    stmt.bindString(2,UrlUtils.normalizeUrl(blogInfo.getUrl()));
    stmt.bindString(3,blogInfo.getName());
    stmt.bindString(4,blogInfo.getDescription());
    stmt.bindLong(5,SqlUtils.boolToSql(blogInfo.isPrivate));
    stmt.bindLong(6,SqlUtils.boolToSql(blogInfo.isJetpack));
    stmt.bindLong(7,SqlUtils.boolToSql(blogInfo.isFollowing));
    stmt.bindLong(8,blogInfo.numSubscribers);
    stmt.execute();
    stmt.clearBindings();
  }
  finally {
    SqlUtils.closeStatement(stmt);
  }
  setIsFollowedBlogUrl(blogInfo.getUrl(),blogInfo.isFollowing,false);
}
Program: 14715
Project: 14715
Buggy source:
public static void setFollowedBlogUrls(ReaderUrlList urls){
  SQLiteDatabase db=ReaderDatabase.getWritableDb();
  db.beginTransaction();
  SQLiteStatement stmtUrl=db.compileStatement("String_Node_Str");
  SQLiteStatement stmtInfo=db.compileStatement("String_Node_Str");
  try {
    long sqlTrue=SqlUtils.boolToSql(true);
    db.execSQL("String_Node_Str");
    db.execSQL("String_Node_Str");
    if (urls != null && urls.size() > 0) {
      for (      String url : urls) {
        String normUrl=UrlUtils.normalizeUrl(url);
        stmtUrl.bindString(1,normUrl);
        stmtUrl.bindLong(2,sqlTrue);
        stmtUrl.execute();
        stmtUrl.clearBindings();
        stmtInfo.bindLong(1,sqlTrue);
        stmtInfo.bindString(2,normUrl);
        stmtInfo.execute();
        stmtInfo.clearBindings();
      }
    }
    db.setTransactionSuccessful();
  }
  finally {
    db.endTransaction();
    SqlUtils.closeStatement(stmtUrl);
    SqlUtils.closeStatement(stmtInfo);
  }
}

Fixed version (ground truth):
public static void setFollowedBlogUrls(ReaderUrlList urls){
  SQLiteDatabase db=ReaderDatabase.getWritableDb();
  db.beginTransaction();
  SQLiteStatement stmtUrl=db.compileStatement("String_Node_Str");
  SQLiteStatement stmtInfo=db.compileStatement("String_Node_Str");
  try {
    db.execSQL("String_Node_Str");
    db.execSQL("String_Node_Str");
    if (urls != null && urls.size() > 0) {
      long sqlTrue=SqlUtils.boolToSql(true);
      for (      String url : urls) {
        String normUrl=UrlUtils.normalizeUrl(url);
        stmtUrl.bindString(1,normUrl);
        stmtUrl.bindLong(2,sqlTrue);
        stmtUrl.execute();
        stmtUrl.clearBindings();
        stmtInfo.bindLong(1,sqlTrue);
        stmtInfo.bindString(2,normUrl);
        stmtInfo.execute();
        stmtInfo.clearBindings();
      }
    }
    db.setTransactionSuccessful();
  }
  finally {
    db.endTransaction();
    SqlUtils.closeStatement(stmtUrl);
    SqlUtils.closeStatement(stmtInfo);
  }
}
Program: 14716
Project: 14716
Buggy source:
private void requestBlogInfo(final long blogId){
  if (!mHasBlogInfo) {
    showProgress();
  }
  ReaderActions.RequestBlogInfoListener listener=new ReaderActions.RequestBlogInfoListener(){
    @Override public void onResult(    ReaderBlogInfo blogInfo){
      hideProgress();
      if (blogInfo != null) {
        showBlogInfo(blogInfo);
      }
    }
  }
;
  ReaderBlogActions.updateBlogInfo(blogId,listener);
}

Fixed version (ground truth):
private void requestBlogInfo(final long blogId){
  if (!mHasBlogInfo) {
    showProgress();
  }
  ReaderActions.UpdateBlogInfoListener listener=new ReaderActions.UpdateBlogInfoListener(){
    @Override public void onResult(    ReaderBlogInfo blogInfo){
      hideProgress();
      if (blogInfo != null) {
        showBlogInfo(blogInfo);
      }
    }
  }
;
  ReaderBlogActions.updateBlogInfo(blogId,listener);
}
Program: 14718
Project: 14718
Buggy source:
private void toggleBlogFollowStatus(TextView txtFollow,ReaderBlogInfo blogInfo){
  if (blogInfo == null || txtFollow == null) {
    return;
  }
  AniUtils.zoomAction(txtFollow);
  boolean isCurrentlyFollowing=ReaderBlogTable.isFollowedBlogUrl(blogInfo.getUrl());
  boolean isAskingToFollow=!isCurrentlyFollowing;
  if (ReaderBlogActions.performFollowAction(blogInfo.blogId,blogInfo.getUrl(),isAskingToFollow)) {
    boolean isNowFollowing=!isCurrentlyFollowing;
    showBlogFollowStatus(txtFollow,isNowFollowing);
  }
}

Fixed version (ground truth):
private void toggleBlogFollowStatus(TextView txtFollow,ReaderBlogInfo blogInfo){
  if (blogInfo == null || txtFollow == null) {
    return;
  }
  AniUtils.zoomAction(txtFollow);
  boolean isAskingToFollow=!blogInfo.isFollowing;
  if (ReaderBlogActions.performFollowAction(blogInfo.blogId,blogInfo.getUrl(),isAskingToFollow)) {
    showBlogFollowStatus(txtFollow,isAskingToFollow);
  }
}
Program: 14719
Project: 14719
Buggy source:
private void updatePostsWithCurrentTag(RequestDataAction updateAction){
  if (hasCurrentTag()) {
    updatePostsWithTag(mCurrentTag,updateAction,RefreshType.MANUAL);
  }
}

Fixed version (ground truth):
private void updatePostsWithCurrentTag(RequestDataAction updateAction){
  if (hasCurrentTag()) {
    updatePostsWithTag(mCurrentTag,updateAction,RefreshType.AUTOMATIC);
  }
}
Program: 14720
Project: 14720
Buggy source:
public static void updateBlogInfo(long blogId,final ReaderActions.RequestBlogInfoListener infoListener){
  RestRequest.Listener listener=new RestRequest.Listener(){
    @Override public void onResponse(    JSONObject jsonObject){
      handleUpdateBlogInfoResponse(jsonObject,infoListener);
    }
  }
;
  RestRequest.ErrorListener errorListener=new RestRequest.ErrorListener(){
    @Override public void onErrorResponse(    VolleyError volleyError){
      AppLog.e(T.READER,volleyError);
      if (infoListener != null) {
        infoListener.onResult(null);
      }
    }
  }
;
  WordPress.getRestClientUtils().get("String_Node_Str" + blogId,listener,errorListener);
}

Fixed version (ground truth):
public static void updateBlogInfo(long blogId,final ReaderActions.UpdateBlogInfoListener infoListener){
  RestRequest.Listener listener=new RestRequest.Listener(){
    @Override public void onResponse(    JSONObject jsonObject){
      handleUpdateBlogInfoResponse(jsonObject,infoListener);
    }
  }
;
  RestRequest.ErrorListener errorListener=new RestRequest.ErrorListener(){
    @Override public void onErrorResponse(    VolleyError volleyError){
      AppLog.e(T.READER,volleyError);
      if (infoListener != null) {
        infoListener.onResult(null);
      }
    }
  }
;
  WordPress.getRestClientUtils().get("String_Node_Str" + blogId,listener,errorListener);
}
Program: 14722
Project: 14722
Buggy source:
private static void handleUpdateBlogInfoResponse(JSONObject jsonObject,ReaderActions.RequestBlogInfoListener infoListener){
  if (jsonObject == null) {
    if (infoListener != null) {
      infoListener.onResult(null);
    }
    return;
  }
  ReaderBlogInfo blogInfo=ReaderBlogInfo.fromJson(jsonObject);
  ReaderBlogTable.setBlogInfo(blogInfo);
  if (infoListener != null) {
    infoListener.onResult(blogInfo);
  }
}

Fixed version (ground truth):
private static void handleUpdateBlogInfoResponse(JSONObject jsonObject,ReaderActions.UpdateBlogInfoListener infoListener){
  if (jsonObject == null) {
    if (infoListener != null) {
      infoListener.onResult(null);
    }
    return;
  }
  ReaderBlogInfo blogInfo=ReaderBlogInfo.fromJson(jsonObject);
  ReaderBlogTable.setBlogInfo(blogInfo);
  if (infoListener != null) {
    infoListener.onResult(blogInfo);
  }
}
Program: 14724
Project: 14724
Buggy source:
@SuppressLint("String_Node_Str") private void loadPosts(){
  if (mIsTaskRunning)   AppLog.w(T.READER,"String_Node_Str");
  if (SysUtils.canUseExecuteOnExecutor()) {
    new LoadPostsTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
  }
 else {
    new LoadPostsTask().execute();
  }
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") private void loadPosts(){
  if (mIsTaskRunning) {
    AppLog.w(T.READER,"String_Node_Str");
  }
  if (SysUtils.canUseExecuteOnExecutor()) {
    new LoadPostsTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
  }
 else {
    new LoadPostsTask().execute();
  }
}
Program: 14725
Project: 14725
Buggy source:
public WPDelayedHurlStack(final Context ctx,final Blog currentBlog){
  mCurrentBlog=currentBlog;
  mCtx=ctx;
  Thread SSLContextInitializer=new Thread(){
    @Override public void run(){
      try {
        TrustManager[] trustAllowedCerts=new TrustManager[]{new WPTrustManager(SelfSignedSSLCertsManager.getInstance(ctx).getLocalKeyStore())};
        SSLContext context=SSLContext.getInstance("String_Node_Str");
        context.init(null,trustAllowedCerts,new SecureRandom());
        mSslSocketFactory=context.getSocketFactory();
      }
 catch (      NoSuchAlgorithmException e) {
        AppLog.e(T.API,e);
      }
catch (      KeyManagementException e) {
        AppLog.e(T.API,e);
      }
catch (      GeneralSecurityException e) {
        AppLog.e(T.API,e);
      }
catch (      IOException e) {
        AppLog.e(T.API,e);
      }
    }
  }
;
  SSLContextInitializer.start();
}

Fixed version (ground truth):
public WPDelayedHurlStack(final Context ctx,final Blog currentBlog){
  mCurrentBlog=currentBlog;
  mCtx=ctx;
  Thread sslContextInitializer=new Thread(){
    @Override public void run(){
      try {
        TrustManager[] trustAllowedCerts=new TrustManager[]{new WPTrustManager(SelfSignedSSLCertsManager.getInstance(ctx).getLocalKeyStore())};
        SSLContext context=SSLContext.getInstance("String_Node_Str");
        context.init(null,trustAllowedCerts,new SecureRandom());
        mSslSocketFactory=context.getSocketFactory();
      }
 catch (      NoSuchAlgorithmException e) {
        AppLog.e(T.API,e);
      }
catch (      KeyManagementException e) {
        AppLog.e(T.API,e);
      }
catch (      GeneralSecurityException e) {
        AppLog.e(T.API,e);
      }
catch (      IOException e) {
        AppLog.e(T.API,e);
      }
    }
  }
;
  sslContextInitializer.start();
}
Program: 14726
Project: 14726
Buggy source:
private void showDetailFragment(long blogId,long postId){
  AnalyticsTracker.track(AnalyticsTracker.Stat.READER_OPENED_ARTICLE);
  String tagForFragment=getString(R.string.fragment_tag_reader_post_detail);
  Fragment fragment=ReaderPostDetailFragment.newInstance(blogId,postId,mIsBlogDetail);
  FragmentTransaction ft=getSupportFragmentManager().beginTransaction();
  ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
  if (hasListFragment()) {
    ft.replace(R.id.fragment_container,fragment,tagForFragment);
    ft.addToBackStack(tagForFragment);
  }
 else {
    ft.add(R.id.fragment_container,fragment,tagForFragment);
  }
  ft.commit();
}

Fixed version (ground truth):
private void showDetailFragment(long blogId,long postId){
  AnalyticsTracker.track(AnalyticsTracker.Stat.READER_OPENED_ARTICLE);
  String tagForFragment=getString(R.string.fragment_tag_reader_post_detail);
  Fragment fragment=ReaderPostDetailFragment.newInstance(blogId,postId,mIsBlogDetail);
  FragmentTransaction ft=getSupportFragmentManager().beginTransaction();
  ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
  ft.add(R.id.fragment_container,fragment,tagForFragment);
  if (hasListFragment()) {
    ft.addToBackStack(tagForFragment);
  }
  ft.commit();
}
Program: 14727
Project: 14727
Buggy source:
private void loadHeaderImage(final ReaderBlogInfo blogInfo){
  if (blogInfo == null || blogInfo.isPrivate) {
    return;
  }
  WPNetworkImageView.ImageListener imageListener=new WPNetworkImageView.ImageListener(){
    @Override public void onImageLoaded(    boolean succeeded){
      if (hasActivity() && succeeded) {
        scaleHeaderImage();
        mHasLoadedHeaderImage=true;
      }
    }
  }
;
  final String imageUrl=blogInfo.getMshotsUrl(mHeaderImageWidth);
  mHeaderImage.setImageUrl(imageUrl,WPNetworkImageView.ImageType.MSHOT,imageListener);
}

Fixed version (ground truth):
private void loadHeaderImage(final ReaderBlogInfo blogInfo){
  if (blogInfo == null || blogInfo.isPrivate) {
    return;
  }
  WPNetworkImageView.ImageListener imageListener=new WPNetworkImageView.ImageListener(){
    @Override public void onImageLoaded(    boolean succeeded){
      if (succeeded && hasActivity()) {
        scaleHeaderImage();
        mHasLoadedHeaderImage=true;
      }
    }
  }
;
  final String imageUrl=blogInfo.getMshotsUrl(mHeaderImageWidth);
  mHeaderImage.setImageUrl(imageUrl,WPNetworkImageView.ImageType.MSHOT,imageListener);
}
Program: 14728
Project: 14728
Buggy source:
void updatePostsInCurrentBlog(final RequestDataAction updateAction){
  setIsUpdating(true,updateAction);
  ReaderPostActions.requestPostsForBlog(mCurrentBlogId,updateAction,new ReaderActions.ActionListener(){
    @Override public void onActionResult(    boolean succeeded){
      if (!hasActivity()) {
        return;
      }
      setIsUpdating(false,updateAction);
      if (succeeded) {
        refreshPosts();
      }
    }
  }
);
}

Fixed version (ground truth):
void updatePostsInCurrentBlog(final RequestDataAction updateAction){
  if (!NetworkUtils.isNetworkAvailable(getActivity())) {
    AppLog.i(T.READER,"String_Node_Str");
    return;
  }
  setIsUpdating(true,updateAction);
  ReaderPostActions.requestPostsForBlog(mCurrentBlogId,updateAction,new ReaderActions.ActionListener(){
    @Override public void onActionResult(    boolean succeeded){
      if (!hasActivity()) {
        return;
      }
      setIsUpdating(false,updateAction);
      if (succeeded) {
        refreshPosts();
      }
    }
  }
);
}
Program: 14729
Project: 14729
Buggy source:
@Override public void onImageLoaded(boolean succeeded){
  if (hasActivity() && succeeded) {
    scaleHeaderImage();
    mHasLoadedHeaderImage=true;
  }
}

Fixed version (ground truth):
@Override public void onImageLoaded(boolean succeeded){
  if (succeeded && hasActivity()) {
    scaleHeaderImage();
    mHasLoadedHeaderImage=true;
  }
}
Program: 14730
Project: 14730
Buggy source:
private void scaleHeaderImage(){
  if (!hasActivity()) {
    return;
  }
  final View firstChild=mListView.getChildAt(0);
  int top=(firstChild != null ? firstChild.getTop() : 0);
  float scale=0.9f + (top * 0.0005f);
  if (scale <= 0 || scale == mPreviousHeaderImageScale) {
    return;
  }
  float centerX=mHeaderImageWidth * 0.5f;
  Matrix matrix=new Matrix();
  matrix.setScale(scale,scale,centerX,0);
  mHeaderImage.setImageMatrix(matrix);
  mPreviousHeaderImageScale=scale;
}

Fixed version (ground truth):
private void scaleHeaderImage(){
  if (!hasActivity()) {
    return;
  }
  int top=mListView.getFirstChildTop();
  float scale=0.9f + (top * 0.0005f);
  if (scale <= 0 || scale == mPreviousHeaderImageScale) {
    return;
  }
  mPreviousHeaderImageScale=scale;
  float centerX=mHeaderImageWidth * 0.5f;
  Matrix matrix=new Matrix();
  matrix.setScale(scale,scale,centerX,0);
  mHeaderImage.setImageMatrix(matrix);
}
Program: 14731
Project: 14731
Buggy source:
private void checkActionBar(){
  final ActionBar actionBar=getActionBar();
  if (actionBar == null || actionBar.getNavigationMode() == ActionBar.NAVIGATION_MODE_LIST)   return;
switch (getPostListType()) {
case TAG:
    actionBar.setDisplayShowTitleEnabled(false);
  actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
actionBar.setListNavigationCallbacks(getActionBarAdapter(),this);
selectTagInActionBar(getCurrentTag());
break;
default :
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
break;
}
}

Fixed version (ground truth):
private void checkActionBar(){
  final ActionBar actionBar=getActionBar();
  if (actionBar == null)   return;
switch (getPostListType()) {
case TAG:
    if (actionBar.getNavigationMode() != ActionBar.NAVIGATION_MODE_LIST) {
      actionBar.setDisplayShowTitleEnabled(false);
      actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
      actionBar.setListNavigationCallbacks(getActionBarAdapter(),this);
      selectTagInActionBar(getCurrentTag());
    }
  break;
default :
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
break;
}
}
Program: 14732
Project: 14732
Buggy source:
private boolean isCurrentTag(final String tagName){
  if (!hasCurrentTag() || TextUtils.isEmpty(tagName))   return false;
  return (mCurrentTag.equalsIgnoreCase(tagName));
}

Fixed version (ground truth):
private boolean isCurrentTag(final String tagName){
  if (!hasCurrentTag() || TextUtils.isEmpty(tagName)) {
    return false;
  }
  return (mCurrentTag.equalsIgnoreCase(tagName));
}
Program: 14733
Project: 14733
Buggy source:
private ReaderActionBarTagAdapter getActionBarAdapter(){
  if (mActionBarAdapter == null) {
    ReaderActions.DataLoadedListener dataListener=new ReaderActions.DataLoadedListener(){
      @Override public void onDataLoaded(      boolean isEmpty){
        if (!hasActivity())         return;
        AppLog.d(T.READER,"String_Node_Str");
        selectTagInActionBar(getCurrentTag());
      }
    }
;
    boolean isStaticMenuDrawer;
    if (getActivity() instanceof WPActionBarActivity) {
      isStaticMenuDrawer=((WPActionBarActivity)getActivity()).isStaticMenuDrawer();
    }
 else {
      isStaticMenuDrawer=false;
    }
    mActionBarAdapter=new ReaderActionBarTagAdapter(getActivity(),isStaticMenuDrawer,dataListener);
  }
  return mActionBarAdapter;
}

Fixed version (ground truth):
private ReaderActionBarTagAdapter getActionBarAdapter(){
  if (mActionBarAdapter == null) {
    AppLog.d(T.READER,"String_Node_Str");
    ReaderActions.DataLoadedListener dataListener=new ReaderActions.DataLoadedListener(){
      @Override public void onDataLoaded(      boolean isEmpty){
        if (!hasActivity())         return;
        AppLog.d(T.READER,"String_Node_Str");
        selectTagInActionBar(getCurrentTag());
      }
    }
;
    mActionBarAdapter=new ReaderActionBarTagAdapter(getActivity(),hasStaticMenuDrawer(),dataListener);
  }
  return mActionBarAdapter;
}
Program: 14734
Project: 14734
Buggy source:
private void selectTagInActionBar(final String tagName){
  if (TextUtils.isEmpty(tagName))   return;
  ActionBar actionBar=getActionBar();
  if (actionBar == null)   return;
  int position=getActionBarAdapter().getIndexOfTagName(tagName);
  if (position == -1 || position == actionBar.getSelectedNavigationIndex())   return;
  if (actionBar.getNavigationMode() != ActionBar.NAVIGATION_MODE_LIST) {
    AppLog.w(T.READER,"String_Node_Str");
    return;
  }
  actionBar.setSelectedNavigationItem(position);
}

Fixed version (ground truth):
private void selectTagInActionBar(final String tagName){
  if (TextUtils.isEmpty(tagName))   return;
  ActionBar actionBar=getActionBar();
  if (actionBar == null) {
    return;
  }
  int position=getActionBarAdapter().getIndexOfTagName(tagName);
  if (position == -1 || position == actionBar.getSelectedNavigationIndex()) {
    return;
  }
  if (actionBar.getNavigationMode() != ActionBar.NAVIGATION_MODE_LIST) {
    AppLog.w(T.READER,"String_Node_Str");
    return;
  }
  actionBar.setSelectedNavigationItem(position);
}
Program: 14735
Project: 14735
Buggy source:
private void checkCurrentTag(){
  if (hasCurrentTag() && !ReaderTagTable.tagExists(getCurrentTag()))   mCurrentTag=ReaderTag.TAG_NAME_DEFAULT;
}

Fixed version (ground truth):
private void checkCurrentTag(){
  if (hasCurrentTag() && !ReaderTagTable.tagExists(getCurrentTag())) {
    mCurrentTag=ReaderTag.TAG_NAME_DEFAULT;
  }
}
Program: 14736
Project: 14736
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  setHasOptionsMenu(true);
  checkActionBar();
  mListView.setAdapter(getPostAdapter());
switch (getPostListType()) {
case TAG:
    getPostAdapter().setCurrentTag(mCurrentTag);
  if (ReaderTagTable.shouldAutoUpdateTag(mCurrentTag)) {
    updatePostsWithCurrentTag(RequestDataAction.LOAD_NEWER);
  }
break;
case BLOG:
getPostAdapter().setCurrentBlog(mCurrentBlogId);
updatePostsInCurrentBlog(RequestDataAction.LOAD_NEWER);
break;
}
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  setHasOptionsMenu(true);
  checkActionBar();
  boolean adapterAlreadyExists=hasPostAdapter();
  mListView.setAdapter(getPostAdapter());
  if (!adapterAlreadyExists) {
switch (getPostListType()) {
case TAG:
      getPostAdapter().setCurrentTag(mCurrentTag);
    if (ReaderTagTable.shouldAutoUpdateTag(mCurrentTag)) {
      updatePostsWithCurrentTag(RequestDataAction.LOAD_NEWER);
    }
  break;
case BLOG:
getPostAdapter().setCurrentBlog(mCurrentBlogId);
updatePostsInCurrentBlog(RequestDataAction.LOAD_NEWER);
break;
}
}
}
Program: 14737
Project: 14737
Buggy source:
private ReaderPostAdapter getPostAdapter(){
  if (mPostAdapter == null)   mPostAdapter=new ReaderPostAdapter(getActivity(),getPostListType(),mReblogListener,mDataLoadedListener,mDataRequestedListener);
  return mPostAdapter;
}

Fixed version (ground truth):
private ReaderPostAdapter getPostAdapter(){
  if (mPostAdapter == null) {
    AppLog.d(T.READER,"String_Node_Str");
    mPostAdapter=new ReaderPostAdapter(getActivity(),getPostListType(),mReblogListener,mDataLoadedListener,mDataRequestedListener);
  }
  return mPostAdapter;
}
Program: 14738
Project: 14738
Buggy source:
@Override public void onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu,com.actionbarsherlock.view.MenuInflater inflater){
  super.onCreateOptionsMenu(menu,inflater);
  menu.clear();
switch (getPostListType()) {
case TAG:
    inflater.inflate(R.menu.reader_native,menu);
  checkActionBar();
break;
case BLOG:
inflater.inflate(R.menu.basic_menu,menu);
break;
}
}

Fixed version (ground truth):
@Override public void onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu,com.actionbarsherlock.view.MenuInflater inflater){
  super.onCreateOptionsMenu(menu,inflater);
switch (getPostListType()) {
case TAG:
    inflater.inflate(R.menu.reader_native,menu);
  checkActionBar();
break;
case BLOG:
inflater.inflate(R.menu.basic_menu,menu);
break;
}
}
Program: 14739
Project: 14739
Buggy source:
@Override public void onClick(View view){
}

Fixed version (ground truth):
@Override public void onClick(View view){
  reloadPosts(true);
  hideNewPostsBar();
}
Program: 14740
Project: 14740
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  final Context context=container.getContext();
  final View view=inflater.inflate(R.layout.reader_fragment_post_list,container,false);
  boolean hasTransparentActionBar=isFullScreenSupported();
  mListView=(ListView)view.findViewById(android.R.id.list);
  mListView.setOnTouchListener(this);
  mImageMshot=(WPNetworkImageView)view.findViewById(R.id.image_mshot);
  mNewPostsBar=(TextView)view.findViewById(R.id.text_new_posts);
  mNewPostsBar.setVisibility(View.GONE);
  mNewPostsBar.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      reloadPosts(true);
      hideNewPostsBar();
    }
  }
);
  if (hasTransparentActionBar) {
    final int actionbarHeight=DisplayUtils.getActionBarHeight(context);
    RelativeLayout.LayoutParams params=(RelativeLayout.LayoutParams)mNewPostsBar.getLayoutParams();
    params.topMargin=actionbarHeight;
  }
switch (getPostListType()) {
case BLOG:
    if (hasTransparentActionBar) {
    }
  mImageMshot.setVisibility(View.VISIBLE);
mImageMshot.setScaleType(ImageView.ScaleType.MATRIX);
ReaderBlogInfoHeader header=new ReaderBlogInfoHeader(context);
mListView.addHeaderView(header);
ReaderBlogInfoHeader.OnBlogInfoListener infoListener=new ReaderBlogInfoHeader.OnBlogInfoListener(){
@Override public void onBlogInfoShown(ReaderBlogInfo blogInfo){
if (hasActivity() && TextUtils.isEmpty(mImageMshot.getUrl())) {
int width=DisplayUtils.getDisplayPixelWidth(getActivity());
mImageMshot.setImageUrl(blogInfo.getMshotsUrl(width),WPNetworkImageView.ImageType.PHOTO);
}
}
}
;
header.setBlogId(mCurrentBlogId,infoListener);
break;
case TAG:
mImageMshot.setVisibility(View.GONE);
if (hasTransparentActionBar) {
ReaderFullScreenUtils.addListViewHeader(context,mListView);
}
break;
}
mEmptyView=view.findViewById(R.id.empty_view);
mListView.setOnScrollListener(this);
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
@Override public void onItemClick(AdapterView<?> adapterView,View view,int position,long id){
position-=mListView.getHeaderViewsCount();
if (position >= 0 && mPostSelectedListener != null) {
ReaderPost post=(ReaderPost)getPostAdapter().getItem(position);
if (post != null) {
mPostSelectedListener.onPostSelected(post.blogId,post.postId);
}
}
}
}
);
mProgress=(ProgressBar)view.findViewById(R.id.progress_footer);
mProgress.setVisibility(View.GONE);
if (getPostListType() == ReaderPostListType.TAG) {
mPullToRefreshHelper=new PullToRefreshHelper(getActivity(),(PullToRefreshLayout)view.findViewById(R.id.ptr_layout),new RefreshListener(){
@Override public void onRefreshStarted(View view){
if (getActivity() == null || !NetworkUtils.checkConnection(getActivity())) {
mPullToRefreshHelper.setRefreshing(false);
return;
}
updatePostsWithCurrentTag(ReaderActions.RequestDataAction.LOAD_NEWER,RefreshType.MANUAL);
}
}
);
}
return view;
}
Program: 14741
Project: 14741
Buggy source:
private void showDetailFragment(long blogId,long postId){
  AnalyticsTracker.track(AnalyticsTracker.Stat.READER_OPENED_ARTICLE);
  String tagForFragment=getString(R.string.fragment_tag_reader_post_detail);
  Fragment fragment=ReaderPostDetailFragment.newInstance(blogId,postId);
  FragmentTransaction ft=getSupportFragmentManager().beginTransaction();
  ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
  if (hasListFragment()) {
    ft.replace(R.id.fragment_container,fragment,tagForFragment);
    ft.addToBackStack(tagForFragment);
  }
 else {
    ft.add(R.id.fragment_container,fragment,tagForFragment);
  }
  ft.commit();
}

Fixed version (ground truth):
private void showDetailFragment(long blogId,long postId){
  AnalyticsTracker.track(AnalyticsTracker.Stat.READER_OPENED_ARTICLE);
  String tagForFragment=getString(R.string.fragment_tag_reader_post_detail);
  Fragment fragment=ReaderPostDetailFragment.newInstance(blogId,postId);
  FragmentTransaction ft=getSupportFragmentManager().beginTransaction();
  ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
  ft.add(R.id.fragment_container,fragment,tagForFragment);
  if (hasListFragment()) {
    ft.add(R.id.fragment_container,fragment,tagForFragment);
  }
  ft.commit();
}
Program: 14743
Project: 14743
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  if (isFullScreenSupported())   ReaderFullScreenUtils.enableActionBarOverlay(this);
  super.onCreate(savedInstanceState);
  createMenuDrawer(R.layout.reader_activity_main);
  getSupportFragmentManager().addOnBackStackChangedListener(this);
  final ReaderFragmentType fragmentType;
  if (getIntent().hasExtra(ARG_READER_FRAGMENT)) {
    fragmentType=(ReaderFragmentType)getIntent().getSerializableExtra(ARG_READER_FRAGMENT);
  }
 else {
    fragmentType=ReaderFragmentType.POST_LIST;
  }
switch (fragmentType) {
case POST_LIST:
    String tagName=getIntent().getStringExtra(ReaderActivity.ARG_TAG_NAME);
  if (TextUtils.isEmpty(tagName))   tagName=UserPrefs.getReaderTag();
if (TextUtils.isEmpty(tagName) || !ReaderTagTable.tagExists(tagName)) tagName=ReaderTag.TAG_NAME_DEFAULT;
showListFragment(tagName);
break;
case POST_DETAIL:
long blogId=getIntent().getLongExtra(ReaderActivity.ARG_BLOG_ID,0);
long postId=getIntent().getLongExtra(ReaderActivity.ARG_POST_ID,0);
showDetailFragment(blogId,postId);
break;
}
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  if (isFullScreenSupported())   ReaderFullScreenUtils.enableActionBarOverlay(this);
  super.onCreate(savedInstanceState);
  createMenuDrawer(R.layout.reader_activity_main);
  getSupportFragmentManager().addOnBackStackChangedListener(this);
  if (savedInstanceState == null) {
    final ReaderFragmentType fragmentType;
    if (getIntent().hasExtra(ARG_READER_FRAGMENT)) {
      fragmentType=(ReaderFragmentType)getIntent().getSerializableExtra(ARG_READER_FRAGMENT);
    }
 else {
      fragmentType=ReaderFragmentType.POST_LIST;
    }
switch (fragmentType) {
case POST_LIST:
      String tagName=getIntent().getStringExtra(ReaderActivity.ARG_TAG_NAME);
    if (TextUtils.isEmpty(tagName))     tagName=UserPrefs.getReaderTag();
  if (TextUtils.isEmpty(tagName) || !ReaderTagTable.tagExists(tagName))   tagName=ReaderTag.TAG_NAME_DEFAULT;
showListFragment(tagName);
break;
case POST_DETAIL:
long blogId=getIntent().getLongExtra(ReaderActivity.ARG_BLOG_ID,0);
long postId=getIntent().getLongExtra(ReaderActivity.ARG_POST_ID,0);
showDetailFragment(blogId,postId);
break;
}
}
}
Program: 14744
Project: 14744
Buggy source:
@Override public void onAttach(Activity activity){
  super.onAttach(activity);
  if (activity instanceof ReaderFullScreenUtils.FullScreenListener)   mFullScreenListener=(ReaderFullScreenUtils.FullScreenListener)activity;
  if (activity instanceof OnPostSelectedListener)   mPostSelectedListener=(OnPostSelectedListener)activity;
}

Fixed version (ground truth):
@Override public void onAttach(Activity activity){
  super.onAttach(activity);
  if (activity instanceof ReaderFullScreenUtils.FullScreenListener) {
    mFullScreenListener=(ReaderFullScreenUtils.FullScreenListener)activity;
  }
  if (activity instanceof OnPostSelectedListener) {
    mPostSelectedListener=(OnPostSelectedListener)activity;
  }
}
Program: 14745
Project: 14745
Buggy source:
private void updatePostsWithCurrentTag(ReaderActions.RequestDataAction updateAction,RefreshType refreshType){
  if (hasCurrentTag())   updatePostsWithTag(mCurrentTag,updateAction,refreshType);
}

Fixed version (ground truth):
private void updatePostsWithCurrentTag(ReaderActions.RequestDataAction updateAction,RefreshType refreshType){
  if (hasCurrentTag()) {
    updatePostsWithTag(mCurrentTag,updateAction,refreshType);
  }
}
Program: 14747
Project: 14747
Buggy source:
@Override public boolean onNavigationItemSelected(int itemPosition,long itemId){
  final ReaderTag tag=(ReaderTag)getActionBarAdapter().getItem(itemPosition);
  if (tag == null)   return false;
  setCurrentTag(tag.getTagName());
  AppLog.d(T.READER,"String_Node_Str" + tag.getTagName());
  return true;
}

Fixed version (ground truth):
@Override public boolean onNavigationItemSelected(int itemPosition,long itemId){
  final ReaderTag tag=(ReaderTag)getActionBarAdapter().getItem(itemPosition);
  if (tag == null) {
    return false;
  }
  setCurrentTag(tag.getTagName());
  AppLog.d(T.READER,"String_Node_Str" + tag.getTagName());
  return true;
}
Program: 14748
Project: 14748
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  setHasOptionsMenu(true);
  checkActionBar();
  if (getPostListType() == ReaderPostListType.BLOG) {
    getPostAdapter().setCurrentBlog(mCurrentBlogId);
    updatePostsInCurrentBlog();
  }
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  setHasOptionsMenu(true);
  checkActionBar();
  mListView.setAdapter(getPostAdapter());
switch (getPostListType()) {
case TAG:
    getPostAdapter().setCurrentTag(mCurrentTag);
  break;
case BLOG:
getPostAdapter().setCurrentBlog(mCurrentBlogId);
updatePostsInCurrentBlog();
break;
}
}
Program: 14749
Project: 14749
Buggy source:
@Override public void onSaveInstanceState(Bundle outState){
  super.onSaveInstanceState(outState);
  AppLog.d(T.READER,"String_Node_Str");
  if (hasCurrentTag()) {
    outState.putString(ReaderActivity.ARG_TAG_NAME,mCurrentTag);
  }
  if (mCurrentBlogId != 0) {
    outState.putLong(ReaderActivity.ARG_BLOG_ID,mCurrentBlogId);
  }
  if (mListView != null && mListView.getFirstVisiblePosition() > 0)   outState.putParcelable(ReaderActivity.KEY_LIST_STATE,mListView.onSaveInstanceState());
}

Fixed version (ground truth):
@Override public void onSaveInstanceState(Bundle outState){
  super.onSaveInstanceState(outState);
  AppLog.d(T.READER,"String_Node_Str");
switch (getPostListType()) {
case TAG:
    outState.putString(ReaderActivity.ARG_TAG_NAME,mCurrentTag);
  break;
case BLOG:
outState.putLong(ReaderActivity.ARG_BLOG_ID,mCurrentBlogId);
break;
}
if (mListView != null && mListView.getFirstVisiblePosition() > 0) {
outState.putParcelable(ReaderActivity.KEY_LIST_STATE,mListView.onSaveInstanceState());
}
}
Program: 14750
Project: 14750
Buggy source:
@Override protected Boolean doInBackground(Void... params){
  final int numExisting;
switch (getPostListType()) {
case TAG:
    tmpPosts=ReaderPostTable.getPostsWithTag(mCurrentTag,Constants.READER_MAX_POSTS_TO_DISPLAY);
  numExisting=ReaderPostTable.getNumPostsWithTag(mCurrentTag);
break;
case BLOG:
tmpPosts=ReaderPostTable.getPostsInBlog(mCurrentBlogId,Constants.READER_MAX_POSTS_TO_DISPLAY);
numExisting=ReaderPostTable.getNumPostsInBlog(mCurrentBlogId);
break;
default :
return false;
}
if (mPosts.isSameList(tmpPosts)) return false;
mCanRequestMorePosts=(numExisting < Constants.READER_MAX_POSTS_TO_DISPLAY);
for (ReaderPost post : tmpPosts) {
post.getPostAvatarForDisplay(mAvatarSz);
post.getFeaturedImageForDisplay(mPhotonWidth,mPhotonHeight);
post.getDatePublished();
}
return true;
}

Fixed version (ground truth):
@Override protected Boolean doInBackground(Void... params){
  final int numExisting;
switch (getPostListType()) {
case TAG:
    tmpPosts=ReaderPostTable.getPostsWithTag(mCurrentTag,Constants.READER_MAX_POSTS_TO_DISPLAY);
  numExisting=ReaderPostTable.getNumPostsWithTag(mCurrentTag);
break;
case BLOG:
tmpPosts=ReaderPostTable.getPostsInBlog(mCurrentBlogId,Constants.READER_MAX_POSTS_TO_DISPLAY);
numExisting=ReaderPostTable.getNumPostsInBlog(mCurrentBlogId);
break;
default :
return false;
}
if (mPosts.isSameList(tmpPosts)) {
return false;
}
mCanRequestMorePosts=(numExisting < Constants.READER_MAX_POSTS_TO_DISPLAY);
for (ReaderPost post : tmpPosts) {
post.getPostAvatarForDisplay(mAvatarSz);
post.getFeaturedImageForDisplay(mPhotonWidth,mPhotonHeight);
post.getDatePublished();
}
return true;
}
Program: 14751
Project: 14751
Buggy source:
/** 
 * preload images for the post at the passed position
 */
private void preloadPostImages(final int position){
  if (position >= mPosts.size() || position < 0) {
    AppLog.w(T.READER,"String_Node_Str" + Integer.toString(position));
    return;
  }
  mLastPreloadPos=position;
  if (mIsFlinging)   return;
  ReaderPost post=mPosts.get(position);
  if (post.hasFeaturedImage())   preloadImage(post.getFeaturedImageForDisplay(mPhotonWidth,mPhotonHeight));
  if (post.hasPostAvatar())   preloadImage(post.getPostAvatarForDisplay(mAvatarSz));
}

Fixed version (ground truth):
/** 
 * preload images for the post at the passed position
 */
private void preloadPostImages(final int position){
  if (position >= mPosts.size() || position < 0) {
    AppLog.w(T.READER,"String_Node_Str" + Integer.toString(position));
    return;
  }
  mLastPreloadPos=position;
  if (mIsFlinging) {
    return;
  }
  ReaderPost post=mPosts.get(position);
  if (post.hasFeaturedImage())   preloadImage(post.getFeaturedImageForDisplay(mPhotonWidth,mPhotonHeight));
  if (post.hasPostAvatar())   preloadImage(post.getPostAvatarForDisplay(mAvatarSz));
}
Program: 14752
Project: 14752
Buggy source:
@Override protected void onPostExecute(Boolean result){
  if (result) {
    mPosts=(ReaderPostList)(tmpPosts.clone());
    if (mEnableImagePreload && mPosts.size() >= PRELOAD_OFFSET) {
      for (int i=0; i <= PRELOAD_OFFSET; i++)       preloadPostImages(i);
    }
    notifyDataSetChanged();
  }
  if (mDataLoadedListener != null)   mDataLoadedListener.onDataLoaded(isEmpty());
  mIsTaskRunning=false;
}

Fixed version (ground truth):
@Override protected void onPostExecute(Boolean result){
  if (result) {
    mPosts=(ReaderPostList)(tmpPosts.clone());
    if (mEnableImagePreload && mPosts.size() >= PRELOAD_OFFSET) {
      for (int i=0; i <= PRELOAD_OFFSET; i++)       preloadPostImages(i);
    }
    notifyDataSetChanged();
  }
  if (mDataLoadedListener != null) {
    mDataLoadedListener.onDataLoaded(isEmpty());
  }
  mIsTaskRunning=false;
}
Program: 14753
Project: 14753
Buggy source:
private void preloadImage(final String imageUrl){
  if (WordPress.imageLoader.isCached(imageUrl,0,0))   return;
  if (WordPress.requestQueue.getCache().get(imageUrl) != null)   return;
  WordPress.imageLoader.get(imageUrl,mImagePreloadListener);
}

Fixed version (ground truth):
private void preloadImage(final String imageUrl){
  if (WordPress.imageLoader.isCached(imageUrl,0,0)) {
    return;
  }
  if (WordPress.requestQueue.getCache().get(imageUrl) != null) {
    return;
  }
  WordPress.imageLoader.get(imageUrl,mImagePreloadListener);
}
Program: 14754
Project: 14754
Buggy source:
private void trackMixpanelDataForInstructions(WPStatsTrackerMixpanelInstructionsForStat instructions,JSONObject properties){
  if (instructions.getDisableForSelfHosted()) {
    return;
  }
  String eventName=instructions.getMixpanelEventName();
  if (eventName != null && !eventName.isEmpty()) {
    JSONObject savedPropertiesForStat=propertiesForStat(instructions.getStat());
    mMixpanel.track(eventName,savedPropertiesForStat);
  }
  if (instructions.getPeoplePropertyToIncrement() != null && !instructions.getPeoplePropertyToIncrement().isEmpty())   incrementPeopleProperty(instructions.getPeoplePropertyToIncrement());
  if (instructions.getSuperPropertyToIncrement() != null && !instructions.getSuperPropertyToIncrement().isEmpty())   incrementSuperProperty(instructions.getSuperPropertyToIncrement());
  if (instructions.getPropertyToIncrement() != null && !instructions.getPropertyToIncrement().isEmpty())   incrementProperty(instructions.getPropertyToIncrement(),instructions.getStatToAttachProperty());
  if (instructions.getSuperPropertyToFlag() != null && !instructions.getSuperPropertyToFlag().isEmpty())   flagSuperProperty(instructions.getSuperPropertyToFlag());
}

Fixed version (ground truth):
private void trackMixpanelDataForInstructions(WPStatsTrackerMixpanelInstructionsForStat instructions,JSONObject properties){
  if (instructions.getDisableForSelfHosted()) {
    return;
  }
  String eventName=instructions.getMixpanelEventName();
  if (eventName != null && !eventName.isEmpty()) {
    JSONObject savedPropertiesForStat=propertiesForStat(instructions.getStat());
    if (savedPropertiesForStat == null) {
      savedPropertiesForStat=new JSONObject();
    }
    if (properties != null) {
      Iterator<String> iter=properties.keys();
      while (iter.hasNext()) {
        String key=iter.next();
        try {
          Object value=properties.get(key);
          savedPropertiesForStat.put(key,value);
        }
 catch (        JSONException e) {
          AppLog.e(AppLog.T.UTILS,e);
        }
      }
    }
    mMixpanel.track(eventName,savedPropertiesForStat);
    removePropertiesForStat(instructions.getStat());
  }
  if (instructions.getPeoplePropertyToIncrement() != null && !instructions.getPeoplePropertyToIncrement().isEmpty())   incrementPeopleProperty(instructions.getPeoplePropertyToIncrement());
  if (instructions.getSuperPropertyToIncrement() != null && !instructions.getSuperPropertyToIncrement().isEmpty())   incrementSuperProperty(instructions.getSuperPropertyToIncrement());
  if (instructions.getPropertyToIncrement() != null && !instructions.getPropertyToIncrement().isEmpty())   incrementProperty(instructions.getPropertyToIncrement(),instructions.getStatToAttachProperty());
  if (instructions.getSuperPropertyToFlag() != null && !instructions.getSuperPropertyToFlag().isEmpty())   flagSuperProperty(instructions.getSuperPropertyToFlag());
}
Program: 14755
Project: 14755
Buggy source:
/** 
 * This method is called when the user changes the active blog or hides all blogs
 */
public void onBlogChanged(){
  WordPress.wpDB.updateLastBlogId(WordPress.getCurrentLocalTableBlogId());
  Iterator<MenuDrawerItem> itemIterator=mMenuItems.iterator();
  while (itemIterator.hasNext()) {
    MenuDrawerItem item=itemIterator.next();
    if (item.isSelected() && !item.isVisible()) {
      if (mAdapter.getCount() > 0) {
        mAdapter.getItem(0).selectItem();
      }
      if (item.hasItemId()) {
        SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(WPActionBarActivity.this);
        SharedPreferences.Editor editor=settings.edit();
        editor.putInt(LAST_ACTIVITY_PREFERENCE,item.getItemId());
        editor.commit();
      }
      break;
    }
  }
}

Fixed version (ground truth):
/** 
 * This method is called when the user changes the active blog or hides all blogs
 */
public void onBlogChanged(){
  WordPress.wpDB.updateLastBlogId(WordPress.getCurrentLocalTableBlogId());
  Iterator<MenuDrawerItem> itemIterator=mMenuItems.iterator();
  while (itemIterator.hasNext()) {
    MenuDrawerItem item=itemIterator.next();
    if (item.isSelected() && !item.isVisible()) {
      if (mAdapter.getCount() > 0) {
        mAdapter.getItem(0).selectItem();
      }
      if (item.hasItemId()) {
        SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(WPActionBarActivity.this);
        SharedPreferences.Editor editor=settings.edit();
        editor.putInt(LAST_ACTIVITY_PREFERENCE,item.getItemId());
        editor.commit();
      }
      break;
    }
  }
  if (shouldUpdateCurrentBlogStats()) {
    WordPress.updateCurrentBlogStats();
  }
}
Program: 14756
Project: 14756
Buggy source:
@Override public void onFailure(ApiHelper.ErrorType errorType,String errorMessage,Throwable throwable){
}

Fixed version (ground truth):
@Override public void onFailure(ApiHelper.ErrorType errorType,String errorMessage,Throwable throwable){
  mPullToRefreshHelper.setRefreshing(false);
  if (statsActivityWeakRef.get() == null || statsActivityWeakRef.get().isFinishing() || !statsActivityWeakRef.get().mIsInFront) {
    return;
  }
  if (mSignInDialog != null && mSignInDialog.isShowing()) {
    return;
  }
  stopStatsService();
  Toast.makeText(statsActivityWeakRef.get(),R.string.error_refresh_stats,Toast.LENGTH_LONG).show();
}