nus-yam/ex-repair huggingface dataset:
Program: 14661
Project: 14661
Buggy source:
private void repositionBlogInfoView(){
  int scrollPos=mListView.getVerticalScrollOffset();
  if (mBlogInfoView == null || scrollPos == mLastPostListScrollPos) {
    return;
  }
  mBlogInfoView.scaleMshotImageBasedOnScrollPos(scrollPos);
  final int mshotBottom;
  if (mMshotSpacerView.getHeight() > 0) {
    mshotBottom=Math.max(0,mMshotSpacerView.getTop() + mBlogInfoView.getMshotHeight());
  }
 else {
    mshotBottom=0;
  }
  mBlogInfoView.moveInfoContainer(mshotBottom);
  mLastPostListScrollPos=scrollPos;
}

Fixed version (ground truth):
private void repositionBlogInfoView(){
  int scrollPos=mListView.getVerticalScrollOffset();
  if (mBlogInfoView == null || scrollPos == mLastPostListScrollPos) {
    return;
  }
  mBlogInfoView.scaleMshotImageBasedOnScrollPos(scrollPos);
  View firstChild=mListView.getChildAt(0);
  boolean isSpacer=(firstChild != null && MSHOT_SPACER_TAG.equals(firstChild.getTag()));
  final int infoTop;
  if (isSpacer) {
    infoTop=Math.max(0,firstChild.getTop() + mBlogInfoView.getMshotHeight());
  }
 else {
    infoTop=0;
  }
  mBlogInfoView.moveInfoContainer(infoTop);
  mLastPostListScrollPos=scrollPos;
}
Program: 14662
Project: 14662
Buggy source:
public void showErrorImage(){
switch (mImageType) {
case NONE:
    break;
case PHOTO_FULL:
  setImageDrawable(null);
break;
case AVATAR:
setImageResource(R.drawable.placeholder);
break;
case MSHOT:
setScaleType(ImageView.ScaleType.CENTER);
setImageResource(R.drawable.ic_error);
break;
default :
setImageDrawable(new ColorDrawable(getColorRes(R.color.grey_medium)));
break;
}
}

Fixed version (ground truth):
public void showErrorImage(){
switch (mImageType) {
case NONE:
    break;
case PHOTO_FULL:
  setImageDrawable(null);
break;
case AVATAR:
setImageResource(R.drawable.placeholder);
break;
default :
setImageDrawable(new ColorDrawable(getColorRes(R.color.grey_medium)));
break;
}
}
Program: 14665
Project: 14665
Buggy source:
private void repositionBlogInfoView(){
  if (mBlogInfoView == null) {
    return;
  }
  int scrollPos=mListView.getVerticalScrollOffset();
  mBlogInfoView.scaleMshotImageBasedOnScrollPos(scrollPos);
  int mshotBottom=mMshotSpacerView.getTop() + mBlogInfoView.getMshotDefaultHeight();
  int infoTop=(mshotBottom < mActionBarHeight ? mActionBarHeight : mshotBottom);
  mBlogInfoView.setInfoContainerTop(infoTop);
}

Fixed version (ground truth):
private void repositionBlogInfoView(int scrollPos){
  if (mBlogInfoView == null) {
    return;
  }
  mBlogInfoView.scaleMshotImageBasedOnScrollPos(scrollPos);
  int mshotBottom;
  if (mMshotSpacerView.getHeight() > 0) {
    mshotBottom=mMshotSpacerView.getTop() + mBlogInfoView.getMshotDefaultHeight();
  }
 else {
    mshotBottom=0;
  }
  int infoTop=(mshotBottom < mActionBarHeight ? mActionBarHeight : mshotBottom);
  mBlogInfoView.setInfoContainerTop(infoTop);
}
Program: 14666
Project: 14666
Buggy source:
@Override public void onGlobalLayout(){
  mBlogInfoView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
  mMshotSpacerView.getLayoutParams().height=mBlogInfoView.getMshotDefaultHeight() + mBlogInfoView.getInfoContainerHeight();
  repositionBlogInfoView();
}

Fixed version (ground truth):
@Override public void onGlobalLayout(){
  mBlogInfoView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
  mMshotSpacerView.getLayoutParams().height=mBlogInfoView.getMshotDefaultHeight() + mBlogInfoView.getInfoContainerHeight();
}
Program: 14667
Project: 14667
Buggy source:
@Override public void onScrollChanged(){
  repositionBlogInfoView();
}

Fixed version (ground truth):
@Override public void onScrollChanged(){
  if (isPostAdapterEmpty()) {
    return;
  }
  int scrollPos=mListView.getVerticalScrollOffset();
  if (scrollPos != mLastPostListScrollPos) {
    repositionBlogInfoView(scrollPos);
    mLastPostListScrollPos=scrollPos;
  }
}
Program: 14668
Project: 14668
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  setHasOptionsMenu(true);
  checkActionBar();
  boolean adapterAlreadyExists=hasPostAdapter();
  mListView.setAdapter(getPostAdapter());
  if (!adapterAlreadyExists) {
    boolean isRecreated=(savedInstanceState != null);
switch (getPostListType()) {
case TAG_FOLLOWED:
case TAG_PREVIEW:
      getPostAdapter().setCurrentTag(mCurrentTag);
    if (!isRecreated && ReaderTagTable.shouldAutoUpdateTag(mCurrentTag)) {
      updatePostsWithTag(getCurrentTag(),RequestDataAction.LOAD_NEWER,RefreshType.AUTOMATIC);
    }
  break;
case BLOG_PREVIEW:
getPostAdapter().setCurrentBlog(mCurrentBlogId);
if (!isRecreated) {
updatePostsInCurrentBlog(RequestDataAction.LOAD_NEWER);
}
break;
}
}
switch (getPostListType()) {
case BLOG_PREVIEW:
if (mBlogInfoView != null) {
mBlogInfoView.setBlogIdAndUrl(mCurrentBlogId,mCurrentBlogUrl);
}
break;
case TAG_PREVIEW:
updateTagPreviewHeader();
break;
}
getPostAdapter().setOnTagSelectedListener(mOnTagSelectedListener);
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  setHasOptionsMenu(true);
  checkActionBar();
  boolean adapterAlreadyExists=hasPostAdapter();
  mListView.setAdapter(getPostAdapter());
  if (!adapterAlreadyExists) {
    boolean isRecreated=(savedInstanceState != null);
switch (getPostListType()) {
case TAG_FOLLOWED:
case TAG_PREVIEW:
      getPostAdapter().setCurrentTag(mCurrentTag);
    if (!isRecreated && ReaderTagTable.shouldAutoUpdateTag(mCurrentTag)) {
      updatePostsWithTag(getCurrentTag(),RequestDataAction.LOAD_NEWER,RefreshType.AUTOMATIC);
    }
  break;
case BLOG_PREVIEW:
getPostAdapter().setCurrentBlog(mCurrentBlogId);
if (!isRecreated) {
updatePostsInCurrentBlog(RequestDataAction.LOAD_NEWER);
}
break;
}
}
switch (getPostListType()) {
case BLOG_PREVIEW:
loadBlogInfoIfNotLoaded();
break;
case TAG_PREVIEW:
updateTagPreviewHeader();
break;
}
getPostAdapter().setOnTagSelectedListener(mOnTagSelectedListener);
}
Program: 14669
Project: 14669
Buggy source:
public void scaleMshotImageBasedOnScrollPos(int scrollPos){
  if (mImageMshot == null) {
    return;
  }
  float scale=Math.max(0f,0.9f + (-scrollPos * 0.004f));
  if (scale == mPreviousMshotScale) {
    return;
  }
  float centerX=mMshotWidth * 0.5f;
  Matrix matrix=new Matrix();
  matrix.setScale(scale,scale,centerX,0);
  mImageMshot.setImageMatrix(matrix);
  mPreviousMshotScale=scale;
}

Fixed version (ground truth):
public void scaleMshotImageBasedOnScrollPos(int scrollPos){
  if (mImageMshot == null) {
    return;
  }
  float scale=Math.max(0f,0.9f + (-scrollPos * 0.008f));
  if (scale != mCurrentMshotScale) {
    float centerX=mMshotWidth * 0.5f;
    Matrix matrix=new Matrix();
    matrix.setScale(scale,scale,centerX,0);
    mImageMshot.setImageMatrix(matrix);
    mCurrentMshotScale=scale;
  }
}
Program: 14671
Project: 14671
Buggy source:
@Override public void onStart(){
  super.onStart();
  showPost();
}

Fixed version (ground truth):
@Override public void onStart(){
  super.onStart();
  if (!hasPost()) {
    showPost();
  }
}
Program: 14672
Project: 14672
Buggy source:
@Override public void onResume(){
  super.onResume();
  if (hasEmbedsOrIframes())   resumeWebView();
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  if (hasEmbedsOrIframes()) {
    resumeWebView();
  }
}
Program: 14673
Project: 14673
Buggy source:
@Override public void onPause(){
  if (hasEmbedsOrIframes())   pauseWebView();
  super.onPause();
}

Fixed version (ground truth):
@Override public void onPause(){
  if (hasEmbedsOrIframes()) {
    pauseWebView();
  }
  super.onPause();
}
Program: 14674
Project: 14674
Buggy source:
public static void removeWpComUserRelatedData(Context context){
  VolleyUtils.cancelAllRequests(requestQueue);
  NotificationUtils.unregisterDevicePushNotifications(context);
  try {
    GCMRegistrar.checkDevice(context);
    GCMRegistrar.unregister(context);
  }
 catch (  Exception e) {
    AppLog.v(T.NOTIFS,"String_Node_Str" + e.getMessage());
  }
  SharedPreferences.Editor editor=PreferenceManager.getDefaultSharedPreferences(context).edit();
  editor.remove(WordPress.WPCOM_USERNAME_PREFERENCE);
  editor.remove(WordPress.WPCOM_PASSWORD_PREFERENCE);
  editor.remove(WordPress.ACCESS_TOKEN_PREFERENCE);
  editor.commit();
  UserPrefs.reset();
  ReaderDatabase.reset();
  SimperiumUtils.getNotesBucket().reset();
  SimperiumUtils.getMetaBucket().reset();
  Intent broadcastIntent=new Intent();
  broadcastIntent.setAction(BROADCAST_ACTION_SIGNOUT);
  context.sendBroadcast(broadcastIntent);
}

Fixed version (ground truth):
public static void removeWpComUserRelatedData(Context context){
  VolleyUtils.cancelAllRequests(requestQueue);
  NotificationUtils.unregisterDevicePushNotifications(context);
  try {
    GCMRegistrar.checkDevice(context);
    GCMRegistrar.unregister(context);
  }
 catch (  Exception e) {
    AppLog.v(T.NOTIFS,"String_Node_Str" + e.getMessage());
  }
  SharedPreferences.Editor editor=PreferenceManager.getDefaultSharedPreferences(context).edit();
  editor.remove(WordPress.WPCOM_USERNAME_PREFERENCE);
  editor.remove(WordPress.WPCOM_PASSWORD_PREFERENCE);
  editor.remove(WordPress.ACCESS_TOKEN_PREFERENCE);
  editor.commit();
  UserPrefs.reset();
  ReaderDatabase.reset();
  SimperiumUtils.resetBuckets();
  Intent broadcastIntent=new Intent();
  broadcastIntent.setAction(BROADCAST_ACTION_SIGNOUT);
  context.sendBroadcast(broadcastIntent);
}
Program: 14675
Project: 14675
Buggy source:
public String getType(){
  return queryJSON("String_Node_Str",NOTE_UNKNOWN_TYPE);
}

Fixed version (ground truth):
public String getType(){
  String noteType=queryJSON("String_Node_Str",NOTE_UNKNOWN_TYPE);
  if (noteType.contains(NOTE_ACHIEVEMENT_TYPE)) {
    noteType=NOTE_ACHIEVEMENT_TYPE;
  }
  return noteType;
}
Program: 14677
Project: 14677
Buggy source:
private void showLoadingProgress(){
  if (hasActivity() && mProgress != null) {
    mProgress.setVisibility(View.VISIBLE);
  }
}

Fixed version (ground truth):
private void showLoadingProgress(){
  if (hasActivity() && mProgress != null) {
    mProgress.bringToFront();
    mProgress.setVisibility(View.VISIBLE);
  }
}
Program: 14678
Project: 14678
Buggy source:
public static void openUrl(Context context,String url,OpenUrlType openUrlType){
  if (TextUtils.isEmpty(url)) {
    return;
  }
  if (openUrlType == OpenUrlType.INTERNAL) {
    NotificationsWebViewActivity.openUrl(context,url);
  }
 else {
    try {
      Intent intent=new Intent(Intent.ACTION_VIEW,Uri.parse(url));
      context.startActivity(intent);
    }
 catch (    ActivityNotFoundException e) {
      ToastUtils.showToast(context,context.getString(R.string.reader_toast_err_url_intent,url),ToastUtils.Duration.LONG);
    }
  }
}

Fixed version (ground truth):
public static void openUrl(Context context,String url,OpenUrlType openUrlType){
  if (TextUtils.isEmpty(url)) {
    return;
  }
  if (openUrlType == OpenUrlType.INTERNAL && WordPress.getCurrentBlog() != null) {
    NotificationsWebViewActivity.openUrl(context,url);
  }
 else {
    try {
      Intent intent=new Intent(Intent.ACTION_VIEW,Uri.parse(url));
      context.startActivity(intent);
    }
 catch (    ActivityNotFoundException e) {
      ToastUtils.showToast(context,context.getString(R.string.reader_toast_err_url_intent,url),ToastUtils.Duration.LONG);
    }
  }
}
Program: 14679
Project: 14679
Buggy source:
public boolean isScrolledToTop(){
  return (getVerticalScrollOffset() == 0);
}

Fixed version (ground truth):
public boolean isScrolledToTop(){
  return (getChildCount() == 0 || getVerticalScrollOffset() == 0);
}
Program: 14680
Project: 14680
Buggy source:
@Override public void onUpdateResult(UpdateResult result){
  mHasPerformedInitialUpdate=true;
  ReaderPostListFragment listFragment=getListFragment();
  if (listFragment != null) {
    if (result == UpdateResult.CHANGED) {
      listFragment.refreshTags();
      if (isTagTableEmpty && ReaderPostTable.isEmpty()) {
        listFragment.updatePostsWithTag(listFragment.getCurrentTag(),RequestDataAction.LOAD_NEWER,ReaderPostListFragment.RefreshType.AUTOMATIC);
      }
    }
  }
  AppLog.i(T.READER,"String_Node_Str");
  ReaderUserActions.updateCurrentUser(null);
  AppLog.i(T.READER,"String_Node_Str");
  ReaderBlogActions.updateFollowedBlogs(null);
  AppLog.i(T.READER,"String_Node_Str");
  ReaderAuthActions.updateCookies(ReaderActivity.this);
}

Fixed version (ground truth):
@Override public void onUpdateResult(UpdateResult result){
  mHasPerformedInitialUpdate=true;
  if (result == UpdateResult.CHANGED) {
    ReaderPostListFragment listFragment=getListFragment();
    if (listFragment != null && listFragment.getPostListType() == ReaderPostListType.TAG_FOLLOWED) {
      listFragment.refreshTags();
      if (isTagTableEmpty && isPostTableEmpty) {
        listFragment.updatePostsWithTag(listFragment.getCurrentTag(),RequestDataAction.LOAD_NEWER,ReaderPostListFragment.RefreshType.AUTOMATIC);
      }
    }
  }
  AppLog.i(T.READER,"String_Node_Str");
  ReaderUserActions.updateCurrentUser(null);
  AppLog.i(T.READER,"String_Node_Str");
  ReaderBlogActions.updateFollowedBlogs(null);
  AppLog.i(T.READER,"String_Node_Str");
  ReaderAuthActions.updateCookies(ReaderActivity.this);
}
Program: 14681
Project: 14681
Buggy source:
private void performInitialUpdate(){
  if (!NetworkUtils.isNetworkAvailable(this)) {
    return;
  }
  final boolean isTagTableEmpty=ReaderTagTable.isEmpty();
  ReaderActions.UpdateResultListener listener=new ReaderActions.UpdateResultListener(){
    @Override public void onUpdateResult(    UpdateResult result){
      mHasPerformedInitialUpdate=true;
      ReaderPostListFragment listFragment=getListFragment();
      if (listFragment != null) {
        if (result == UpdateResult.CHANGED) {
          listFragment.refreshTags();
          if (isTagTableEmpty && ReaderPostTable.isEmpty()) {
            listFragment.updatePostsWithTag(listFragment.getCurrentTag(),RequestDataAction.LOAD_NEWER,ReaderPostListFragment.RefreshType.AUTOMATIC);
          }
        }
      }
      AppLog.i(T.READER,"String_Node_Str");
      ReaderUserActions.updateCurrentUser(null);
      AppLog.i(T.READER,"String_Node_Str");
      ReaderBlogActions.updateFollowedBlogs(null);
      AppLog.i(T.READER,"String_Node_Str");
      ReaderAuthActions.updateCookies(ReaderActivity.this);
    }
  }
;
  ReaderTagActions.updateTags(listener);
}

Fixed version (ground truth):
private void performInitialUpdate(){
  if (!NetworkUtils.isNetworkAvailable(this)) {
    return;
  }
  final boolean isTagTableEmpty=ReaderTagTable.isEmpty();
  final boolean isPostTableEmpty=ReaderPostTable.isEmpty();
  ReaderActions.UpdateResultListener listener=new ReaderActions.UpdateResultListener(){
    @Override public void onUpdateResult(    UpdateResult result){
      mHasPerformedInitialUpdate=true;
      if (result == UpdateResult.CHANGED) {
        ReaderPostListFragment listFragment=getListFragment();
        if (listFragment != null && listFragment.getPostListType() == ReaderPostListType.TAG_FOLLOWED) {
          listFragment.refreshTags();
          if (isTagTableEmpty && isPostTableEmpty) {
            listFragment.updatePostsWithTag(listFragment.getCurrentTag(),RequestDataAction.LOAD_NEWER,ReaderPostListFragment.RefreshType.AUTOMATIC);
          }
        }
      }
      AppLog.i(T.READER,"String_Node_Str");
      ReaderUserActions.updateCurrentUser(null);
      AppLog.i(T.READER,"String_Node_Str");
      ReaderBlogActions.updateFollowedBlogs(null);
      AppLog.i(T.READER,"String_Node_Str");
      ReaderAuthActions.updateCookies(ReaderActivity.this);
    }
  }
;
  ReaderTagActions.updateTags(listener);
}
Program: 14683
Project: 14683
Buggy source:
private static String getEndpointForTag(String tagName){
  String endpoint=ReaderTagTable.getEndpointForTag(tagName);
  if (TextUtils.isEmpty(endpoint)) {
    return String.format("String_Node_Str",ReaderTagActions.sanitizeTitle(tagName));
  }
 else {
    return endpoint;
  }
}

Fixed version (ground truth):
private static String getEndpointForTag(String tagName){
  String endpoint=ReaderTagTable.getEndpointForTag(tagName);
  if (TextUtils.isEmpty(endpoint)) {
    if (ReaderTag.isDefaultTagName(tagName)) {
      return null;
    }
 else {
      return String.format("String_Node_Str",ReaderTagActions.sanitizeTitle(tagName));
    }
  }
 else {
    return endpoint;
  }
}
Program: 14685
Project: 14685
Buggy source:
private static void backfillPostsWithTag(final String tagName,final Date dateBefore,final int recursionCounter,final ReaderActions.PostBackfillListener backfillListener){
  com.wordpress.rest.RestRequest.Listener listener=new RestRequest.Listener(){
    @Override public void onResponse(    JSONObject jsonObject){
      handleBackfillResponse(jsonObject,tagName,recursionCounter,backfillListener);
    }
  }
;
  RestRequest.ErrorListener errorListener=new RestRequest.ErrorListener(){
    @Override public void onErrorResponse(    VolleyError volleyError){
      AppLog.e(T.READER,volleyError);
    }
  }
;
  String strDateBefore=DateTimeUtils.javaDateToIso8601(dateBefore);
  String path=getEndpointForTag(tagName) + "String_Node_Str" + ReaderConstants.READER_MAX_POSTS_TO_REQUEST+ "String_Node_Str"+ "String_Node_Str"+ UrlUtils.urlEncode(strDateBefore);
  AppLog.i(T.READER,String.format("String_Node_Str",tagName,recursionCounter));
  WordPress.getRestClientUtils().get(path,null,null,listener,errorListener);
}

Fixed version (ground truth):
private static void backfillPostsWithTag(final String tagName,final Date dateBefore,final int recursionCounter,final ReaderActions.PostBackfillListener backfillListener){
  String endpoint=getEndpointForTag(tagName);
  if (TextUtils.isEmpty(endpoint)) {
    return;
  }
  com.wordpress.rest.RestRequest.Listener listener=new RestRequest.Listener(){
    @Override public void onResponse(    JSONObject jsonObject){
      handleBackfillResponse(jsonObject,tagName,recursionCounter,backfillListener);
    }
  }
;
  RestRequest.ErrorListener errorListener=new RestRequest.ErrorListener(){
    @Override public void onErrorResponse(    VolleyError volleyError){
      AppLog.e(T.READER,volleyError);
    }
  }
;
  String strDateBefore=DateTimeUtils.javaDateToIso8601(dateBefore);
  String path=endpoint + "String_Node_Str" + ReaderConstants.READER_MAX_POSTS_TO_REQUEST+ "String_Node_Str"+ "String_Node_Str"+ UrlUtils.urlEncode(strDateBefore);
  AppLog.i(T.READER,String.format("String_Node_Str",tagName,recursionCounter));
  WordPress.getRestClientUtils().get(path,null,null,listener,errorListener);
}
Program: 14686
Project: 14686
Buggy source:
private static ReaderTag getTagFromCursor(Cursor c){
  if (c == null)   throw new IllegalArgumentException("String_Node_Str");
  String tagName=c.getString(c.getColumnIndex("String_Node_Str"));
  String endpoint=c.getString(c.getColumnIndex("String_Node_Str"));
  ReaderTagType tagType=ReaderTag.ReaderTagType.fromInt(c.getInt(c.getColumnIndex("String_Node_Str")));
  return new ReaderTag(tagName,endpoint,tagType);
}

Fixed version (ground truth):
private static ReaderTag getTagFromCursor(Cursor c){
  if (c == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  String tagName=c.getString(c.getColumnIndex("String_Node_Str"));
  String endpoint=c.getString(c.getColumnIndex("String_Node_Str"));
  ReaderTagType tagType=ReaderTag.ReaderTagType.fromInt(c.getInt(c.getColumnIndex("String_Node_Str")));
  return new ReaderTag(tagName,endpoint,tagType);
}
Program: 14687
Project: 14687
Buggy source:
public static void setTagNewestDate(String tagName,String date){
  if (TextUtils.isEmpty(tagName))   return;
  ContentValues values=new ContentValues();
  values.put("String_Node_Str",tagName);
  values.put("String_Node_Str",date);
  try {
    ReaderDatabase.getWritableDb().insertWithOnConflict("String_Node_Str",null,values,SQLiteDatabase.CONFLICT_REPLACE);
  }
 catch (  SQLException e) {
    AppLog.e(T.READER,e);
  }
}

Fixed version (ground truth):
public static void setTagNewestDate(String tagName,String date){
  if (TextUtils.isEmpty(tagName)) {
    return;
  }
  ContentValues values=new ContentValues();
  values.put("String_Node_Str",tagName);
  values.put("String_Node_Str",date);
  try {
    ReaderDatabase.getWritableDb().insertWithOnConflict("String_Node_Str",null,values,SQLiteDatabase.CONFLICT_REPLACE);
  }
 catch (  SQLException e) {
    AppLog.e(T.READER,e);
  }
}
Program: 14688
Project: 14688
Buggy source:
public static void setTagLastUpdated(String tagName,String date){
  if (TextUtils.isEmpty(tagName))   return;
  ContentValues values=new ContentValues();
  values.put("String_Node_Str",tagName);
  values.put("String_Node_Str",date);
  try {
    ReaderDatabase.getWritableDb().insertWithOnConflict("String_Node_Str",null,values,SQLiteDatabase.CONFLICT_REPLACE);
  }
 catch (  SQLException e) {
    AppLog.e(T.READER,e);
  }
}

Fixed version (ground truth):
public static void setTagLastUpdated(String tagName,String date){
  if (TextUtils.isEmpty(tagName)) {
    return;
  }
  ContentValues values=new ContentValues();
  values.put("String_Node_Str",tagName);
  values.put("String_Node_Str",date);
  try {
    ReaderDatabase.getWritableDb().insertWithOnConflict("String_Node_Str",null,values,SQLiteDatabase.CONFLICT_REPLACE);
  }
 catch (  SQLException e) {
    AppLog.e(T.READER,e);
  }
}
Program: 14689
Project: 14689
Buggy source:
public static void addOrUpdateTag(ReaderTag tag){
  if (tag == null)   return;
  ReaderTagList tags=new ReaderTagList();
  tags.add(tag);
  addOrUpdateTags(tags);
}

Fixed version (ground truth):
public static void addOrUpdateTag(ReaderTag tag){
  if (tag == null) {
    return;
  }
  ReaderTagList tags=new ReaderTagList();
  tags.add(tag);
  addOrUpdateTags(tags);
}
Program: 14690
Project: 14690
Buggy source:
public static void addOrUpdateTags(ReaderTagList tags){
  if (tags == null || tags.size() == 0)   return;
  SQLiteStatement stmt=null;
  try {
    stmt=ReaderDatabase.getWritableDb().compileStatement("String_Node_Str" + COLUMN_NAMES + "String_Node_Str");
    for (    ReaderTag topic : tags) {
      stmt.bindString(1,topic.getTagName());
      stmt.bindString(2,topic.getEndpoint());
      stmt.bindLong(3,topic.tagType.toInt());
      stmt.execute();
      stmt.clearBindings();
    }
  }
  finally {
    SqlUtils.closeStatement(stmt);
  }
}

Fixed version (ground truth):
public static void addOrUpdateTags(ReaderTagList tags){
  if (tags == null || tags.size() == 0) {
    return;
  }
  SQLiteStatement stmt=null;
  try {
    stmt=ReaderDatabase.getWritableDb().compileStatement("String_Node_Str" + COLUMN_NAMES + "String_Node_Str");
    for (    ReaderTag topic : tags) {
      stmt.bindString(1,topic.getTagName());
      stmt.bindString(2,topic.getEndpoint());
      stmt.bindLong(3,topic.tagType.toInt());
      stmt.execute();
      stmt.clearBindings();
    }
  }
  finally {
    SqlUtils.closeStatement(stmt);
  }
}
Program: 14691
Project: 14691
Buggy source:
public static void setRecommendedTags(ReaderTagList topics){
  if (topics == null)   return;
  SQLiteDatabase db=ReaderDatabase.getWritableDb();
  SQLiteStatement stmt=db.compileStatement("String_Node_Str" + COLUMN_NAMES + "String_Node_Str");
  db.beginTransaction();
  try {
    try {
      db.execSQL("String_Node_Str");
      for (      ReaderTag topic : topics) {
        stmt.bindString(1,topic.getTagName());
        stmt.bindString(2,topic.getEndpoint());
        stmt.bindLong(3,topic.tagType.toInt());
        stmt.execute();
        stmt.clearBindings();
      }
      db.setTransactionSuccessful();
    }
 catch (    SQLException e) {
      AppLog.e(T.READER,e);
    }
  }
  finally {
    SqlUtils.closeStatement(stmt);
    db.endTransaction();
  }
}

Fixed version (ground truth):
public static void setRecommendedTags(ReaderTagList topics){
  if (topics == null) {
    return;
  }
  SQLiteDatabase db=ReaderDatabase.getWritableDb();
  SQLiteStatement stmt=db.compileStatement("String_Node_Str" + COLUMN_NAMES + "String_Node_Str");
  db.beginTransaction();
  try {
    try {
      db.execSQL("String_Node_Str");
      for (      ReaderTag topic : topics) {
        stmt.bindString(1,topic.getTagName());
        stmt.bindString(2,topic.getEndpoint());
        stmt.bindLong(3,topic.tagType.toInt());
        stmt.execute();
        stmt.clearBindings();
      }
      db.setTransactionSuccessful();
    }
 catch (    SQLException e) {
      AppLog.e(T.READER,e);
    }
  }
  finally {
    SqlUtils.closeStatement(stmt);
    db.endTransaction();
  }
}
Program: 14692
Project: 14692
Buggy source:
public static boolean shouldAutoUpdateTag(String tagName){
  int minutes=minutesSinceLastUpdate(tagName);
  if (minutes == NEVER_UPDATED)   return true;
  return (minutes >= Constants.READER_AUTO_UPDATE_DELAY_MINUTES);
}

Fixed version (ground truth):
public static boolean shouldAutoUpdateTag(String tagName){
  int minutes=minutesSinceLastUpdate(tagName);
  if (minutes == NEVER_UPDATED) {
    return true;
  }
  return (minutes >= Constants.READER_AUTO_UPDATE_DELAY_MINUTES);
}
Program: 14693
Project: 14693
Buggy source:
public static ReaderTag getTag(String tagName){
  if (TextUtils.isEmpty(tagName))   return null;
  Cursor c=ReaderDatabase.getReadableDb().rawQuery("String_Node_Str",new String[]{tagName});
  try {
    if (!c.moveToFirst())     return null;
    return getTagFromCursor(c);
  }
  finally {
    SqlUtils.closeCursor(c);
  }
}

Fixed version (ground truth):
public static ReaderTag getTag(String tagName){
  if (TextUtils.isEmpty(tagName)) {
    return null;
  }
  Cursor c=ReaderDatabase.getReadableDb().rawQuery("String_Node_Str",new String[]{tagName});
  try {
    if (!c.moveToFirst()) {
      return null;
    }
    return getTagFromCursor(c);
  }
  finally {
    SqlUtils.closeCursor(c);
  }
}
Program: 14694
Project: 14694
Buggy source:
/** 
 * tbl_tag_updates routines
 */
public static String getTagNewestDate(String tagName){
  if (TextUtils.isEmpty(tagName))   return "String_Node_Str";
  return SqlUtils.stringForQuery(ReaderDatabase.getReadableDb(),"String_Node_Str",new String[]{tagName});
}

Fixed version (ground truth):
/** 
 * tbl_tag_updates routines
 */
public static String getTagNewestDate(String tagName){
  if (TextUtils.isEmpty(tagName)) {
    return "String_Node_Str";
  }
  return SqlUtils.stringForQuery(ReaderDatabase.getReadableDb(),"String_Node_Str",new String[]{tagName});
}
Program: 14695
Project: 14695
Buggy source:
public static void replaceTags(ReaderTagList tags){
  if (tags == null || tags.size() == 0)   return;
  SQLiteDatabase db=ReaderDatabase.getWritableDb();
  db.beginTransaction();
  try {
    try {
      db.execSQL("String_Node_Str");
      addOrUpdateTags(tags);
      db.setTransactionSuccessful();
    }
 catch (    SQLException e) {
      AppLog.e(T.READER,e);
    }
  }
  finally {
    db.endTransaction();
  }
}

Fixed version (ground truth):
public static void replaceTags(ReaderTagList tags){
  if (tags == null || tags.size() == 0) {
    return;
  }
  SQLiteDatabase db=ReaderDatabase.getWritableDb();
  db.beginTransaction();
  try {
    try {
      db.execSQL("String_Node_Str");
      addOrUpdateTags(tags);
      db.setTransactionSuccessful();
    }
 catch (    SQLException e) {
      AppLog.e(T.READER,e);
    }
  }
  finally {
    db.endTransaction();
  }
}
Program: 14696
Project: 14696
Buggy source:
public static void deleteTag(String tagName){
  if (TextUtils.isEmpty(tagName))   return;
  String[] args={tagName};
  ReaderDatabase.getWritableDb().delete("String_Node_Str","String_Node_Str",args);
  ReaderDatabase.getWritableDb().delete("String_Node_Str","String_Node_Str",args);
}

Fixed version (ground truth):
public static void deleteTag(String tagName){
  if (TextUtils.isEmpty(tagName)) {
    return;
  }
  String[] args={tagName};
  ReaderDatabase.getWritableDb().delete("String_Node_Str","String_Node_Str",args);
  ReaderDatabase.getWritableDb().delete("String_Node_Str","String_Node_Str",args);
}
Program: 14697
Project: 14697
Buggy source:
private static int minutesSinceLastUpdate(String tagName){
  if (TextUtils.isEmpty(tagName))   return 0;
  String updated=getTagLastUpdated(tagName);
  if (TextUtils.isEmpty(updated))   return NEVER_UPDATED;
  Date dtUpdated=DateTimeUtils.iso8601ToJavaDate(updated);
  if (dtUpdated == null)   return 0;
  Date dtNow=new Date();
  return DateTimeUtils.minutesBetween(dtUpdated,dtNow);
}

Fixed version (ground truth):
private static int minutesSinceLastUpdate(String tagName){
  if (TextUtils.isEmpty(tagName)) {
    return 0;
  }
  String updated=getTagLastUpdated(tagName);
  if (TextUtils.isEmpty(updated)) {
    return NEVER_UPDATED;
  }
  Date dtUpdated=DateTimeUtils.iso8601ToJavaDate(updated);
  if (dtUpdated == null) {
    return 0;
  }
  Date dtNow=new Date();
  return DateTimeUtils.minutesBetween(dtUpdated,dtNow);
}
Program: 14698
Project: 14698
Buggy source:
public static String getTagLastUpdated(String tagName){
  if (TextUtils.isEmpty(tagName))   return "String_Node_Str";
  return SqlUtils.stringForQuery(ReaderDatabase.getReadableDb(),"String_Node_Str",new String[]{tagName});
}

Fixed version (ground truth):
public static String getTagLastUpdated(String tagName){
  if (TextUtils.isEmpty(tagName)) {
    return "String_Node_Str";
  }
  return SqlUtils.stringForQuery(ReaderDatabase.getReadableDb(),"String_Node_Str",new String[]{tagName});
}
Program: 14699
Project: 14699
Buggy source:
public static boolean tagExists(String tagName){
  if (TextUtils.isEmpty(tagName))   return false;
  return SqlUtils.boolForQuery(ReaderDatabase.getReadableDb(),"String_Node_Str",new String[]{tagName});
}

Fixed version (ground truth):
public static boolean tagExists(String tagName){
  if (TextUtils.isEmpty(tagName)) {
    return false;
  }
  return SqlUtils.boolForQuery(ReaderDatabase.getReadableDb(),"String_Node_Str",new String[]{tagName});
}
Program: 14700
Project: 14700
Buggy source:
public static String getTagOldestDate(String tagName){
  if (TextUtils.isEmpty(tagName))   return "String_Node_Str";
  return SqlUtils.stringForQuery(ReaderDatabase.getReadableDb(),"String_Node_Str",new String[]{tagName});
}

Fixed version (ground truth):
public static String getTagOldestDate(String tagName){
  if (TextUtils.isEmpty(tagName)) {
    return "String_Node_Str";
  }
  return SqlUtils.stringForQuery(ReaderDatabase.getReadableDb(),"String_Node_Str",new String[]{tagName});
}
Program: 14701
Project: 14701
Buggy source:
public static void setTagOldestDate(String tagName,String date){
  if (TextUtils.isEmpty(tagName))   return;
  ContentValues values=new ContentValues();
  values.put("String_Node_Str",tagName);
  values.put("String_Node_Str",date);
  try {
    ReaderDatabase.getWritableDb().insertWithOnConflict("String_Node_Str",null,values,SQLiteDatabase.CONFLICT_REPLACE);
  }
 catch (  SQLException e) {
    AppLog.e(T.READER,e);
  }
}

Fixed version (ground truth):
public static void setTagOldestDate(String tagName,String date){
  if (TextUtils.isEmpty(tagName)) {
    return;
  }
  ContentValues values=new ContentValues();
  values.put("String_Node_Str",tagName);
  values.put("String_Node_Str",date);
  try {
    ReaderDatabase.getWritableDb().insertWithOnConflict("String_Node_Str",null,values,SQLiteDatabase.CONFLICT_REPLACE);
  }
 catch (  SQLException e) {
    AppLog.e(T.READER,e);
  }
}
Program: 14702
Project: 14702
Buggy source:
@Override public void onUpdateResult(UpdateResult result){
  mHasPerformedInitialUpdate=true;
  ReaderPostListFragment listFragment=getListFragment();
  if (listFragment != null) {
    if (animateRefresh) {
      listFragment.setIsUpdating(false,RequestDataAction.LOAD_NEWER);
    }
    if (result == UpdateResult.CHANGED) {
      listFragment.refreshTags();
    }
  }
  AppLog.i(T.READER,"String_Node_Str");
  ReaderUserActions.updateCurrentUser(null);
  AppLog.i(T.READER,"String_Node_Str");
  ReaderBlogActions.updateFollowedBlogs();
  AppLog.i(T.READER,"String_Node_Str");
  ReaderAuthActions.updateCookies(ReaderActivity.this);
}

Fixed version (ground truth):
@Override public void onUpdateResult(UpdateResult result){
  mHasPerformedInitialUpdate=true;
  ReaderPostListFragment listFragment=getListFragment();
  if (listFragment != null) {
    if (result == UpdateResult.CHANGED) {
      listFragment.refreshTags();
      if (isTagTableEmpty && ReaderPostTable.isEmpty()) {
        listFragment.updatePostsWithCurrentTag(RequestDataAction.LOAD_NEWER);
      }
    }
  }
  AppLog.i(T.READER,"String_Node_Str");
  ReaderUserActions.updateCurrentUser(null);
  AppLog.i(T.READER,"String_Node_Str");
  ReaderBlogActions.updateFollowedBlogs();
  AppLog.i(T.READER,"String_Node_Str");
  ReaderAuthActions.updateCookies(ReaderActivity.this);
}
Program: 14703
Project: 14703
Buggy source:
private void performInitialUpdate(){
  if (!NetworkUtils.isNetworkAvailable(this))   return;
  ReaderPostListFragment listFragment=getListFragment();
  final boolean animateRefresh=(listFragment != null && ReaderTagTable.isEmpty());
  if (animateRefresh) {
    listFragment.setIsUpdating(true,RequestDataAction.LOAD_NEWER);
  }
  ReaderActions.UpdateResultListener listener=new ReaderActions.UpdateResultListener(){
    @Override public void onUpdateResult(    UpdateResult result){
      mHasPerformedInitialUpdate=true;
      ReaderPostListFragment listFragment=getListFragment();
      if (listFragment != null) {
        if (animateRefresh) {
          listFragment.setIsUpdating(false,RequestDataAction.LOAD_NEWER);
        }
        if (result == UpdateResult.CHANGED) {
          listFragment.refreshTags();
        }
      }
      AppLog.i(T.READER,"String_Node_Str");
      ReaderUserActions.updateCurrentUser(null);
      AppLog.i(T.READER,"String_Node_Str");
      ReaderBlogActions.updateFollowedBlogs();
      AppLog.i(T.READER,"String_Node_Str");
      ReaderAuthActions.updateCookies(ReaderActivity.this);
    }
  }
;
  ReaderTagActions.updateTags(listener);
}

Fixed version (ground truth):
private void performInitialUpdate(){
  if (!NetworkUtils.isNetworkAvailable(this)) {
    return;
  }
  final boolean isTagTableEmpty=ReaderTagTable.isEmpty();
  ReaderActions.UpdateResultListener listener=new ReaderActions.UpdateResultListener(){
    @Override public void onUpdateResult(    UpdateResult result){
      mHasPerformedInitialUpdate=true;
      ReaderPostListFragment listFragment=getListFragment();
      if (listFragment != null) {
        if (result == UpdateResult.CHANGED) {
          listFragment.refreshTags();
          if (isTagTableEmpty && ReaderPostTable.isEmpty()) {
            listFragment.updatePostsWithCurrentTag(RequestDataAction.LOAD_NEWER);
          }
        }
      }
      AppLog.i(T.READER,"String_Node_Str");
      ReaderUserActions.updateCurrentUser(null);
      AppLog.i(T.READER,"String_Node_Str");
      ReaderBlogActions.updateFollowedBlogs();
      AppLog.i(T.READER,"String_Node_Str");
      ReaderAuthActions.updateCookies(ReaderActivity.this);
    }
  }
;
  ReaderTagActions.updateTags(listener);
}
Program: 14704
Project: 14704
Buggy source:
private void updatePostsWithTag(final String tagName,final RequestDataAction updateAction,RefreshType refreshType){
  if (TextUtils.isEmpty(tagName)) {
    return;
  }
  if (!NetworkUtils.isNetworkAvailable(getActivity())) {
    AppLog.i(T.READER,"String_Node_Str");
    return;
  }
  setIsUpdating(true,updateAction);
  setEmptyTitleAndDescriptionForCurrentTag();
  if (refreshType == RefreshType.MANUAL && isCurrentTag(tagName)) {
    if (tagName.equals(ReaderTag.TAG_NAME_LIKED) || tagName.equals(ReaderTag.TAG_NAME_FOLLOWING))     refreshPosts();
  }
  ReaderPostActions.updatePostsWithTag(tagName,updateAction,new ReaderActions.UpdateResultAndCountListener(){
    @Override public void onUpdateResult(    ReaderActions.UpdateResult result,    int numNewPosts){
      if (!hasActivity()) {
        AppLog.w(T.READER,"String_Node_Str");
        return;
      }
      setIsUpdating(false,updateAction);
      if (result == ReaderActions.UpdateResult.CHANGED && numNewPosts > 0 && isCurrentTag(tagName)) {
        if (!isEmpty() && updateAction == RequestDataAction.LOAD_NEWER) {
          showNewPostsBar(numNewPosts);
        }
 else {
          refreshPosts();
        }
      }
 else {
        setEmptyTitleAndDescriptionForCurrentTag();
      }
    }
  }
);
}

Fixed version (ground truth):
private void updatePostsWithTag(final String tagName,final RequestDataAction updateAction,RefreshType refreshType){
  if (TextUtils.isEmpty(tagName)) {
    return;
  }
  if (!NetworkUtils.isNetworkAvailable(getActivity())) {
    AppLog.i(T.READER,"String_Node_Str");
    return;
  }
  if (ReaderTagTable.isEmpty()) {
    AppLog.w(T.READER,"String_Node_Str");
    return;
  }
  setIsUpdating(true,updateAction);
  setEmptyTitleAndDescriptionForCurrentTag();
  if (refreshType == RefreshType.MANUAL && isCurrentTag(tagName)) {
    if (tagName.equals(ReaderTag.TAG_NAME_LIKED) || tagName.equals(ReaderTag.TAG_NAME_FOLLOWING))     refreshPosts();
  }
  ReaderPostActions.updatePostsWithTag(tagName,updateAction,new ReaderActions.UpdateResultAndCountListener(){
    @Override public void onUpdateResult(    ReaderActions.UpdateResult result,    int numNewPosts){
      if (!hasActivity()) {
        AppLog.w(T.READER,"String_Node_Str");
        return;
      }
      setIsUpdating(false,updateAction);
      if (result == ReaderActions.UpdateResult.CHANGED && numNewPosts > 0 && isCurrentTag(tagName)) {
        if (!isEmpty() && updateAction == RequestDataAction.LOAD_NEWER) {
          showNewPostsBar(numNewPosts);
        }
 else {
          refreshPosts();
        }
      }
 else {
        setEmptyTitleAndDescriptionForCurrentTag();
      }
    }
  }
);
}
Program: 14705
Project: 14705
Buggy source:
private void updatePostsWithCurrentTag(RequestDataAction updateAction){
  if (hasCurrentTag()) {
    updatePostsWithTag(mCurrentTag,updateAction,RefreshType.AUTOMATIC);
  }
}

Fixed version (ground truth):
protected void updatePostsWithCurrentTag(RequestDataAction updateAction){
  if (hasCurrentTag()) {
    updatePostsWithTag(mCurrentTag,updateAction,RefreshType.AUTOMATIC);
  }
}
Program: 14706
Project: 14706
Buggy source:
@Override public void onActivityResumed(Activity arg0){
  if (!canSynchWithWordPressDotComBackend())   return;
  if (WordPress.hasValidWPComCredentials(mContext)) {
    String token=null;
    try {
      GCMRegistrar.checkDevice(mContext);
      GCMRegistrar.checkManifest(mContext);
      token=GCMRegistrar.getRegistrationId(mContext);
      String gcmId=BuildConfig.GCM_ID;
      if (gcmId == null || token == null || token.equals("String_Node_Str")) {
        AppLog.e(T.NOTIFS,"String_Node_Str");
        return;
      }
 else {
        NotificationUtils.registerDeviceForPushNotifications(mContext,token);
      }
    }
 catch (    Exception e) {
      AppLog.e(T.NOTIFS,"String_Node_Str" + e.getMessage());
    }
  }
  WordPress.updateCurrentBlogStatsInBackground();
}

Fixed version (ground truth):
@Override public void onActivityResumed(Activity arg0){
  if (!canSynchWithWordPressDotComBackend())   return;
  if (WordPress.hasValidWPComCredentials(mContext)) {
    String token=null;
    try {
      GCMRegistrar.checkDevice(mContext);
      GCMRegistrar.checkManifest(mContext);
      token=GCMRegistrar.getRegistrationId(mContext);
      String gcmId=BuildConfig.GCM_ID;
      if (gcmId == null || token == null || token.equals("String_Node_Str")) {
        AppLog.e(T.NOTIFS,"String_Node_Str");
        return;
      }
 else {
        NotificationUtils.registerDeviceForPushNotifications(mContext,token);
      }
    }
 catch (    Exception e) {
      AppLog.e(T.NOTIFS,"String_Node_Str" + e.getMessage());
    }
  }
  WordPress.updateCurrentBlogStatsInBackground(false);
}
Program: 14707
Project: 14707
Buggy source:
public static void setupVolleyQueue(){
  requestQueue=Volley.newRequestQueue(mContext,VolleyUtils.getHTTPClientStack(mContext));
  imageLoader=new ImageLoader(requestQueue,getBitmapCache());
  VolleyLog.setTag(TAG);
  imageLoader.setBatchedResponseDelay(0);
}

Fixed version (ground truth):
public static void setupVolleyQueue(){
  requestQueue=Volley.newRequestQueue(mContext,VolleyUtils.getHTTPClientStack(mContext));
  imageLoader=new ImageLoader(requestQueue,getBitmapCache());
  VolleyLog.setTag(AppLog.TAG);
  imageLoader.setBatchedResponseDelay(0);
}
Program: 14708
Project: 14708
Buggy source:
@Override public void onCreate(){
  ProfilingUtils.start("String_Node_Str");
  AppLog.enableRecording(true);
  if (!Utils.isDebugBuild()) {
    Crashlytics.start(this);
    AppLog.enableCrashlytics(true);
  }
  versionName=getVersionName(this);
  initWpDb();
  wpStatsDB=new WordPressStatsDB(this);
  mContext=this;
  setupVolleyQueue();
  SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(this);
  if (settings.getInt("String_Node_Str",-1) >= 0) {
    shouldRestoreSelectedActivity=true;
  }
  registerForCloudMessaging(this);
  AppLockManager.getInstance().enableDefaultAppLockIfAvailable(this);
  if (AppLockManager.getInstance().isAppLockFeatureEnabled()) {
    AppLockManager.getInstance().getCurrentAppLock().setDisabledActivities(new String[]{"String_Node_Str"});
  }
  AnalyticsTracker.registerTracker(new AnalyticsTrackerMixpanel());
  AnalyticsTracker.registerTracker(new AnalyticsTrackerWPCom());
  AnalyticsTracker.beginSession();
  AnalyticsTracker.track(AnalyticsTracker.Stat.APPLICATION_OPENED);
  super.onCreate();
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    ApplicationLifecycleMonitor pnBackendMponitor=new ApplicationLifecycleMonitor();
    registerComponentCallbacks(pnBackendMponitor);
    registerActivityLifecycleCallbacks(pnBackendMponitor);
  }
  updateCurrentBlogStatsInBackground();
}

Fixed version (ground truth):
@Override public void onCreate(){
  ProfilingUtils.start("String_Node_Str");
  AppLog.enableRecording(true);
  if (!Utils.isDebugBuild()) {
    Crashlytics.start(this);
    AppLog.enableCrashlytics(true);
  }
  versionName=getVersionName(this);
  initWpDb();
  wpStatsDB=new WordPressStatsDB(this);
  mContext=this;
  setupVolleyQueue();
  SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(this);
  if (settings.getInt("String_Node_Str",-1) >= 0) {
    shouldRestoreSelectedActivity=true;
  }
  registerForCloudMessaging(this);
  AppLockManager.getInstance().enableDefaultAppLockIfAvailable(this);
  if (AppLockManager.getInstance().isAppLockFeatureEnabled()) {
    AppLockManager.getInstance().getCurrentAppLock().setDisabledActivities(new String[]{"String_Node_Str"});
  }
  AnalyticsTracker.registerTracker(new AnalyticsTrackerMixpanel());
  AnalyticsTracker.registerTracker(new AnalyticsTrackerWPCom());
  AnalyticsTracker.beginSession();
  AnalyticsTracker.track(AnalyticsTracker.Stat.APPLICATION_OPENED);
  super.onCreate();
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    ApplicationLifecycleMonitor pnBackendMponitor=new ApplicationLifecycleMonitor();
    registerComponentCallbacks(pnBackendMponitor);
    registerActivityLifecycleCallbacks(pnBackendMponitor);
  }
  updateCurrentBlogStatsInBackground(false);
}
Program: 14709
Project: 14709
Buggy source:
public synchronized static void updateCurrentBlogStatsInBackground(){
  if (statsLastPingDate != null) {
    Date now=new Date();
    long nowInMilliseconds=now.getTime();
    long lastPingDateInMilliseconds=statsLastPingDate.getTime();
    int secondsPassed=(int)(nowInMilliseconds - lastPingDateInMilliseconds) / (1000);
    if (secondsPassed < 30 * 60) {
      return;
    }
  }
  Blog currentBlog=WordPress.getCurrentBlog();
  if (currentBlog != null) {
    String blogID=null;
    if (currentBlog.isDotcomFlag()) {
      blogID=String.valueOf(currentBlog.getRemoteBlogId());
    }
 else     if (currentBlog.isJetpackPowered() && currentBlog.hasValidJetpackCredentials()) {
      blogID=currentBlog.getApi_blogid();
    }
    if (blogID != null) {
      Intent intent=new Intent(mContext,StatsService.class);
      intent.putExtra(StatsService.ARG_BLOG_ID,blogID);
      mContext.startService(intent);
      statsLastPingDate=new Date();
    }
  }
}

Fixed version (ground truth):
public synchronized static void updateCurrentBlogStatsInBackground(boolean alwaysUpdate){
  if (!alwaysUpdate && mStatsLastPingDate != null) {
    Date now=new Date();
    long nowInMilliseconds=now.getTime();
    long lastPingDateInMilliseconds=mStatsLastPingDate.getTime();
    int secondsPassed=(int)(nowInMilliseconds - lastPingDateInMilliseconds) / (1000);
    if (secondsPassed < 30 * 60) {
      return;
    }
  }
  Blog currentBlog=WordPress.getCurrentBlog();
  if (currentBlog != null) {
    String blogID=null;
    if (currentBlog.isDotcomFlag()) {
      blogID=String.valueOf(currentBlog.getRemoteBlogId());
    }
 else     if (currentBlog.isJetpackPowered() && currentBlog.hasValidJetpackCredentials()) {
      blogID=currentBlog.getApi_blogid();
    }
    if (blogID != null) {
      Intent intent=new Intent(mContext,StatsService.class);
      intent.putExtra(StatsService.ARG_BLOG_ID,blogID);
      mContext.startService(intent);
      mStatsLastPingDate=new Date();
    }
  }
}
Program: 14710
Project: 14710
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;
    }
  }
  WordPress.statsLastPingDate=null;
  if (shouldUpdateCurrentBlogStatsInBackground()) {
    WordPress.updateCurrentBlogStatsInBackground();
  }
}

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 (shouldUpdateCurrentBlogStatsInBackground()) {
    WordPress.updateCurrentBlogStatsInBackground(true);
  }
}