nus-yam/ex-repair huggingface dataset:
Program: 14604
Project: 14604
Buggy source:
private void showStatsActivity(int remoteBlogId){
  if (getActivity() == null || isRemoving())   return;
  if (WordPress.getCurrentRemoteBlogId() != remoteBlogId) {
    int localBlogId=WordPress.wpDB.getLocalTableBlogIdForRemoteBlogId(remoteBlogId);
    WordPress.setCurrentBlog(localBlogId);
  }
  Intent intent=new Intent(getActivity(),StatsActivity.class);
  intent.putExtra(StatsActivity.ARG_NO_MENU_DRAWER,true);
  getActivity().startActivity(intent);
}

Fixed version (ground truth):
private void showStatsActivity(int remoteBlogId){
  if (getActivity() == null || isRemoving()) {
    return;
  }
  if (WordPress.getCurrentRemoteBlogId() != remoteBlogId) {
    int localBlogId=WordPress.wpDB.getLocalTableBlogIdForRemoteBlogId(remoteBlogId);
    WordPress.setCurrentBlog(localBlogId);
  }
  Intent intent=new Intent(getActivity(),StatsActivity.class);
  intent.putExtra(StatsActivity.ARG_NO_MENU_DRAWER,true);
  getActivity().startActivity(intent);
}
Program: 14605
Project: 14605
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup parent,Bundle state){
  View view=inflater.inflate(R.layout.notifications_big_badge,parent,false);
  NetworkImageView badgeImageView=(NetworkImageView)view.findViewById(R.id.badge);
  TextView bodyTextView=(TextView)view.findViewById(R.id.body);
  bodyTextView.setMovementMethod(StatsWPLinkMovementMethod.getInstance());
  if (getNote() != null) {
    String noteHTML=JSONUtil.queryJSON(getNote().toJSONObject(),"String_Node_Str","String_Node_Str");
    if (noteHTML.equals("String_Node_Str")) {
      noteHTML=getNote().getSubject();
    }
    Spanned html=HtmlUtils.fromHtml(noteHTML);
    bodyTextView.setText(html);
    String iconURL=getNote().getIconURL();
    if (!iconURL.equals("String_Node_Str"))     badgeImageView.setImageUrl(iconURL,WordPress.imageLoader);
    if (isStatsNote()) {
      final int remoteBlogId=getNote().getMetaValueAsInt("String_Node_Str",-1);
      if (WordPress.wpDB.isDotComAccountVisible(remoteBlogId)) {
        TextView txtStats=(TextView)view.findViewById(R.id.text_stats_link);
        txtStats.setVisibility(View.VISIBLE);
        View.OnClickListener statsListener=new View.OnClickListener(){
          @Override public void onClick(          View v){
            showStatsActivity(remoteBlogId);
          }
        }
;
        txtStats.setOnClickListener(statsListener);
        badgeImageView.setOnClickListener(statsListener);
      }
    }
  }
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup parent,Bundle state){
  View view=inflater.inflate(R.layout.notifications_big_badge,parent,false);
  NetworkImageView badgeImageView=(NetworkImageView)view.findViewById(R.id.badge);
  TextView bodyTextView=(TextView)view.findViewById(R.id.body);
  bodyTextView.setMovementMethod(StatsWPLinkMovementMethod.getInstance());
  if (getNote() != null) {
    String noteHTML=JSONUtil.queryJSON(getNote().toJSONObject(),"String_Node_Str","String_Node_Str");
    if (noteHTML.equals("String_Node_Str")) {
      noteHTML=getNote().getSubject();
    }
    Spanned html=HtmlUtils.fromHtml(noteHTML);
    bodyTextView.setText(html);
    String iconURL=getNote().getIconURL();
    if (!iconURL.equals("String_Node_Str")) {
      badgeImageView.setImageUrl(iconURL,WordPress.imageLoader);
    }
    if (isStatsNote()) {
      final int remoteBlogId=getNote().getMetaValueAsInt("String_Node_Str",-1);
      if (WordPress.wpDB.isDotComAccountVisible(remoteBlogId)) {
        TextView txtStats=(TextView)view.findViewById(R.id.text_stats_link);
        txtStats.setVisibility(View.VISIBLE);
        View.OnClickListener statsListener=new View.OnClickListener(){
          @Override public void onClick(          View v){
            showStatsActivity(remoteBlogId);
          }
        }
;
        txtStats.setOnClickListener(statsListener);
        badgeImageView.setOnClickListener(statsListener);
      }
    }
  }
  return view;
}
Program: 14606
Project: 14606
Buggy source:
boolean isStatsNote(){
  if (getNote() == null)   return false;
  String type=getNote().getType();
  if (type == null)   return false;
  return (type.contains("String_Node_Str") || type.startsWith("String_Node_Str") || type.startsWith("String_Node_Str")|| type.startsWith("String_Node_Str"));
}

Fixed version (ground truth):
boolean isStatsNote(){
  if (getNote() == null) {
    return false;
  }
  String type=getNote().getType();
  if (type == null) {
    return false;
  }
  return (type.contains("String_Node_Str") || type.startsWith("String_Node_Str") || type.startsWith("String_Node_Str")|| type.startsWith("String_Node_Str"));
}
Program: 14607
Project: 14607
Buggy source:
public static WPLinkMovementMethod getInstance(){
  if (mMovementMethod == null)   mMovementMethod=new StatsWPLinkMovementMethod();
  return mMovementMethod;
}

Fixed version (ground truth):
public static WPLinkMovementMethod getInstance(){
  if (mMovementMethod == null) {
    mMovementMethod=new StatsWPLinkMovementMethod();
  }
  return mMovementMethod;
}
Program: 14608
Project: 14608
Buggy source:
private void showStatsActivity(int remoteBlogId){
  if (getActivity() == null || isRemoving())   return;
  if (WordPress.getCurrentRemoteBlogId() != remoteBlogId) {
    int localBlogId=WordPress.wpDB.getLocalTableBlogIdForRemoteBlogId(remoteBlogId);
    WordPress.setCurrentBlog(localBlogId);
  }
  Intent intent=new Intent(getActivity(),StatsActivity.class);
  intent.putExtra(StatsActivity.ARG_NO_MENU_DRAWER,true);
  getActivity().startActivity(intent);
}

Fixed version (ground truth):
private void showStatsActivity(int remoteBlogId){
  if (getActivity() == null || isRemoving()) {
    return;
  }
  if (WordPress.getCurrentRemoteBlogId() != remoteBlogId) {
    int localBlogId=WordPress.wpDB.getLocalTableBlogIdForRemoteBlogId(remoteBlogId);
    WordPress.setCurrentBlog(localBlogId);
  }
  Intent intent=new Intent(getActivity(),StatsActivity.class);
  intent.putExtra(StatsActivity.ARG_NO_MENU_DRAWER,true);
  getActivity().startActivity(intent);
}
Program: 14609
Project: 14609
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup parent,Bundle state){
  View view=inflater.inflate(R.layout.notifications_big_badge,parent,false);
  NetworkImageView badgeImageView=(NetworkImageView)view.findViewById(R.id.badge);
  TextView bodyTextView=(TextView)view.findViewById(R.id.body);
  bodyTextView.setMovementMethod(StatsWPLinkMovementMethod.getInstance());
  if (getNote() != null) {
    String noteHTML=JSONUtil.queryJSON(getNote().toJSONObject(),"String_Node_Str","String_Node_Str");
    if (noteHTML.equals("String_Node_Str")) {
      noteHTML=getNote().getSubject();
    }
    Spanned html=HtmlUtils.fromHtml(noteHTML);
    bodyTextView.setText(html);
    String iconURL=getNote().getIconURL();
    if (!iconURL.equals("String_Node_Str"))     badgeImageView.setImageUrl(iconURL,WordPress.imageLoader);
    if (isStatsNote()) {
      final int remoteBlogId=getNote().getMetaValueAsInt("String_Node_Str",-1);
      if (WordPress.wpDB.isDotComAccountVisible(remoteBlogId)) {
        TextView txtStats=(TextView)view.findViewById(R.id.text_stats_link);
        txtStats.setVisibility(View.VISIBLE);
        View.OnClickListener statsListener=new View.OnClickListener(){
          @Override public void onClick(          View v){
            showStatsActivity(remoteBlogId);
          }
        }
;
        txtStats.setOnClickListener(statsListener);
        badgeImageView.setOnClickListener(statsListener);
      }
    }
  }
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup parent,Bundle state){
  View view=inflater.inflate(R.layout.notifications_big_badge,parent,false);
  NetworkImageView badgeImageView=(NetworkImageView)view.findViewById(R.id.badge);
  TextView bodyTextView=(TextView)view.findViewById(R.id.body);
  bodyTextView.setMovementMethod(StatsWPLinkMovementMethod.getInstance());
  if (getNote() != null) {
    String noteHTML=JSONUtil.queryJSON(getNote().toJSONObject(),"String_Node_Str","String_Node_Str");
    if (noteHTML.equals("String_Node_Str")) {
      noteHTML=getNote().getSubject();
    }
    Spanned html=HtmlUtils.fromHtml(noteHTML);
    bodyTextView.setText(html);
    String iconURL=getNote().getIconURL();
    if (!iconURL.equals("String_Node_Str")) {
      badgeImageView.setImageUrl(iconURL,WordPress.imageLoader);
    }
    if (isStatsNote()) {
      final int remoteBlogId=getNote().getMetaValueAsInt("String_Node_Str",-1);
      if (WordPress.wpDB.isDotComAccountVisible(remoteBlogId)) {
        TextView txtStats=(TextView)view.findViewById(R.id.text_stats_link);
        txtStats.setVisibility(View.VISIBLE);
        View.OnClickListener statsListener=new View.OnClickListener(){
          @Override public void onClick(          View v){
            showStatsActivity(remoteBlogId);
          }
        }
;
        txtStats.setOnClickListener(statsListener);
        badgeImageView.setOnClickListener(statsListener);
      }
    }
  }
  return view;
}
Program: 14610
Project: 14610
Buggy source:
boolean isStatsNote(){
  if (getNote() == null)   return false;
  String type=getNote().getType();
  if (type == null)   return false;
  return (type.contains("String_Node_Str") || type.startsWith("String_Node_Str") || type.startsWith("String_Node_Str")|| type.startsWith("String_Node_Str"));
}

Fixed version (ground truth):
boolean isStatsNote(){
  if (getNote() == null) {
    return false;
  }
  String type=getNote().getType();
  if (type == null) {
    return false;
  }
  return (type.contains("String_Node_Str") || type.startsWith("String_Node_Str") || type.startsWith("String_Node_Str")|| type.startsWith("String_Node_Str"));
}
Program: 14611
Project: 14611
Buggy source:
public static WPLinkMovementMethod getInstance(){
  if (mMovementMethod == null)   mMovementMethod=new StatsWPLinkMovementMethod();
  return mMovementMethod;
}

Fixed version (ground truth):
public static WPLinkMovementMethod getInstance(){
  if (mMovementMethod == null) {
    mMovementMethod=new StatsWPLinkMovementMethod();
  }
  return mMovementMethod;
}
Program: 14612
Project: 14612
Buggy source:
public JSONObject getCustomField(String key){
  JSONArray customFields=getCustomFields();
  if (customFields == null) {
    return null;
  }
  for (int i=0; i < customFields.length(); i++) {
    try {
      JSONObject jsonObject=new JSONObject(customFields.getString(i));
      String curentKey=jsonObject.getString("String_Node_Str");
      if (key.equals(curentKey)) {
        return jsonObject;
      }
    }
 catch (    JSONException e) {
      AppLog.e(T.POSTS,e);
    }
  }
  return null;
}

Fixed version (ground truth):
public JSONObject getCustomField(String key){
  JSONArray customFieldsJson=getCustomFields();
  if (customFieldsJson == null) {
    return null;
  }
  for (int i=0; i < customFieldsJson.length(); i++) {
    try {
      JSONObject jsonObject=new JSONObject(customFieldsJson.getString(i));
      String curentKey=jsonObject.getString("String_Node_Str");
      if (key.equals(curentKey)) {
        return jsonObject;
      }
    }
 catch (    JSONException e) {
      AppLog.e(T.POSTS,e);
    }
  }
  return null;
}
Program: 14614
Project: 14614
Buggy source:
public static Geocoder getGeocoder(Context context){
  if (!Geocoder.isPresent())   return null;
  Geocoder gcd;
  try {
    gcd=new Geocoder(context,Locale.getDefault());
  }
 catch (  NullPointerException cannotIstantiateEx) {
    AppLog.e(AppLog.T.UTILS,"String_Node_Str",cannotIstantiateEx);
    return null;
  }
  return gcd;
}

Fixed version (ground truth):
public static Geocoder getGeocoder(Context context){
  if (!Geocoder.isPresent()) {
    return null;
  }
  Geocoder gcd;
  try {
    gcd=new Geocoder(context,Locale.getDefault());
  }
 catch (  NullPointerException cannotIstantiateEx) {
    AppLog.e(AppLog.T.UTILS,"String_Node_Str",cannotIstantiateEx);
    return null;
  }
  return gcd;
}
Program: 14615
Project: 14615
Buggy source:
public static String getLocationNameFromAddress(Address address){
  String locality="String_Node_Str", adminArea="String_Node_Str", country="String_Node_Str";
  if (address.getLocality() != null)   locality=address.getLocality();
  if (address.getAdminArea() != null)   adminArea=address.getAdminArea();
  if (address.getCountryName() != null)   country=address.getCountryName();
  return ((locality.equals("String_Node_Str")) ? locality : locality + "String_Node_Str") + ((adminArea.equals("String_Node_Str")) ? adminArea : adminArea + "String_Node_Str") + country;
}

Fixed version (ground truth):
public static String getLocationNameFromAddress(Address address){
  String locality="String_Node_Str", adminArea="String_Node_Str", country="String_Node_Str";
  if (address.getLocality() != null) {
    locality=address.getLocality();
  }
  if (address.getAdminArea() != null) {
    adminArea=address.getAdminArea();
  }
  if (address.getCountryName() != null) {
    country=address.getCountryName();
  }
  return ((locality.equals("String_Node_Str")) ? locality : locality + "String_Node_Str") + ((adminArea.equals("String_Node_Str")) ? adminArea : adminArea + "String_Node_Str") + country;
}
Program: 14616
Project: 14616
Buggy source:
private void copyDatabase(SQLiteDatabase db){
  String copyFrom=db.getPath();
  String copyTo=WordPress.getContext().getExternalFilesDir(null).getAbsolutePath() + "String_Node_Str" + DB_NAME;
  try {
    InputStream input=new FileInputStream(copyFrom);
    OutputStream output=new FileOutputStream(copyTo);
    byte[] buffer=new byte[1024];
    int length;
    while ((length=input.read(buffer)) > 0)     output.write(buffer,0,length);
    output.flush();
    output.close();
    input.close();
  }
 catch (  IOException e) {
    AppLog.e(T.DB,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void copyDatabase(SQLiteDatabase db){
  String copyFrom=db.getPath();
  String copyTo=WordPress.getContext().getExternalFilesDir(null).getAbsolutePath() + "String_Node_Str" + DB_NAME;
  try {
    InputStream input=new FileInputStream(copyFrom);
    OutputStream output=new FileOutputStream(copyTo);
    byte[] buffer=new byte[1024];
    int length;
    while ((length=input.read(buffer)) > 0) {
      output.write(buffer,0,length);
    }
    output.flush();
    output.close();
    input.close();
  }
 catch (  IOException e) {
    AppLog.e(T.DB,"String_Node_Str",e);
  }
}
Program: 14617
Project: 14617
Buggy source:
private static void purge(){
  SQLiteDatabase db=getWritableDb();
  db.beginTransaction();
  try {
    int numPostsDeleted=ReaderPostTable.purge(db);
    if (numPostsDeleted > 0) {
      AppLog.i(T.READER,String.format("String_Node_Str",numPostsDeleted));
      int numCommentsDeleted=ReaderCommentTable.purge(db);
      if (numCommentsDeleted > 0)       AppLog.i(T.READER,String.format("String_Node_Str",numCommentsDeleted));
      int numLikesDeleted=ReaderLikeTable.purge(db);
      if (numLikesDeleted > 0)       AppLog.i(T.READER,String.format("String_Node_Str",numLikesDeleted));
      int numThumbsPurged=ReaderThumbnailTable.purge(db);
      if (numThumbsPurged > 0)       AppLog.i(T.READER,String.format("String_Node_Str",numThumbsPurged));
      int numTagsPurged=ReaderTagTable.purge(db);
      if (numTagsPurged > 0)       AppLog.i(T.READER,String.format("String_Node_Str",numTagsPurged));
    }
    db.setTransactionSuccessful();
  }
  finally {
    db.endTransaction();
  }
}

Fixed version (ground truth):
private static void purge(){
  SQLiteDatabase db=getWritableDb();
  db.beginTransaction();
  try {
    int numPostsDeleted=ReaderPostTable.purge(db);
    if (numPostsDeleted > 0) {
      AppLog.i(T.READER,String.format("String_Node_Str",numPostsDeleted));
      int numCommentsDeleted=ReaderCommentTable.purge(db);
      if (numCommentsDeleted > 0) {
        AppLog.i(T.READER,String.format("String_Node_Str",numCommentsDeleted));
      }
      int numLikesDeleted=ReaderLikeTable.purge(db);
      if (numLikesDeleted > 0) {
        AppLog.i(T.READER,String.format("String_Node_Str",numLikesDeleted));
      }
      int numThumbsPurged=ReaderThumbnailTable.purge(db);
      if (numThumbsPurged > 0) {
        AppLog.i(T.READER,String.format("String_Node_Str",numThumbsPurged));
      }
      int numTagsPurged=ReaderTagTable.purge(db);
      if (numTagsPurged > 0) {
        AppLog.i(T.READER,String.format("String_Node_Str",numTagsPurged));
      }
    }
    db.setTransactionSuccessful();
  }
  finally {
    db.endTransaction();
  }
}
Program: 14618
Project: 14618
Buggy source:
public static void addOrUpdatePost(ReaderPost post){
  if (post == null)   return;
  ReaderPostList posts=new ReaderPostList();
  posts.add(post);
  addOrUpdatePosts(null,posts);
}

Fixed version (ground truth):
public static void addOrUpdatePost(ReaderPost post){
  if (post == null) {
    return;
  }
  ReaderPostList posts=new ReaderPostList();
  posts.add(post);
  addOrUpdatePosts(null,posts);
}
Program: 14620
Project: 14620
Buggy source:
public static ReaderPostList getPostsInBlog(long blogId,int maxPosts){
  String sql="String_Node_Str";
  if (maxPosts > 0)   sql+="String_Node_Str" + Integer.toString(maxPosts);
  Cursor cursor=ReaderDatabase.getReadableDb().rawQuery(sql,new String[]{Long.toString(blogId)});
  try {
    ReaderPostList posts=new ReaderPostList();
    if (cursor == null || !cursor.moveToFirst())     return posts;
    final PostColumnIndexes cols=new PostColumnIndexes(cursor);
    do {
      posts.add(getPostFromCursor(cursor,cols));
    }
 while (cursor.moveToNext());
    return posts;
  }
  finally {
    SqlUtils.closeCursor(cursor);
  }
}

Fixed version (ground truth):
public static ReaderPostList getPostsInBlog(long blogId,int maxPosts){
  String sql="String_Node_Str";
  if (maxPosts > 0) {
    sql+="String_Node_Str" + Integer.toString(maxPosts);
  }
  Cursor cursor=ReaderDatabase.getReadableDb().rawQuery(sql,new String[]{Long.toString(blogId)});
  try {
    ReaderPostList posts=new ReaderPostList();
    if (cursor == null || !cursor.moveToFirst()) {
      return posts;
    }
    final PostColumnIndexes cols=new PostColumnIndexes(cursor);
    do {
      posts.add(getPostFromCursor(cursor,cols));
    }
 while (cursor.moveToNext());
    return posts;
  }
  finally {
    SqlUtils.closeCursor(cursor);
  }
}
Program: 14621
Project: 14621
Buggy source:
public static int getNumCommentsForPost(ReaderPost post){
  if (post == null)   return 0;
  String[] args=new String[]{Long.toString(post.blogId),Long.toString(post.postId)};
  return SqlUtils.intForQuery(ReaderDatabase.getReadableDb(),"String_Node_Str",args);
}

Fixed version (ground truth):
public static int getNumCommentsForPost(ReaderPost post){
  if (post == null) {
    return 0;
  }
  String[] args=new String[]{Long.toString(post.blogId),Long.toString(post.postId)};
  return SqlUtils.intForQuery(ReaderDatabase.getReadableDb(),"String_Node_Str",args);
}
Program: 14622
Project: 14622
Buggy source:
public static ReaderPost getPost(long blogId,long postId){
  String[] args=new String[]{Long.toString(blogId),Long.toString(postId)};
  Cursor c=ReaderDatabase.getReadableDb().rawQuery("String_Node_Str",args);
  try {
    if (!c.moveToFirst())     return null;
    return getPostFromCursor(c,null);
  }
  finally {
    SqlUtils.closeCursor(c);
  }
}

Fixed version (ground truth):
public static ReaderPost getPost(long blogId,long postId){
  String[] args=new String[]{Long.toString(blogId),Long.toString(postId)};
  Cursor c=ReaderDatabase.getReadableDb().rawQuery("String_Node_Str",args);
  try {
    if (!c.moveToFirst()) {
      return null;
    }
    return getPostFromCursor(c,null);
  }
  finally {
    SqlUtils.closeCursor(c);
  }
}
Program: 14623
Project: 14623
Buggy source:
public static void setPostReblogged(ReaderPost post,boolean isReblogged){
  if (post == null)   return;
  String sql="String_Node_Str" + SqlUtils.boolToSql(isReblogged) + "String_Node_Str";
  String[] args={Long.toString(post.blogId),Long.toString(post.postId)};
  ReaderDatabase.getWritableDb().execSQL(sql,args);
}

Fixed version (ground truth):
public static void setPostReblogged(ReaderPost post,boolean isReblogged){
  if (post == null) {
    return;
  }
  String sql="String_Node_Str" + SqlUtils.boolToSql(isReblogged) + "String_Node_Str";
  String[] args={Long.toString(post.blogId),Long.toString(post.postId)};
  ReaderDatabase.getWritableDb().execSQL(sql,args);
}
Program: 14624
Project: 14624
Buggy source:
public static int deletePostsWithTag(String tagName){
  if (TextUtils.isEmpty(tagName))   return 0;
  int numDeleted=ReaderDatabase.getWritableDb().delete("String_Node_Str","String_Node_Str",new String[]{tagName});
  if (numDeleted > 0)   ReaderDatabase.getWritableDb().delete("String_Node_Str","String_Node_Str",null);
  return numDeleted;
}

Fixed version (ground truth):
public static int deletePostsWithTag(String tagName){
  if (TextUtils.isEmpty(tagName)) {
    return 0;
  }
  int numDeleted=ReaderDatabase.getWritableDb().delete("String_Node_Str","String_Node_Str",new String[]{tagName});
  if (numDeleted > 0)   ReaderDatabase.getWritableDb().delete("String_Node_Str","String_Node_Str",null);
  return numDeleted;
}
Program: 14625
Project: 14625
Buggy source:
public static ReaderTag getReaderTag(){
  String tagName=getString(PREFKEY_READER_TAG_NAME);
  if (TextUtils.isEmpty(tagName)) {
    return null;
  }
  ReaderTagType tagType=ReaderTagType.fromInt(getInt(PREFKEY_READER_TAG_TYPE));
  return new ReaderTag(tagName,tagType);
}

Fixed version (ground truth):
public static ReaderTag getReaderTag(){
  String tagName=getString(PREFKEY_READER_TAG_NAME);
  if (TextUtils.isEmpty(tagName)) {
    return null;
  }
  int tagType=getInt(PREFKEY_READER_TAG_TYPE);
  return new ReaderTag(tagName,ReaderTagType.fromInt(tagType));
}
Program: 14626
Project: 14626
Buggy source:
public static void setReaderTag(ReaderTag tag){
  SharedPreferences.Editor editor=prefs().edit();
  if (tag != null) {
    editor.putString(PREFKEY_READER_TAG_NAME,tag.getTagName());
    editor.putInt(PREFKEY_READER_TAG_TYPE,tag.tagType.toInt());
  }
 else {
    editor.remove(PREFKEY_READER_TAG_NAME);
    editor.remove(PREFKEY_READER_TAG_TYPE);
  }
  editor.commit();
}

Fixed version (ground truth):
public static void setReaderTag(ReaderTag tag){
  if (tag != null && !TextUtils.isEmpty(tag.getTagName())) {
    setString(PREFKEY_READER_TAG_NAME,tag.getTagName());
    setInt(PREFKEY_READER_TAG_TYPE,tag.tagType.toInt());
  }
 else {
    prefs().edit().remove(PREFKEY_READER_TAG_NAME).remove(PREFKEY_READER_TAG_TYPE).commit();
  }
}
Program: 14627
Project: 14627
Buggy source:
private static ReaderTagList parseTags(JSONObject jsonObject,String name,ReaderTagType topicType){
  ReaderTagList topics=new ReaderTagList();
  if (jsonObject == null)   return topics;
  JSONObject jsonTopics=jsonObject.optJSONObject(name);
  if (jsonTopics == null)   return topics;
  Iterator<String> it=jsonTopics.keys();
  while (it.hasNext()) {
    String internalName=it.next();
    JSONObject jsonTopic=jsonTopics.optJSONObject(internalName);
    if (jsonTopic != null) {
      String tagName=JSONUtil.getStringDecoded(jsonTopic,"String_Node_Str");
      String endpoint=JSONUtil.getString(jsonTopic,"String_Node_Str");
      topics.add(new ReaderTag(tagName,endpoint,topicType));
    }
  }
  return topics;
}

Fixed version (ground truth):
private static ReaderTagList parseTags(JSONObject jsonObject,String name,ReaderTagType topicType){
  ReaderTagList topics=new ReaderTagList();
  if (jsonObject == null) {
    return topics;
  }
  JSONObject jsonTopics=jsonObject.optJSONObject(name);
  if (jsonTopics == null) {
    return topics;
  }
  Iterator<String> it=jsonTopics.keys();
  while (it.hasNext()) {
    String internalName=it.next();
    JSONObject jsonTopic=jsonTopics.optJSONObject(internalName);
    if (jsonTopic != null) {
      String tagName=JSONUtil.getStringDecoded(jsonTopic,"String_Node_Str");
      String endpoint=JSONUtil.getString(jsonTopic,"String_Node_Str");
      topics.add(new ReaderTag(tagName,endpoint,topicType));
    }
  }
  return topics;
}
Program: 14628
Project: 14628
Buggy source:
private static void deleteTags(ReaderTagList topics){
  if (topics == null || topics.size() == 0)   return;
  ReaderDatabase.getWritableDb().beginTransaction();
  try {
    for (    ReaderTag topic : topics) {
      ReaderTagTable.deleteTag(topic.getTagName());
      ReaderPostTable.deletePostsWithTag(topic.getTagName());
    }
    ReaderDatabase.getWritableDb().setTransactionSuccessful();
  }
  finally {
    ReaderDatabase.getWritableDb().endTransaction();
  }
}

Fixed version (ground truth):
private static void deleteTags(ReaderTagList topics){
  if (topics == null || topics.size() == 0) {
    return;
  }
  ReaderDatabase.getWritableDb().beginTransaction();
  try {
    for (    ReaderTag topic : topics) {
      ReaderTagTable.deleteTag(topic.getTagName());
      ReaderPostTable.deletePostsWithTag(topic.getTagName());
    }
    ReaderDatabase.getWritableDb().setTransactionSuccessful();
  }
  finally {
    ReaderDatabase.getWritableDb().endTransaction();
  }
}
Program: 14629
Project: 14629
Buggy source:
static String sanitizeTitle(final String tagName){
  if (tagName == null) {
    return "String_Node_Str";
  }
  String sanitized=tagName.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str");
  while (sanitized.contains("String_Node_Str"))   sanitized=sanitized.replace("String_Node_Str","String_Node_Str");
  return sanitized.trim();
}

Fixed version (ground truth):
static String sanitizeTitle(final String tagName){
  if (tagName == null) {
    return "String_Node_Str";
  }
  String sanitized=tagName.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str");
  while (sanitized.contains("String_Node_Str")) {
    sanitized=sanitized.replace("String_Node_Str","String_Node_Str");
  }
  return sanitized.trim();
}
Program: 14630
Project: 14630
Buggy source:
public static int getImageOrientation(Context ctx,String filePath){
  Uri curStream;
  int orientation=0;
  if (!filePath.contains("String_Node_Str"))   curStream=Uri.parse("String_Node_Str" + filePath);
 else   curStream=Uri.parse(filePath);
  try {
    Cursor cur=ctx.getContentResolver().query(curStream,new String[]{MediaStore.Images.Media.ORIENTATION},null,null,null);
    if (cur != null) {
      if (cur.moveToFirst()) {
        orientation=cur.getInt(cur.getColumnIndex(MediaStore.Images.Media.ORIENTATION));
      }
      cur.close();
    }
  }
 catch (  Exception errReadingContentResolver) {
    AppLog.e(AppLog.T.UTILS,errReadingContentResolver);
  }
  if (orientation == 0) {
    orientation=getExifOrientation(filePath);
  }
  return orientation;
}

Fixed version (ground truth):
public static int getImageOrientation(Context ctx,String filePath){
  Uri curStream;
  int orientation=0;
  filePath=filePath.replace("String_Node_Str","String_Node_Str");
  if (!filePath.contains("String_Node_Str"))   curStream=Uri.parse("String_Node_Str" + filePath);
 else   curStream=Uri.parse(filePath);
  try {
    Cursor cur=ctx.getContentResolver().query(curStream,new String[]{MediaStore.Images.Media.ORIENTATION},null,null,null);
    if (cur != null) {
      if (cur.moveToFirst()) {
        orientation=cur.getInt(cur.getColumnIndex(MediaStore.Images.Media.ORIENTATION));
      }
      cur.close();
    }
  }
 catch (  Exception errReadingContentResolver) {
    AppLog.e(AppLog.T.UTILS,errReadingContentResolver);
  }
  if (orientation == 0) {
    orientation=getExifOrientation(filePath);
  }
  return orientation;
}
Program: 14632
Project: 14632
Buggy source:
public String getFeaturedImageForDisplay(int width,int height){
  if (featuredImageForDisplay == null) {
    if (!hasFeaturedImage()) {
      featuredImageForDisplay="String_Node_Str";
    }
 else     if (isPrivate) {
      featuredImageForDisplay=UrlUtils.makeHttps(featuredImage);
    }
 else {
      featuredImageForDisplay=PhotonUtils.getPhotonImageUrl(featuredImage,width,height);
    }
  }
  return featuredImageForDisplay;
}

Fixed version (ground truth):
public String getFeaturedImageForDisplay(int width,int height){
  if (featuredImageForDisplay == null) {
    if (!hasFeaturedImage()) {
      featuredImageForDisplay="String_Node_Str";
    }
 else     if (isPrivate) {
      featuredImageForDisplay=ReaderUtils.getPrivateImageForDisplay(featuredImage,width,height);
    }
 else {
      featuredImageForDisplay=PhotonUtils.getPhotonImageUrl(featuredImage,width,height);
    }
  }
  return featuredImageForDisplay;
}
Program: 14634
Project: 14634
Buggy source:
private void loadImage(String imageUrl){
  if (TextUtils.isEmpty(imageUrl)) {
    handleImageLoadFailure();
    return;
  }
  if (mIsPrivate) {
    imageUrl=UrlUtils.makeHttps(imageUrl);
  }
 else {
    Point pt=DisplayUtils.getDisplayPixelSize(this);
    int maxWidth=Math.max(pt.x,pt.y);
    imageUrl=PhotonUtils.getPhotonImageUrl(imageUrl,maxWidth,0);
  }
  final ProgressBar progress=(ProgressBar)findViewById(R.id.progress);
  progress.setVisibility(View.VISIBLE);
  final WPNetworkImageView imageView=(WPNetworkImageView)findViewById(R.id.image_photo);
  imageView.setImageUrl(imageUrl,ImageType.PHOTO_FULL,new ImageListener(){
    @Override public void onImageLoaded(    boolean succeeded){
      progress.setVisibility(View.GONE);
      if (succeeded) {
        createAttacher(imageView);
      }
 else {
        handleImageLoadFailure();
      }
    }
  }
);
}

Fixed version (ground truth):
private void loadImage(String imageUrl){
  if (TextUtils.isEmpty(imageUrl)) {
    handleImageLoadFailure();
    return;
  }
  Point pt=DisplayUtils.getDisplayPixelSize(this);
  int maxWidth=Math.max(pt.x,pt.y);
  if (mIsPrivate) {
    imageUrl=ReaderUtils.getPrivateImageForDisplay(imageUrl,maxWidth,0);
  }
 else {
    imageUrl=PhotonUtils.getPhotonImageUrl(imageUrl,maxWidth,0);
  }
  final ProgressBar progress=(ProgressBar)findViewById(R.id.progress);
  progress.setVisibility(View.VISIBLE);
  final WPNetworkImageView imageView=(WPNetworkImageView)findViewById(R.id.image_photo);
  imageView.setImageUrl(imageUrl,ImageType.PHOTO_FULL,new ImageListener(){
    @Override public void onImageLoaded(    boolean succeeded){
      progress.setVisibility(View.GONE);
      if (succeeded) {
        createAttacher(imageView);
      }
 else {
        handleImageLoadFailure();
      }
    }
  }
);
}
Program: 14636
Project: 14636
Buggy source:
private void showProgressFooter(){
  if (mProgressFooter != null || mProgressFooter.getVisibility() != View.VISIBLE) {
    mProgressFooter.setVisibility(View.VISIBLE);
  }
}

Fixed version (ground truth):
private void showProgressFooter(){
  if (mProgressFooter != null && mProgressFooter.getVisibility() != View.VISIBLE) {
    mProgressFooter.setVisibility(View.VISIBLE);
  }
}
Program: 14637
Project: 14637
Buggy source:
private void hideProgressFooter(){
  if (mProgressFooter != null || mProgressFooter.getVisibility() == View.VISIBLE) {
    mProgressFooter.setVisibility(View.INVISIBLE);
  }
}

Fixed version (ground truth):
private void hideProgressFooter(){
  if (mProgressFooter != null && mProgressFooter.getVisibility() == View.VISIBLE) {
    mProgressFooter.setVisibility(View.INVISIBLE);
  }
}
Program: 14638
Project: 14638
Buggy source:
private int indexOfBlogId(long blogId){
  for (int i=0; i < size(); i++) {
    if (this.get(i).blogId == blogId)     return i;
  }
  return -1;
}

Fixed version (ground truth):
private int indexOfBlogId(long blogId){
  for (int i=0; i < size(); i++) {
    if (this.get(i).blogId == blogId) {
      return i;
    }
  }
  return -1;
}
Program: 14639
Project: 14639
Buggy source:
private int indexOfFeedId(long feedId){
  for (int i=0; i < size(); i++) {
    if (this.get(i).feedId == feedId)     return i;
  }
  return -1;
}

Fixed version (ground truth):
private int indexOfFeedId(long feedId){
  for (int i=0; i < size(); i++) {
    if (this.get(i).feedId == feedId) {
      return i;
    }
  }
  return -1;
}
Program: 14640
Project: 14640
Buggy source:
private void restoreState(Bundle savedInstanceState){
  if (savedInstanceState != null) {
    mBlogId=savedInstanceState.getLong(ReaderConstants.ARG_BLOG_ID);
    mPostId=savedInstanceState.getLong(ReaderConstants.ARG_POST_ID);
    mHasAlreadyUpdatedPost=savedInstanceState.getBoolean(ReaderConstants.KEY_ALREADY_UPDATED);
    mHasAlreadyRequestedPost=savedInstanceState.getBoolean(ReaderConstants.KEY_ALREADY_REQUESTED);
    if (savedInstanceState.getBoolean(KEY_SHOW_COMMENT_BOX)) {
      long replyToCommentId=savedInstanceState.getLong(KEY_REPLY_TO_COMMENT_ID);
      showAddCommentBox(replyToCommentId);
    }
    mListState=savedInstanceState.getParcelable(ReaderConstants.KEY_LIST_STATE);
  }
}

Fixed version (ground truth):
private void restoreState(Bundle savedInstanceState){
  if (savedInstanceState != null) {
    mBlogId=savedInstanceState.getLong(ReaderConstants.ARG_BLOG_ID);
    mPostId=savedInstanceState.getLong(ReaderConstants.ARG_POST_ID);
    mHasAlreadyUpdatedPost=savedInstanceState.getBoolean(ReaderConstants.KEY_ALREADY_UPDATED);
    mHasAlreadyRequestedPost=savedInstanceState.getBoolean(ReaderConstants.KEY_ALREADY_REQUESTED);
    if (savedInstanceState.getBoolean(KEY_SHOW_COMMENT_BOX)) {
      long replyToCommentId=savedInstanceState.getLong(KEY_REPLY_TO_COMMENT_ID);
      showAddCommentBox(replyToCommentId);
    }
    if (savedInstanceState.containsKey(ReaderConstants.ARG_POST_LIST_TYPE)) {
      mPostListType=(ReaderPostListType)savedInstanceState.getSerializable(ReaderConstants.ARG_POST_LIST_TYPE);
    }
    mListState=savedInstanceState.getParcelable(ReaderConstants.KEY_LIST_STATE);
  }
}
Program: 14641
Project: 14641
Buggy source:
private boolean isBlogPreview(){
  return (mPostListType != null && mPostListType == ReaderTypes.ReaderPostListType.BLOG_PREVIEW);
}

Fixed version (ground truth):
private boolean isBlogPreview(){
  return (getPostListType() == ReaderTypes.ReaderPostListType.BLOG_PREVIEW);
}
Program: 14642
Project: 14642
Buggy source:
@Override public void onSaveInstanceState(Bundle outState){
  super.onSaveInstanceState(outState);
  outState.putLong(ReaderConstants.ARG_BLOG_ID,mBlogId);
  outState.putLong(ReaderConstants.ARG_POST_ID,mPostId);
  outState.putBoolean(ReaderConstants.KEY_ALREADY_UPDATED,mHasAlreadyUpdatedPost);
  outState.putBoolean(ReaderConstants.KEY_ALREADY_REQUESTED,mHasAlreadyRequestedPost);
  outState.putBoolean(KEY_SHOW_COMMENT_BOX,mIsAddCommentBoxShowing);
  if (mIsAddCommentBoxShowing) {
    outState.putLong(KEY_REPLY_TO_COMMENT_ID,mReplyToCommentId);
  }
  if (getListView() != null && getListView().getFirstVisiblePosition() > 0) {
    mListState=getListView().onSaveInstanceState();
    outState.putParcelable(ReaderConstants.KEY_LIST_STATE,mListState);
  }
 else {
    mListState=null;
  }
}

Fixed version (ground truth):
@Override public void onSaveInstanceState(Bundle outState){
  super.onSaveInstanceState(outState);
  outState.putLong(ReaderConstants.ARG_BLOG_ID,mBlogId);
  outState.putLong(ReaderConstants.ARG_POST_ID,mPostId);
  outState.putBoolean(ReaderConstants.KEY_ALREADY_UPDATED,mHasAlreadyUpdatedPost);
  outState.putBoolean(ReaderConstants.KEY_ALREADY_REQUESTED,mHasAlreadyRequestedPost);
  outState.putBoolean(KEY_SHOW_COMMENT_BOX,mIsAddCommentBoxShowing);
  outState.putSerializable(ReaderConstants.ARG_POST_LIST_TYPE,getPostListType());
  if (mIsAddCommentBoxShowing) {
    outState.putLong(KEY_REPLY_TO_COMMENT_ID,mReplyToCommentId);
  }
  if (getListView() != null && getListView().getFirstVisiblePosition() > 0) {
    mListState=getListView().onSaveInstanceState();
    outState.putParcelable(ReaderConstants.KEY_LIST_STATE,mListState);
  }
 else {
    mListState=null;
  }
}
Program: 14643
Project: 14643
Buggy source:
@Override public void run(){
  if (mReaderWebView.getVisibility() != View.VISIBLE)   AppLog.d(T.READER,"String_Node_Str");
  showContent();
}

Fixed version (ground truth):
@Override public void run(){
  showContent();
}
Program: 14644
Project: 14644
Buggy source:
@Override public void onStop(){
  super.onStop();
  if (mReaderWebView != null) {
    mReaderWebView.hideCustomView();
  }
}

Fixed version (ground truth):
@Override public void onStop(){
  super.onStop();
}
Program: 14645
Project: 14645
Buggy source:
private void showContentDelayed(){
  mHandler.postDelayed(new Runnable(){
    @Override public void run(){
      if (mReaderWebView.getVisibility() != View.VISIBLE)       AppLog.d(T.READER,"String_Node_Str");
      showContent();
    }
  }
,1000L);
}

Fixed version (ground truth):
private void showContentDelayed(){
  mHandler.postDelayed(new Runnable(){
    @Override public void run(){
      showContent();
    }
  }
,1000L);
}
Program: 14646
Project: 14646
Buggy source:
void pauseWebView(){
  if (mReaderWebView != null) {
    mReaderWebView.onPause();
  }
}

Fixed version (ground truth):
void pauseWebView(){
  if (mReaderWebView != null) {
    if (mReaderWebView.isCustomViewShowing()) {
      mReaderWebView.hideCustomView();
    }
    mReaderWebView.onPause();
  }
 else {
    AppLog.i(T.READER,"String_Node_Str");
  }
}
Program: 14647
Project: 14647
Buggy source:
@Override public void onCustomViewHidden(){
  ActionBar actionBar=getActionBar();
  if (actionBar != null) {
    actionBar.show();
  }
  pauseWebView();
}

Fixed version (ground truth):
@Override public void onCustomViewHidden(){
  ActionBar actionBar=getActionBar();
  if (actionBar != null) {
    actionBar.show();
  }
}
Program: 14649
Project: 14649
Buggy source:
@Override public Fragment getItem(int position){
  long blogId=mIdList.get(position).getBlogId();
  long postId=mIdList.get(position).getPostId();
  if (blogId == END_ID && postId == END_ID) {
    return PostPagerEndFragment.newInstance();
  }
 else {
    return ReaderPostDetailFragment.newInstance(blogId,postId,getPostListType());
  }
}

Fixed version (ground truth):
@Override public Fragment getItem(int position){
  long blogId=mIdList.get(position).getBlogId();
  long postId=mIdList.get(position).getPostId();
  Fragment fragment;
  if (blogId == END_ID && postId == END_ID) {
    fragment=PostPagerEndFragment.newInstance();
  }
 else {
    fragment=ReaderPostDetailFragment.newInstance(blogId,postId,getPostListType());
  }
  mFragmentMap.put(getItemKey(position),new WeakReference<Fragment>(fragment));
  return fragment;
}
Program: 14650
Project: 14650
Buggy source:
@Override public void onPageScrollStateChanged(int state){
  super.onPageScrollStateChanged(state);
  if (state == ViewPager.SCROLL_STATE_DRAGGING) {
    onRequestFullScreen(false);
  }
}

Fixed version (ground truth):
@Override public void onPageScrollStateChanged(int state){
  super.onPageScrollStateChanged(state);
  if (state == ViewPager.SCROLL_STATE_DRAGGING) {
    onRequestFullScreen(false);
    ReaderPostDetailFragment fragment=getActiveDetailFragment();
    if (fragment != null) {
      fragment.pauseWebView();
    }
  }
}
Program: 14651
Project: 14651
Buggy source:
void setCurrentTag(final String tagName){
  if (TextUtils.isEmpty(tagName)) {
    return;
  }
  if (isCurrentTag(tagName) && hasPostAdapter() && tagName.equals(getPostAdapter().getCurrentTag())) {
    return;
  }
  mCurrentTag=tagName;
  if (getPostListType().equals(ReaderTypes.ReaderPostListType.TAG_FOLLOWED)) {
    UserPrefs.setReaderTag(tagName);
  }
  getPostAdapter().setCurrentTag(tagName);
  hideNewPostsBar();
  updateTagPreviewHeader();
  if (ReaderTagTable.shouldAutoUpdateTag(tagName)) {
    updatePostsWithTag(tagName,RequestDataAction.LOAD_NEWER,ReaderTypes.RefreshType.AUTOMATIC);
  }
}

Fixed version (ground truth):
void setCurrentTag(final String tagName){
  if (TextUtils.isEmpty(tagName)) {
    return;
  }
  if (isCurrentTag(tagName) && hasPostAdapter() && tagName.equals(getPostAdapter().getCurrentTag())) {
    return;
  }
  mCurrentTag=tagName;
  if (getPostListType().equals(ReaderTypes.ReaderPostListType.TAG_FOLLOWED)) {
    UserPrefs.setReaderTag(tagName);
  }
  getPostAdapter().setCurrentTag(tagName);
  hideNewPostsBar();
  updateTagPreviewHeader();
  hideLoadingProgress();
  if (ReaderTagTable.shouldAutoUpdateTag(tagName)) {
    updatePostsWithTag(tagName,RequestDataAction.LOAD_NEWER,ReaderTypes.RefreshType.AUTOMATIC);
  }
}
Program: 14653
Project: 14653
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;
    }
  }
  Intent intent=new Intent(this,StatsService.class);
  intent.putExtra(StatsService.ARG_BLOG_ID,blogId);
  startService(intent);
}

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 Blog currentBlog=WordPress.getCurrentBlog();
  if (currentBlog == null) {
    mPullToRefreshHelper.setRefreshing(false);
    AppLog.w(T.STATS,"String_Node_Str");
    return;
  }
  final String blogId=getBlogId();
  if (blogId != null) {
    if (!WordPress.getCurrentBlog().isDotcomFlag() && !WordPress.getCurrentBlog().hasValidJetpackCredentials() && mResultCode != RESULT_CANCELED) {
      if (WordPress.hasValidWPComCredentials(this)) {
        SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(this);
        String username=settings.getString(WordPress.WPCOM_USERNAME_PREFERENCE,null);
        String password=WordPressDB.decryptPassword(settings.getString(WordPress.WPCOM_PASSWORD_PREFERENCE,null));
        WordPress.getCurrentBlog().setDotcom_username(username);
        WordPress.getCurrentBlog().setDotcom_password(password);
        WordPress.wpDB.saveBlog(WordPress.getCurrentBlog());
        mPullToRefreshHelper.setRefreshing(true);
      }
 else {
        startWPComLoginActivity();
        return;
      }
    }
  }
 else {
    if (!currentBlog.isDotcomFlag()) {
      new ApiHelper.RefreshBlogContentTask(this,currentBlog,new VerifyJetpackSettingsCallback(StatsActivity.this)).execute(false);
    }
 else {
      Toast.makeText(this,R.string.error_refresh_stats,Toast.LENGTH_LONG).show();
      AppLog.e(T.STATS,"String_Node_Str" + currentBlog.getHomeURL());
    }
    return;
  }
  if (!currentBlog.isDotcomFlag() && !currentBlog.hasValidJetpackCredentials() && !WordPress.hasValidWPComCredentials(this)) {
    mPullToRefreshHelper.setRefreshing(false);
    AppLog.w(T.STATS,"String_Node_Str");
    return;
  }
  Intent intent=new Intent(this,StatsService.class);
  intent.putExtra(StatsService.ARG_BLOG_ID,blogId);
  startService(intent);
}
Program: 14654
Project: 14654
Buggy source:
String getBlogId(){
  Blog currentBlog=WordPress.getCurrentBlog();
  if (currentBlog.isDotcomFlag() && !dotComCredentialsMatch()) {
    return String.valueOf(currentBlog.getRemoteBlogId());
  }
  return currentBlog.getApi_blogid();
}

Fixed version (ground truth):
/** 
 * Return the remote blogId as stored on the wpcom backend. <p> blogId is always available for dotcom blogs. It could be null on Jetpack blogs with blogOptions still empty or when the option 'jetpack_client_id' is not available in blogOptions. </p>
 * @return String  blogId or null
 */
String getBlogId(){
  Blog currentBlog=WordPress.getCurrentBlog();
  if (currentBlog.isDotcomFlag()) {
    return String.valueOf(currentBlog.getRemoteBlogId());
  }
 else {
    return currentBlog.getApi_blogid();
  }
}
Program: 14655
Project: 14655
Buggy source:
@Override protected void onResume(){
  super.onResume();
  mPullToRefreshHelper.registerReceiver(this);
  mIsInFront=true;
  LocalBroadcastManager lbm=LocalBroadcastManager.getInstance(this);
  lbm.registerReceiver(mReceiver,new IntentFilter(StatsService.ACTION_STATS_UPDATING));
  if (WordPress.getCurrentBlog() != null && !WordPress.getCurrentBlog().isDotcomFlag() && !WordPress.getCurrentBlog().hasValidJetpackCredentials() && mResultCode != RESULT_CANCELED) {
    if (WordPress.hasValidWPComCredentials(this)) {
      SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(this);
      String username=settings.getString(WordPress.WPCOM_USERNAME_PREFERENCE,null);
      String password=WordPressDB.decryptPassword(settings.getString(WordPress.WPCOM_PASSWORD_PREFERENCE,null));
      WordPress.getCurrentBlog().setDotcom_username(username);
      WordPress.getCurrentBlog().setDotcom_password(password);
      WordPress.wpDB.saveBlog(WordPress.getCurrentBlog());
      mPullToRefreshHelper.setRefreshing(true);
      refreshStats();
    }
 else {
      startWPComLoginActivity();
    }
    return;
  }
  if (!mIsRestoredFromState) {
    mPullToRefreshHelper.setRefreshing(true);
    refreshStats();
  }
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  mPullToRefreshHelper.registerReceiver(this);
  mIsInFront=true;
  LocalBroadcastManager lbm=LocalBroadcastManager.getInstance(this);
  lbm.registerReceiver(mReceiver,new IntentFilter(StatsService.ACTION_STATS_UPDATING));
  if (!mIsRestoredFromState) {
    mPullToRefreshHelper.setRefreshing(true);
    refreshStats();
  }
}
Program: 14656
Project: 14656
Buggy source:
public void addSuperPropertyToFlag(String superPropertyToFlag){
  if (!mSuperPropertiesToFlag.contains(superPropertyToFlag)) {
    mSuperPropertiesToFlag.add(superPropertyToFlag);
  }
}

Fixed version (ground truth):
public void addSuperPropertyToFlag(String superPropertyToFlag){
  if (mSuperPropertiesToFlag == null) {
    mSuperPropertiesToFlag=new ArrayList<String>();
  }
  if (!mSuperPropertiesToFlag.contains(superPropertyToFlag)) {
    mSuperPropertiesToFlag.add(superPropertyToFlag);
  }
}
Program: 14659
Project: 14659
Buggy source:
private void loadMshotImage(final ReaderBlogInfo blogInfo){
  if (blogInfo == null || !blogInfo.hasUrl()) {
    hideProgress();
    return;
  }
  if (blogInfo.isPrivate) {
    hideProgress();
    mImageMshot.setImageType(WPNetworkImageView.ImageType.MSHOT);
    mImageMshot.showErrorImage();
    return;
  }
  WPNetworkImageView.ImageListener imageListener=new WPNetworkImageView.ImageListener(){
    @Override public void onImageLoaded(    boolean succeeded){
      hideProgress();
    }
  }
;
  final String imageUrl=blogInfo.getMshotsUrl(mMshotWidth);
  mImageMshot.setImageUrl(imageUrl,WPNetworkImageView.ImageType.MSHOT,imageListener);
}

Fixed version (ground truth):
private void loadMshotImage(final ReaderBlogInfo blogInfo){
  if (blogInfo == null || !blogInfo.hasUrl()) {
    hideProgress();
    return;
  }
  if (blogInfo.isPrivate) {
    hideProgress();
    mImageMshot.setScaleType(ImageView.ScaleType.CENTER);
    mImageMshot.setImageResource(R.drawable.dashicon_lock);
    return;
  }
  WPNetworkImageView.ImageListener imageListener=new WPNetworkImageView.ImageListener(){
    @Override public void onImageLoaded(    boolean succeeded){
      hideProgress();
    }
  }
;
  final String imageUrl=blogInfo.getMshotsUrl(mMshotWidth);
  mImageMshot.setImageUrl(imageUrl,WPNetworkImageView.ImageType.MSHOT,imageListener);
}