nus-yam/ex-repair huggingface dataset:
Program: 14478
Project: 14478
Buggy source:
public ReferrersModel(String blogID,JSONObject response) throws JSONException {
  this.mBlogID=blogID;
  this.mPeriod=response.getString("String_Node_Str");
  this.mDate=response.getString("String_Node_Str");
  JSONObject jDaysObject=response.getJSONObject("String_Node_Str");
  if (jDaysObject.length() == 0) {
    throw new JSONException("String_Node_Str");
  }
  JSONArray jGroupsArray;
  Iterator<String> keys=jDaysObject.keys();
  String key=keys.next();
  JSONObject firstDayObject=jDaysObject.getJSONObject(key);
  this.mOtherViews=firstDayObject.optInt("String_Node_Str");
  this.mTotalViews=firstDayObject.optInt("String_Node_Str");
  jGroupsArray=firstDayObject.optJSONArray("String_Node_Str");
  if (jGroupsArray != null) {
    mGroups=new ArrayList<ReferrerGroupModel>(jGroupsArray.length());
    for (int i=0; i < jGroupsArray.length(); i++) {
      try {
        JSONObject currentGroupJSON=jGroupsArray.getJSONObject(i);
        ReferrerGroupModel currentGroupModel=new ReferrerGroupModel(blogID,mDate,currentGroupJSON);
        mGroups.add(currentGroupModel);
      }
 catch (      JSONException e) {
        AppLog.e(AppLog.T.STATS,"String_Node_Str" + "String_Node_Str" + i + "String_Node_Str"+ response.toString(),e);
      }
    }
  }
}

Fixed version (ground truth):
public ReferrersModel(String blogID,JSONObject response) throws JSONException {
  this.mBlogID=blogID;
  this.mPeriod=response.getString("String_Node_Str");
  this.mDate=response.getString("String_Node_Str");
  JSONObject jDaysObject=response.getJSONObject("String_Node_Str");
  if (jDaysObject.length() == 0) {
    throw new JSONException("String_Node_Str");
  }
  JSONArray jGroupsArray;
  Iterator<String> keys=jDaysObject.keys();
  String key=keys.next();
  JSONObject firstDayObject=jDaysObject.getJSONObject(key);
  this.mOtherViews=firstDayObject.optInt("String_Node_Str");
  this.mTotalViews=firstDayObject.optInt("String_Node_Str");
  jGroupsArray=firstDayObject.optJSONArray("String_Node_Str");
  if (jGroupsArray != null) {
    mGroups=new ArrayList<>(jGroupsArray.length());
    for (int i=0; i < jGroupsArray.length(); i++) {
      try {
        JSONObject currentGroupJSON=jGroupsArray.getJSONObject(i);
        ReferrerGroupModel currentGroupModel=new ReferrerGroupModel(blogID,mDate,currentGroupJSON);
        mGroups.add(currentGroupModel);
      }
 catch (      JSONException e) {
        AppLog.e(AppLog.T.STATS,"String_Node_Str" + "String_Node_Str" + i + "String_Node_Str"+ response.toString(),e);
      }
    }
  }
}
Program: 14479
Project: 14479
Buggy source:
public TagsContainerModel(String blogID,JSONObject response) throws JSONException {
  this.mBlogID=blogID;
  this.mDate=response.getString("String_Node_Str");
  JSONArray outerTags=response.getJSONArray("String_Node_Str");
  if (outerTags != null) {
    mTags=new ArrayList<TagsModel>(outerTags.length());
    for (int i=0; i < outerTags.length(); i++) {
      JSONObject current=outerTags.getJSONObject(i);
      mTags.add(new TagsModel(current));
    }
  }
}

Fixed version (ground truth):
public TagsContainerModel(String blogID,JSONObject response) throws JSONException {
  this.mBlogID=blogID;
  this.mDate=response.getString("String_Node_Str");
  JSONArray outerTags=response.getJSONArray("String_Node_Str");
  if (outerTags != null) {
    mTags=new ArrayList<>(outerTags.length());
    for (int i=0; i < outerTags.length(); i++) {
      JSONObject current=outerTags.getJSONObject(i);
      mTags.add(new TagsModel(current));
    }
  }
}
Program: 14480
Project: 14480
Buggy source:
public TagsModel(JSONObject responseJSON) throws JSONException {
  this.mViews=responseJSON.getInt("String_Node_Str");
  JSONArray innerTagsJSON=responseJSON.getJSONArray("String_Node_Str");
  mTags=new ArrayList<TagModel>(innerTagsJSON.length());
  for (int i=0; i < innerTagsJSON.length(); i++) {
    JSONObject currentTagJSON=innerTagsJSON.getJSONObject(i);
    TagModel currentTag=new TagModel(currentTagJSON);
    mTags.add(currentTag);
  }
}

Fixed version (ground truth):
public TagsModel(JSONObject responseJSON) throws JSONException {
  this.mViews=responseJSON.getInt("String_Node_Str");
  JSONArray innerTagsJSON=responseJSON.getJSONArray("String_Node_Str");
  mTags=new ArrayList<>(innerTagsJSON.length());
  for (int i=0; i < innerTagsJSON.length(); i++) {
    JSONObject currentTagJSON=innerTagsJSON.getJSONObject(i);
    TagModel currentTag=new TagModel(currentTagJSON);
    mTags.add(currentTag);
  }
}
Program: 14481
Project: 14481
Buggy source:
public TopPostsAndPagesModel(String blogID,JSONObject response) throws JSONException {
  this.mBlogID=blogID;
  this.mPeriod=response.getString("String_Node_Str");
  this.mDate=response.getString("String_Node_Str");
  JSONArray postViewsArray=null;
  JSONObject jDaysObject=response.getJSONObject("String_Node_Str");
  if (jDaysObject.length() == 0) {
    throw new JSONException("String_Node_Str");
  }
  Iterator<String> keys=jDaysObject.keys();
  if (keys.hasNext()) {
    String key=keys.next();
    JSONObject jDateObject=jDaysObject.optJSONObject(key);
    postViewsArray=(jDateObject != null) ? jDateObject.getJSONArray("String_Node_Str") : null;
  }
  if (postViewsArray == null) {
    postViewsArray=new JSONArray();
  }
  ArrayList<SingleItemModel> list=new ArrayList<SingleItemModel>(postViewsArray.length());
  for (int i=0; i < postViewsArray.length(); i++) {
    try {
      JSONObject postObject=postViewsArray.getJSONObject(i);
      String itemID=postObject.getString("String_Node_Str");
      String itemTitle=postObject.getString("String_Node_Str");
      int itemTotal=postObject.getInt("String_Node_Str");
      String itemURL=postObject.getString("String_Node_Str");
      SingleItemModel currentModel=new SingleItemModel(blogID,mDate,itemID,itemTitle,itemTotal,itemURL,null);
      list.add(currentModel);
    }
 catch (    JSONException e) {
      AppLog.e(AppLog.T.STATS,"String_Node_Str" + "String_Node_Str" + i + "String_Node_Str"+ response.toString(),e);
    }
  }
  this.mTopPostsAndPages=list;
}

Fixed version (ground truth):
public TopPostsAndPagesModel(String blogID,JSONObject response) throws JSONException {
  this.mBlogID=blogID;
  this.mPeriod=response.getString("String_Node_Str");
  this.mDate=response.getString("String_Node_Str");
  JSONArray postViewsArray=null;
  JSONObject jDaysObject=response.getJSONObject("String_Node_Str");
  if (jDaysObject.length() == 0) {
    throw new JSONException("String_Node_Str");
  }
  Iterator<String> keys=jDaysObject.keys();
  if (keys.hasNext()) {
    String key=keys.next();
    JSONObject jDateObject=jDaysObject.optJSONObject(key);
    postViewsArray=(jDateObject != null) ? jDateObject.getJSONArray("String_Node_Str") : null;
  }
  if (postViewsArray == null) {
    postViewsArray=new JSONArray();
  }
  ArrayList<SingleItemModel> list=new ArrayList<>(postViewsArray.length());
  for (int i=0; i < postViewsArray.length(); i++) {
    try {
      JSONObject postObject=postViewsArray.getJSONObject(i);
      String itemID=postObject.getString("String_Node_Str");
      String itemTitle=postObject.getString("String_Node_Str");
      int itemTotal=postObject.getInt("String_Node_Str");
      String itemURL=postObject.getString("String_Node_Str");
      SingleItemModel currentModel=new SingleItemModel(blogID,mDate,itemID,itemTitle,itemTotal,itemURL,null);
      list.add(currentModel);
    }
 catch (    JSONException e) {
      AppLog.e(AppLog.T.STATS,"String_Node_Str" + "String_Node_Str" + i + "String_Node_Str"+ response.toString(),e);
    }
  }
  this.mTopPostsAndPages=list;
}
Program: 14482
Project: 14482
Buggy source:
public VideoPlaysModel(String blogID,JSONObject response) throws JSONException {
  this.mBlogID=blogID;
  this.mPeriod=response.getString("String_Node_Str");
  this.mDate=response.getString("String_Node_Str");
  JSONObject jDaysObject=response.getJSONObject("String_Node_Str");
  if (jDaysObject.length() == 0) {
    throw new JSONException("String_Node_Str");
  }
  Iterator<String> keys=jDaysObject.keys();
  String key=keys.next();
  JSONObject firstDayObject=jDaysObject.getJSONObject(key);
  this.mOtherPlays=firstDayObject.getInt("String_Node_Str");
  this.mTotalPlays=firstDayObject.getInt("String_Node_Str");
  JSONArray playsJSONArray=firstDayObject.optJSONArray("String_Node_Str");
  if (playsJSONArray != null) {
    mPlays=new ArrayList<SingleItemModel>(playsJSONArray.length());
    for (int i=0; i < playsJSONArray.length(); i++) {
      JSONObject currentVideoplaysJSON=playsJSONArray.getJSONObject(i);
      String postId=String.valueOf(currentVideoplaysJSON.getInt("String_Node_Str"));
      String title=currentVideoplaysJSON.getString("String_Node_Str");
      int views=currentVideoplaysJSON.getInt("String_Node_Str");
      String url=currentVideoplaysJSON.getString("String_Node_Str");
      SingleItemModel currentPost=new SingleItemModel(blogID,mDate,postId,title,views,url,null);
      mPlays.add(currentPost);
    }
  }
}

Fixed version (ground truth):
public VideoPlaysModel(String blogID,JSONObject response) throws JSONException {
  this.mBlogID=blogID;
  this.mPeriod=response.getString("String_Node_Str");
  this.mDate=response.getString("String_Node_Str");
  JSONObject jDaysObject=response.getJSONObject("String_Node_Str");
  if (jDaysObject.length() == 0) {
    throw new JSONException("String_Node_Str");
  }
  Iterator<String> keys=jDaysObject.keys();
  String key=keys.next();
  JSONObject firstDayObject=jDaysObject.getJSONObject(key);
  this.mOtherPlays=firstDayObject.getInt("String_Node_Str");
  this.mTotalPlays=firstDayObject.getInt("String_Node_Str");
  JSONArray playsJSONArray=firstDayObject.optJSONArray("String_Node_Str");
  if (playsJSONArray != null) {
    mPlays=new ArrayList<>(playsJSONArray.length());
    for (int i=0; i < playsJSONArray.length(); i++) {
      JSONObject currentVideoplaysJSON=playsJSONArray.getJSONObject(i);
      String postId=String.valueOf(currentVideoplaysJSON.getInt("String_Node_Str"));
      String title=currentVideoplaysJSON.getString("String_Node_Str");
      int views=currentVideoplaysJSON.getInt("String_Node_Str");
      String url=currentVideoplaysJSON.getString("String_Node_Str");
      SingleItemModel currentPost=new SingleItemModel(blogID,mDate,postId,title,views,url,null);
      mPlays.add(currentPost);
    }
  }
}
Program: 14484
Project: 14484
Buggy source:
@Override public void onRefreshStarted(){
  if (!NetworkUtils.checkConnection(getBaseContext())) {
    mSwipeToRefreshHelper.setRefreshing(false);
    return;
  }
  if (mIsUpdatingStats) {
    AppLog.w(T.STATS,"String_Node_Str");
    return;
  }
  loadStatsFragments(true,true,true);
  refreshStats(mCurrentTimeframe,StatsUtils.getCurrentDateTZ(mLocalBlogID),true);
}

Fixed version (ground truth):
@Override public void onRefreshStarted(){
  if (!NetworkUtils.checkConnection(getBaseContext())) {
    mSwipeToRefreshHelper.setRefreshing(false);
    return;
  }
  if (mIsUpdatingStats) {
    AppLog.w(T.STATS,"String_Node_Str");
    return;
  }
  mRequestedDate=StatsUtils.getCurrentDateTZ(mLocalBlogID);
  loadStatsFragments(true,true,true);
  refreshStats(mCurrentTimeframe,mRequestedDate,true);
}
Program: 14486
Project: 14486
Buggy source:
private static String getCurrentDateTimeTZ(String blogTimeZoneOption,String pattern){
  Date date=new Date();
  SimpleDateFormat gmtDf=new SimpleDateFormat(pattern);
  if (blogTimeZoneOption == null) {
    AppLog.w(T.UTILS,"String_Node_Str");
    return gmtDf.format(date);
  }
  if (blogTimeZoneOption.equals("String_Node_Str")) {
    gmtDf.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
  }
 else   if (blogTimeZoneOption.startsWith("String_Node_Str")) {
    gmtDf.setTimeZone(TimeZone.getTimeZone("String_Node_Str" + blogTimeZoneOption));
  }
 else {
    if (blogTimeZoneOption.startsWith("String_Node_Str")) {
      gmtDf.setTimeZone(TimeZone.getTimeZone("String_Node_Str" + blogTimeZoneOption));
    }
 else {
      gmtDf.setTimeZone(TimeZone.getTimeZone("String_Node_Str" + blogTimeZoneOption));
    }
  }
  return gmtDf.format(date);
}

Fixed version (ground truth):
private static String getCurrentDateTimeTZ(String blogTimeZoneOption,String pattern){
  Date date=new Date();
  SimpleDateFormat gmtDf=new SimpleDateFormat(pattern);
  if (blogTimeZoneOption == null) {
    AppLog.w(T.UTILS,"String_Node_Str");
    return gmtDf.format(date);
  }
  AppLog.d(T.STATS,"String_Node_Str" + blogTimeZoneOption);
  String timezoneNormalized;
  if (blogTimeZoneOption.equals("String_Node_Str") || blogTimeZoneOption.equals("String_Node_Str")) {
    timezoneNormalized="String_Node_Str";
  }
 else {
    String[] timezoneSplitted=org.apache.commons.lang.StringUtils.split(blogTimeZoneOption,"String_Node_Str");
    timezoneNormalized=timezoneSplitted[0];
    if (timezoneSplitted.length > 1 && timezoneSplitted[1].equals("String_Node_Str")) {
      timezoneNormalized+="String_Node_Str";
    }
    if (timezoneNormalized.startsWith("String_Node_Str")) {
      timezoneNormalized="String_Node_Str" + timezoneNormalized;
    }
 else {
      if (timezoneNormalized.startsWith("String_Node_Str")) {
        timezoneNormalized="String_Node_Str" + timezoneNormalized;
      }
 else {
        timezoneNormalized="String_Node_Str" + timezoneNormalized;
      }
    }
  }
  AppLog.d(T.STATS,"String_Node_Str" + timezoneNormalized);
  gmtDf.setTimeZone(TimeZone.getTimeZone(timezoneNormalized));
  return gmtDf.format(date);
}
Program: 14488
Project: 14488
Buggy source:
private String getRestPath(StatsService.StatsEndpointsEnum restEndpoint,int pageNumber){
  final String blogId=StatsUtils.getBlogId(mLocalBlogID);
  String endpointPath="String_Node_Str";
switch (restEndpoint) {
case TOP_POSTS:
    endpointPath="String_Node_Str";
  break;
case REFERRERS:
endpointPath="String_Node_Str";
break;
case CLICKS:
endpointPath="String_Node_Str";
break;
case GEO_VIEWS:
endpointPath="String_Node_Str";
break;
case AUTHORS:
endpointPath="String_Node_Str";
break;
case VIDEO_PLAYS:
endpointPath="String_Node_Str";
break;
case COMMENTS:
endpointPath="String_Node_Str";
break;
case TAGS_AND_CATEGORIES:
endpointPath="String_Node_Str";
break;
case PUBLICIZE:
endpointPath="String_Node_Str";
break;
case FOLLOWERS_WPCOM:
endpointPath="String_Node_Str";
return String.format("String_Node_Str",blogId,endpointPath,mTimeframe.getLabelForRestCall(),mDate,MAX_RESULT_PER_PAGE,pageNumber);
case FOLLOWERS_EMAIL:
endpointPath="String_Node_Str";
return String.format("String_Node_Str",blogId,endpointPath,mTimeframe.getLabelForRestCall(),mDate,MAX_RESULT_PER_PAGE,pageNumber);
case COMMENT_FOLLOWERS:
endpointPath="String_Node_Str";
return String.format("String_Node_Str",blogId,endpointPath,mTimeframe.getLabelForRestCall(),mDate,MAX_RESULT_PER_PAGE,1);
}
int numberOfItemsToLoad=100;
return String.format("String_Node_Str",blogId,endpointPath,mTimeframe.getLabelForRestCall(),mDate,numberOfItemsToLoad);
}

Fixed version (ground truth):
private String getRestPath(StatsService.StatsEndpointsEnum restEndpoint,int pageNumber){
  final String blogId=StatsUtils.getBlogId(mLocalBlogID);
  String endpointPath="String_Node_Str";
switch (restEndpoint) {
case TOP_POSTS:
    endpointPath="String_Node_Str";
  break;
case REFERRERS:
endpointPath="String_Node_Str";
break;
case CLICKS:
endpointPath="String_Node_Str";
break;
case GEO_VIEWS:
endpointPath="String_Node_Str";
break;
case AUTHORS:
endpointPath="String_Node_Str";
break;
case VIDEO_PLAYS:
endpointPath="String_Node_Str";
break;
case COMMENTS:
endpointPath="String_Node_Str";
break;
case TAGS_AND_CATEGORIES:
endpointPath="String_Node_Str";
break;
case PUBLICIZE:
endpointPath="String_Node_Str";
break;
case FOLLOWERS_WPCOM:
endpointPath="String_Node_Str";
return String.format("String_Node_Str",blogId,endpointPath,mTimeframe.getLabelForRestCall(),mDate,MAX_RESULTS_PER_PAGE,pageNumber);
case FOLLOWERS_EMAIL:
endpointPath="String_Node_Str";
return String.format("String_Node_Str",blogId,endpointPath,mTimeframe.getLabelForRestCall(),mDate,MAX_RESULTS_PER_PAGE,pageNumber);
case COMMENT_FOLLOWERS:
endpointPath="String_Node_Str";
return String.format("String_Node_Str",blogId,endpointPath,mTimeframe.getLabelForRestCall(),mDate,MAX_RESULTS_PER_PAGE,1);
}
return String.format("String_Node_Str",blogId,endpointPath,mTimeframe.getLabelForRestCall(),mDate,MAX_RESULTS_REQUESTED);
}
Program: 14489
Project: 14489
Buggy source:
@Override public View getChildView(int groupPosition,final int childPosition,boolean isLastChild,View convertView,ViewGroup parent){
  final SingleItemModel children=(SingleItemModel)getChild(groupPosition,childPosition);
  if (convertView == null) {
    convertView=inflater.inflate(R.layout.stats_list_cell,parent,false);
    StatsViewHolder viewHolder=new StatsViewHolder(convertView);
    convertView.setTag(viewHolder);
  }
  final StatsViewHolder holder=(StatsViewHolder)convertView.getTag();
  String name=children.getTitle();
  int total=children.getTotals();
  holder.setEntryTextOrLink(name,name);
  holder.totalsTextView.setText(FormatUtils.formatDecimal(total));
  holder.networkImageView.setVisibility(View.GONE);
  if (StringUtils.isNotBlank(children.getUrl())) {
    holder.imgMore.setVisibility(View.VISIBLE);
    holder.imgMore.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View view){
        PopupMenu popup=new PopupMenu(activity,view);
        MenuItem menuItem=popup.getMenu().add(getString(R.string.view_in_browser));
        menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener(){
          @Override public boolean onMenuItemClick(          MenuItem item){
            WPWebViewActivity.openURL(activity,children.getUrl());
            return true;
          }
        }
);
        popup.show();
      }
    }
);
  }
  return convertView;
}

Fixed version (ground truth):
@Override public View getChildView(int groupPosition,final int childPosition,boolean isLastChild,View convertView,ViewGroup parent){
  final SingleItemModel children=(SingleItemModel)getChild(groupPosition,childPosition);
  if (convertView == null) {
    convertView=inflater.inflate(R.layout.stats_list_cell,parent,false);
    StatsViewHolder viewHolder=new StatsViewHolder(convertView);
    convertView.setTag(viewHolder);
  }
  final StatsViewHolder holder=(StatsViewHolder)convertView.getTag();
  String name=children.getTitle();
  int total=children.getTotals();
  String icon=children.getIcon();
  holder.setEntryTextOrLink(children.getUrl(),name);
  holder.totalsTextView.setText(FormatUtils.formatDecimal(total));
  holder.networkImageView.setVisibility(View.GONE);
  holder.imgMore.setVisibility(View.GONE);
  return convertView;
}
Program: 14490
Project: 14490
Buggy source:
public ReferrerGroupModel(String blogId,String date,JSONObject groupJSON) throws JSONException {
  setBlogId(blogId);
  setDate(StatsUtils.toMs(date));
  setGroupId(groupJSON.getString("String_Node_Str"));
  setName(groupJSON.getString("String_Node_Str"));
  setTotal(groupJSON.getInt("String_Node_Str"));
  if (groupJSON.has("String_Node_Str") && !groupJSON.getString("String_Node_Str").equals("String_Node_Str")) {
    setIcon(groupJSON.getString("String_Node_Str"));
  }
  if (groupJSON.has("String_Node_Str") && !groupJSON.getString("String_Node_Str").equals("String_Node_Str")) {
    setUrl(groupJSON.getString("String_Node_Str"));
  }
 else {
    JSONArray resultsJSON=groupJSON.getJSONArray("String_Node_Str");
    mResults=new ArrayList<SingleItemModel>(resultsJSON.length());
    for (int i=0; i < resultsJSON.length(); i++) {
      JSONObject currentResultJSON=resultsJSON.getJSONObject(i);
      String name=currentResultJSON.getString("String_Node_Str");
      int totals=currentResultJSON.getInt("String_Node_Str");
      String icon=currentResultJSON.optString("String_Node_Str");
      SingleItemModel rm=new SingleItemModel(blogId,date,null,name,totals,null,icon);
      mResults.add(rm);
    }
  }
}

Fixed version (ground truth):
public ReferrerGroupModel(String blogId,String date,JSONObject groupJSON) throws JSONException {
  setBlogId(blogId);
  setDate(StatsUtils.toMs(date));
  setGroupId(groupJSON.getString("String_Node_Str"));
  setName(groupJSON.getString("String_Node_Str"));
  setTotal(groupJSON.getInt("String_Node_Str"));
  if (groupJSON.has("String_Node_Str") && !groupJSON.getString("String_Node_Str").equals("String_Node_Str")) {
    setIcon(groupJSON.getString("String_Node_Str"));
  }
  if (groupJSON.has("String_Node_Str") && !groupJSON.getString("String_Node_Str").equals("String_Node_Str")) {
    setUrl(groupJSON.getString("String_Node_Str"));
  }
 else {
    JSONArray resultsJSON=groupJSON.getJSONArray("String_Node_Str");
    mResults=new ArrayList<>();
    for (int i=0; i < resultsJSON.length(); i++) {
      JSONObject currentResultJSON=resultsJSON.getJSONObject(i);
      if (currentResultJSON.has("String_Node_Str")) {
        JSONArray currentResultChildensJSON=currentResultJSON.getJSONArray("String_Node_Str");
        for (int j=0; j < currentResultChildensJSON.length(); j++) {
          JSONObject currentChild=currentResultChildensJSON.getJSONObject(j);
          mResults.add(getChildren(blogId,date,currentChild));
        }
      }
 else {
        mResults.add(getChildren(blogId,date,currentResultJSON));
      }
    }
    Collections.sort(mResults,new java.util.Comparator<SingleItemModel>(){
      public int compare(      SingleItemModel o1,      SingleItemModel o2){
        return o2.getTotals() - o1.getTotals();
      }
    }
);
  }
}
Program: 14491
Project: 14491
Buggy source:
@Override public int getItemCount(){
switch (getBlogType()) {
case RECOMMENDED:
    return mRecommendedBlogs.size() + 1;
case FOLLOWED:
  return mFollowedBlogs.size();
default :
return 0;
}
}

Fixed version (ground truth):
@Override public int getItemCount(){
switch (getBlogType()) {
case RECOMMENDED:
    if (mRecommendedBlogs.size() == 0) {
      return 0;
    }
 else {
      return mRecommendedBlogs.size() + 1;
    }
case FOLLOWED:
  return mFollowedBlogs.size();
default :
return 0;
}
}
Program: 14492
Project: 14492
Buggy source:
private void changeFollowStatus(final TextView textView,final int position,final boolean isAskingToFollow){
  if (position >= getBlogCount()) {
    return;
  }
  final long blogId;
  final String blogUrl;
switch (getBlogType()) {
case RECOMMENDED:
    ReaderRecommendedBlog blog=mRecommendedBlogs.get(position);
  blogId=blog.blogId;
blogUrl=blog.getBlogUrl();
break;
case FOLLOWED:
if (position >= mRecommendedBlogs.size()) {
return;
}
ReaderBlog info=mFollowedBlogs.get(position);
blogId=info.blogId;
blogUrl=info.getUrl();
break;
default :
return;
}
ReaderActions.ActionListener actionListener=new ReaderActions.ActionListener(){
@Override public void onActionResult(boolean succeeded){
Context context=textView.getContext();
if (!succeeded && context != null) {
int resId=(isAskingToFollow ? R.string.reader_toast_err_follow_blog : R.string.reader_toast_err_unfollow_blog);
ToastUtils.showToast(context,resId);
ReaderUtils.showFollowStatus(textView,!isAskingToFollow);
checkFollowStatus();
}
}
}
;
if (ReaderBlogActions.performFollowAction(blogId,blogUrl,isAskingToFollow,actionListener)) {
if (getBlogType() == ReaderBlogType.FOLLOWED) {
mFollowedBlogs.get(position).isFollowing=isAskingToFollow;
}
notifyItemChanged(position);
if (mFollowListener != null) {
mFollowListener.onFollowBlogChanged();
}
}
}

Fixed version (ground truth):
private void changeFollowStatus(final TextView textView,final int position,final boolean isAskingToFollow){
  if (getItemViewType(position) != VIEW_TYPE_ITEM) {
    return;
  }
  final long blogId;
  final String blogUrl;
switch (getBlogType()) {
case RECOMMENDED:
    ReaderRecommendedBlog blog=mRecommendedBlogs.get(position);
  blogId=blog.blogId;
blogUrl=blog.getBlogUrl();
break;
case FOLLOWED:
if (position >= mRecommendedBlogs.size()) {
return;
}
ReaderBlog info=mFollowedBlogs.get(position);
blogId=info.blogId;
blogUrl=info.getUrl();
break;
default :
return;
}
ReaderActions.ActionListener actionListener=new ReaderActions.ActionListener(){
@Override public void onActionResult(boolean succeeded){
Context context=textView.getContext();
if (!succeeded && context != null) {
int resId=(isAskingToFollow ? R.string.reader_toast_err_follow_blog : R.string.reader_toast_err_unfollow_blog);
ToastUtils.showToast(context,resId);
ReaderUtils.showFollowStatus(textView,!isAskingToFollow);
checkFollowStatus();
}
}
}
;
if (ReaderBlogActions.performFollowAction(blogId,blogUrl,isAskingToFollow,actionListener)) {
if (getBlogType() == ReaderBlogType.FOLLOWED) {
mFollowedBlogs.get(position).isFollowing=isAskingToFollow;
}
notifyItemChanged(position);
if (mFollowListener != null) {
mFollowListener.onFollowBlogChanged();
}
}
}
Program: 14493
Project: 14493
Buggy source:
public void refresh(){
  if (mIsTaskRunning) {
    AppLog.w(T.READER,"String_Node_Str");
  }
 else {
    new LoadBlogsTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
  }
}

Fixed version (ground truth):
public void refresh(){
  if (mIsTaskRunning) {
    AppLog.w(T.READER,"String_Node_Str");
    return;
  }
  new LoadBlogsTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Program: 14494
Project: 14494
Buggy source:
@Override public View getChildView(int groupPosition,final int childPosition,boolean isLastChild,View convertView,ViewGroup parent){
  final SingleItemModel children=(SingleItemModel)getChild(groupPosition,childPosition);
  if (convertView == null) {
    convertView=inflater.inflate(R.layout.stats_list_cell,parent,false);
    StatsViewHolder viewHolder=new StatsViewHolder(convertView);
    convertView.setTag(viewHolder);
  }
  final StatsViewHolder holder=(StatsViewHolder)convertView.getTag();
  String name=children.getTitle();
  int total=children.getTotals();
  String url=children.getUrl();
  holder.setEntryTextOrLink(url,name);
  holder.totalsTextView.setText(FormatUtils.formatDecimal(total));
  holder.networkImageView.setVisibility(View.INVISIBLE);
  return convertView;
}

Fixed version (ground truth):
@Override public View getChildView(int groupPosition,final int childPosition,boolean isLastChild,View convertView,ViewGroup parent){
  final SingleItemModel children=(SingleItemModel)getChild(groupPosition,childPosition);
  if (convertView == null) {
    convertView=inflater.inflate(R.layout.stats_list_cell,parent,false);
    StatsViewHolder viewHolder=new StatsViewHolder(convertView);
    convertView.setTag(viewHolder);
  }
  final StatsViewHolder holder=(StatsViewHolder)convertView.getTag();
  String name=children.getTitle();
  int total=children.getTotals();
  String url=children.getUrl();
  holder.setEntryTextOrLink(url,name);
  holder.totalsTextView.setText(FormatUtils.formatDecimal(total));
  holder.networkImageView.setVisibility(View.GONE);
  return convertView;
}
Program: 14495
Project: 14495
Buggy source:
@Override public View getChildView(int groupPosition,final int childPosition,boolean isLastChild,View convertView,ViewGroup parent){
  final SingleItemModel children=(SingleItemModel)getChild(groupPosition,childPosition);
  if (convertView == null) {
    convertView=inflater.inflate(R.layout.stats_list_cell,parent,false);
    StatsViewHolder viewHolder=new StatsViewHolder(convertView);
    convertView.setTag(viewHolder);
  }
  final StatsViewHolder holder=(StatsViewHolder)convertView.getTag();
  holder.setEntryTextOrLink(children.getUrl(),children.getTitle());
  holder.totalsTextView.setText(FormatUtils.formatDecimal(children.getTotals()));
  holder.networkImageView.setVisibility(View.INVISIBLE);
  return convertView;
}

Fixed version (ground truth):
@Override public View getChildView(int groupPosition,final int childPosition,boolean isLastChild,View convertView,ViewGroup parent){
  final SingleItemModel children=(SingleItemModel)getChild(groupPosition,childPosition);
  if (convertView == null) {
    convertView=inflater.inflate(R.layout.stats_list_cell,parent,false);
    StatsViewHolder viewHolder=new StatsViewHolder(convertView);
    convertView.setTag(viewHolder);
  }
  final StatsViewHolder holder=(StatsViewHolder)convertView.getTag();
  holder.setEntryTextOrLink(children.getUrl(),children.getTitle());
  holder.totalsTextView.setText(FormatUtils.formatDecimal(children.getTotals()));
  holder.networkImageView.setVisibility(View.GONE);
  return convertView;
}
Program: 14496
Project: 14496
Buggy source:
@Override public View getChildView(int groupPosition,final int childPosition,boolean isLastChild,View convertView,ViewGroup parent){
  final SingleItemModel children=(SingleItemModel)getChild(groupPosition,childPosition);
  if (convertView == null) {
    convertView=inflater.inflate(R.layout.stats_list_cell,parent,false);
    StatsViewHolder viewHolder=new StatsViewHolder(convertView);
    convertView.setTag(viewHolder);
  }
  final StatsViewHolder holder=(StatsViewHolder)convertView.getTag();
  String name=children.getTitle();
  int total=children.getTotals();
  holder.setEntryTextOrLink(name,name);
  holder.totalsTextView.setText(FormatUtils.formatDecimal(total));
  holder.networkImageView.setVisibility(View.INVISIBLE);
  if (StringUtils.isNotBlank(children.getUrl())) {
    holder.imgMore.setVisibility(View.VISIBLE);
    holder.imgMore.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View view){
        PopupMenu popup=new PopupMenu(activity,view);
        MenuItem menuItem=popup.getMenu().add(getString(R.string.view_in_browser));
        menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener(){
          @Override public boolean onMenuItemClick(          MenuItem item){
            WPWebViewActivity.openURL(activity,children.getUrl());
            return true;
          }
        }
);
        popup.show();
      }
    }
);
  }
  return convertView;
}

Fixed version (ground truth):
@Override public View getChildView(int groupPosition,final int childPosition,boolean isLastChild,View convertView,ViewGroup parent){
  final SingleItemModel children=(SingleItemModel)getChild(groupPosition,childPosition);
  if (convertView == null) {
    convertView=inflater.inflate(R.layout.stats_list_cell,parent,false);
    StatsViewHolder viewHolder=new StatsViewHolder(convertView);
    convertView.setTag(viewHolder);
  }
  final StatsViewHolder holder=(StatsViewHolder)convertView.getTag();
  String name=children.getTitle();
  int total=children.getTotals();
  holder.setEntryTextOrLink(name,name);
  holder.totalsTextView.setText(FormatUtils.formatDecimal(total));
  holder.networkImageView.setVisibility(View.GONE);
  if (StringUtils.isNotBlank(children.getUrl())) {
    holder.imgMore.setVisibility(View.VISIBLE);
    holder.imgMore.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View view){
        PopupMenu popup=new PopupMenu(activity,view);
        MenuItem menuItem=popup.getMenu().add(getString(R.string.view_in_browser));
        menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener(){
          @Override public boolean onMenuItemClick(          MenuItem item){
            WPWebViewActivity.openURL(activity,children.getUrl());
            return true;
          }
        }
);
        popup.show();
      }
    }
);
  }
  return convertView;
}
Program: 14498
Project: 14498
Buggy source:
@Override public View getChildView(int groupPosition,final int childPosition,boolean isLastChild,View convertView,ViewGroup parent){
  final TagModel children=(TagModel)getChild(groupPosition,childPosition);
  if (convertView == null) {
    convertView=inflater.inflate(R.layout.stats_list_cell,parent,false);
    StatsViewHolder viewHolder=new StatsViewHolder(convertView);
    convertView.setTag(viewHolder);
  }
  final StatsViewHolder holder=(StatsViewHolder)convertView.getTag();
  String name=children.getName();
  holder.entryTextView.setText(name);
  holder.entryTextView.setTextColor(getResources().getColor(R.color.stats_link_text_color));
  holder.totalsTextView.setText("String_Node_Str");
  holder.networkImageView.setVisibility(View.INVISIBLE);
  return convertView;
}

Fixed version (ground truth):
@Override public View getChildView(int groupPosition,final int childPosition,boolean isLastChild,View convertView,ViewGroup parent){
  final TagModel children=(TagModel)getChild(groupPosition,childPosition);
  if (convertView == null) {
    convertView=inflater.inflate(R.layout.stats_list_cell,parent,false);
    StatsViewHolder viewHolder=new StatsViewHolder(convertView);
    ViewGroup.LayoutParams params=viewHolder.networkImageView.getLayoutParams();
    params.width=DisplayUtils.dpToPx(convertView.getContext(),12);
    params.height=params.width;
    viewHolder.networkImageView.setLayoutParams(params);
    convertView.setTag(viewHolder);
  }
  final StatsViewHolder holder=(StatsViewHolder)convertView.getTag();
  holder.setEntryTextOrLink(children.getLink(),children.getName());
  holder.totalsTextView.setText("String_Node_Str");
  holder.networkImageView.setVisibility(View.VISIBLE);
  holder.networkImageView.setImageDrawable(getResources().getDrawable(R.drawable.stats_icon_tags));
  return convertView;
}
Program: 14499
Project: 14499
Buggy source:
@Override public int getChildrenCount(int groupPosition){
  TagsModel currentGroup=groups.get(groupPosition);
  List<TagModel> referrals=currentGroup.getTags();
  if (referrals == null || referrals.size() == 1) {
    return 0;
  }
 else {
    return referrals.size();
  }
}

Fixed version (ground truth):
@Override public int getChildrenCount(int groupPosition){
  TagsModel currentGroup=groups.get(groupPosition);
  List<TagModel> tags=currentGroup.getTags();
  if (tags == null || tags.size() == 1) {
    return 0;
  }
 else {
    return tags.size();
  }
}
Program: 14502
Project: 14502
Buggy source:
public static void setGroupChevron(final boolean isGroupExpanded,View groupView,boolean animate){
  final ImageView chevron=(ImageView)groupView.findViewById(R.id.stats_list_cell_chevron);
  if (chevron == null) {
    return;
  }
  chevron.clearAnimation();
  if (animate) {
    chevron.setImageResource(isGroupExpanded ? R.drawable.stats_chevron_right : R.drawable.stats_chevron_down);
    float start=(isGroupExpanded ? 0.0f : 0.0f);
    float end=(isGroupExpanded ? 90.0f : -90.0f);
    Animation rotate=new RotateAnimation(start,end,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
    rotate.setDuration(ANIM_DURATION);
    rotate.setInterpolator(getInterpolator());
    rotate.setFillAfter(true);
    chevron.startAnimation(rotate);
  }
 else {
    chevron.setImageResource(isGroupExpanded ? R.drawable.stats_chevron_down : R.drawable.stats_chevron_right);
  }
}

Fixed version (ground truth):
public static void setGroupChevron(final boolean isGroupExpanded,View groupView,int groupPosition,boolean animate){
  final ImageView chevron=(ImageView)groupView.findViewById(R.id.stats_list_cell_chevron);
  if (chevron == null) {
    return;
  }
  if (isGroupExpanded) {
    setViewBackgroundWithoutResettingPadding(groupView,R.drawable.stats_list_item_expanded_background);
  }
 else {
    setViewBackgroundWithoutResettingPadding(groupView,groupPosition == 0 ? 0 : R.drawable.stats_list_item_background);
  }
  chevron.clearAnimation();
  if (animate) {
    chevron.setImageResource(isGroupExpanded ? R.drawable.stats_chevron_right : R.drawable.stats_chevron_down);
    float start=(isGroupExpanded ? 0.0f : 0.0f);
    float end=(isGroupExpanded ? 90.0f : -90.0f);
    Animation rotate=new RotateAnimation(start,end,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
    rotate.setDuration(ANIM_DURATION);
    rotate.setInterpolator(getInterpolator());
    rotate.setFillAfter(true);
    chevron.startAnimation(rotate);
  }
 else {
    chevron.setImageResource(isGroupExpanded ? R.drawable.stats_chevron_down : R.drawable.stats_chevron_right);
  }
}
Program: 14503
Project: 14503
Buggy source:
public static void hideChildViews(View groupView,boolean animate){
  final ViewGroup childContainer=(ViewGroup)groupView.findViewById(R.id.layout_child_container);
  if (childContainer == null) {
    return;
  }
  if (childContainer.getVisibility() != View.GONE) {
    if (animate) {
      Animation expand=new ScaleAnimation(1.0f,1.0f,1.0f,0.0f);
      expand.setDuration(ANIM_DURATION);
      expand.setInterpolator(getInterpolator());
      expand.setAnimationListener(new Animation.AnimationListener(){
        @Override public void onAnimationStart(        Animation animation){
        }
        @Override public void onAnimationEnd(        Animation animation){
          childContainer.setVisibility(View.GONE);
        }
        @Override public void onAnimationRepeat(        Animation animation){
        }
      }
);
      childContainer.startAnimation(expand);
    }
 else {
      childContainer.setVisibility(View.GONE);
    }
  }
  StatsUIHelper.setGroupChevron(false,groupView,animate);
}

Fixed version (ground truth):
public static void hideChildViews(View groupView,int groupPosition,boolean animate){
  final ViewGroup childContainer=(ViewGroup)groupView.findViewById(R.id.layout_child_container);
  if (childContainer == null) {
    return;
  }
  if (childContainer.getVisibility() != View.GONE) {
    if (animate) {
      Animation expand=new ScaleAnimation(1.0f,1.0f,1.0f,0.0f);
      expand.setDuration(ANIM_DURATION);
      expand.setInterpolator(getInterpolator());
      expand.setAnimationListener(new Animation.AnimationListener(){
        @Override public void onAnimationStart(        Animation animation){
        }
        @Override public void onAnimationEnd(        Animation animation){
          childContainer.setVisibility(View.GONE);
        }
        @Override public void onAnimationRepeat(        Animation animation){
        }
      }
);
      childContainer.startAnimation(expand);
    }
 else {
      childContainer.setVisibility(View.GONE);
    }
  }
  StatsUIHelper.setGroupChevron(false,groupView,groupPosition,animate);
}
Program: 14505
Project: 14505
Buggy source:
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
switch (requestCode) {
case ADD_ACCOUNT_REQUEST:
    if (resultCode == RESULT_OK) {
      getBlogNames();
      setupCurrentBlog();
      if (mDrawerListView != null) {
        initMenuDrawer();
      }
      WordPress.registerForCloudMessaging(this);
      showReaderIfNoBlog();
    }
 else {
      finish();
    }
  break;
case SETTINGS_REQUEST:
if (mDrawerListView != null && resultCode != SettingsActivity.RESULT_SIGNED_OUT) {
  initMenuDrawer();
  String[] blogNames=getBlogNames();
  if (blogNames.length >= 1) {
    setupCurrentBlog();
  }
  if (data != null && data.getBooleanExtra(SettingsActivity.CURRENT_BLOG_CHANGED,true)) {
    blogChanged();
  }
  WordPress.registerForCloudMessaging(this);
}
break;
case AUTHENTICATE_REQUEST:
if (resultCode == RESULT_CANCELED) {
Intent i=new Intent(this,SignInActivity.class);
startActivityForResult(i,ADD_ACCOUNT_REQUEST);
}
 else {
WordPress.registerForCloudMessaging(this);
}
break;
}
}

Fixed version (ground truth):
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
switch (requestCode) {
case ADD_ACCOUNT_REQUEST:
    if (resultCode == RESULT_OK) {
      getBlogNames();
      setupCurrentBlog();
      if (mDrawerListView != null) {
        initBlogSpinner();
      }
      WordPress.registerForCloudMessaging(this);
      showReaderIfNoBlog();
    }
 else {
      finish();
    }
  break;
case SETTINGS_REQUEST:
if (mDrawerListView != null && resultCode != SettingsActivity.RESULT_SIGNED_OUT) {
  initBlogSpinner();
  String[] blogNames=getBlogNames();
  if (blogNames.length >= 1) {
    setupCurrentBlog();
  }
  if (data != null && data.getBooleanExtra(SettingsActivity.CURRENT_BLOG_CHANGED,true)) {
    blogChanged();
  }
  WordPress.registerForCloudMessaging(this);
}
break;
case AUTHENTICATE_REQUEST:
if (resultCode == RESULT_CANCELED) {
Intent i=new Intent(this,SignInActivity.class);
startActivityForResult(i,ADD_ACCOUNT_REQUEST);
}
 else {
WordPress.registerForCloudMessaging(this);
}
break;
}
}
Program: 14506
Project: 14506
Buggy source:
public boolean onOptionsItemSelected(MenuItem item){
  if (item.getItemId() == android.R.id.home && mDrawerLayout != null) {
    if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) {
      mDrawerLayout.closeDrawer(GravityCompat.START);
    }
 else {
      mDrawerLayout.openDrawer(GravityCompat.START);
    }
  }
  return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
public boolean onOptionsItemSelected(MenuItem item){
  if (item.getItemId() == android.R.id.home && mDrawerLayout != null) {
    toggleDrawer();
  }
  return super.onOptionsItemSelected(item);
}
Program: 14507
Project: 14507
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  if (intent == null || intent.getAction() == null)   return;
  if (intent.getAction().equals(WordPress.BROADCAST_ACTION_SIGNOUT)) {
    onSignout();
  }
  if (intent.getAction().equals(WordPress.BROADCAST_ACTION_XMLRPC_INVALID_CREDENTIALS)) {
    AuthenticationDialogUtils.showAuthErrorDialog(WPDrawerActivity.this);
  }
  if (intent.getAction().equals(SimperiumUtils.BROADCAST_ACTION_SIMPERIUM_NOT_AUTHORIZED) && WPDrawerActivity.this instanceof NotificationsActivity) {
    AuthenticationDialogUtils.showAuthErrorDialog(WPDrawerActivity.this,R.string.sign_in_again,R.string.simperium_connection_error);
  }
  if (intent.getAction().equals(WordPress.BROADCAST_ACTION_XMLRPC_TWO_FA_AUTH)) {
    AuthenticationDialogUtils.showAuthErrorDialog(WPDrawerActivity.this);
  }
  if (intent.getAction().equals(WordPress.BROADCAST_ACTION_XMLRPC_INVALID_SSL_CERTIFICATE)) {
    SelfSignedSSLCertsManager.askForSslTrust(WPDrawerActivity.this);
  }
  if (intent.getAction().equals(WordPress.BROADCAST_ACTION_XMLRPC_LOGIN_LIMIT)) {
    ToastUtils.showToast(context,R.string.limit_reached,Duration.LONG);
  }
  if (intent.getAction().equals(WordPress.BROADCAST_ACTION_BLOG_LIST_CHANGED)) {
    initMenuDrawer();
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  if (intent == null || intent.getAction() == null)   return;
  if (intent.getAction().equals(WordPress.BROADCAST_ACTION_SIGNOUT)) {
    onSignout();
  }
  if (intent.getAction().equals(WordPress.BROADCAST_ACTION_XMLRPC_INVALID_CREDENTIALS)) {
    AuthenticationDialogUtils.showAuthErrorDialog(WPDrawerActivity.this);
  }
  if (intent.getAction().equals(SimperiumUtils.BROADCAST_ACTION_SIMPERIUM_NOT_AUTHORIZED) && WPDrawerActivity.this instanceof NotificationsActivity) {
    AuthenticationDialogUtils.showAuthErrorDialog(WPDrawerActivity.this,R.string.sign_in_again,R.string.simperium_connection_error);
  }
  if (intent.getAction().equals(WordPress.BROADCAST_ACTION_XMLRPC_TWO_FA_AUTH)) {
    AuthenticationDialogUtils.showAuthErrorDialog(WPDrawerActivity.this);
  }
  if (intent.getAction().equals(WordPress.BROADCAST_ACTION_XMLRPC_INVALID_SSL_CERTIFICATE)) {
    SelfSignedSSLCertsManager.askForSslTrust(WPDrawerActivity.this);
  }
  if (intent.getAction().equals(WordPress.BROADCAST_ACTION_XMLRPC_LOGIN_LIMIT)) {
    ToastUtils.showToast(context,R.string.limit_reached,Duration.LONG);
  }
  if (intent.getAction().equals(WordPress.BROADCAST_ACTION_BLOG_LIST_CHANGED)) {
    initBlogSpinner();
  }
}
Program: 14509
Project: 14509
Buggy source:
void refreshMenuDrawer(){
  if (mDrawerAdapter == null)   return;
  setupCurrentBlog();
  updateMenuDrawer();
  Blog currentBlog=WordPress.getCurrentBlog();
  if (currentBlog != null && mDrawerListView != null && mDrawerListView.getHeaderViewsCount() > 0) {
    for (int i=0; i < blogIDs.length; i++) {
      if (blogIDs[i] == currentBlog.getLocalTableBlogId()) {
        if (mBlogSpinner != null) {
          mBlogSpinner.setSelection(i);
        }
      }
    }
  }
}

Fixed version (ground truth):
void refreshMenuDrawer(){
  if (mDrawerAdapter == null)   return;
  setupCurrentBlog();
  updateMenuDrawer();
  Blog currentBlog=WordPress.getCurrentBlog();
  if (currentBlog != null && mDrawerListView != null && mDrawerListView.getHeaderViewsCount() > 0) {
    for (int i=0; i < mBlogIDs.length; i++) {
      if (mBlogIDs[i] == currentBlog.getLocalTableBlogId()) {
        if (mBlogSpinner != null) {
          mBlogSpinner.setSelection(i);
        }
      }
    }
  }
}
Program: 14510
Project: 14510
Buggy source:
/** 
 * Get the names of all the blogs configured within the application. If a blog does not have a specific name, the blog URL is returned.
 * @return array of blog names
 */
private static String[] getBlogNames(){
  List<Map<String,Object>> accounts=WordPress.wpDB.getVisibleAccounts();
  int blogCount=accounts.size();
  blogIDs=new int[blogCount];
  String[] blogNames=new String[blogCount];
  for (int i=0; i < blogCount; i++) {
    Map<String,Object> account=accounts.get(i);
    blogNames[i]=BlogUtils.getBlogNameFromAccountMap(account);
    blogIDs[i]=Integer.valueOf(account.get("String_Node_Str").toString());
  }
  return blogNames;
}

Fixed version (ground truth):
/** 
 * Get the names of all the blogs configured within the application. If a blog does not have a specific name, the blog URL is returned.
 * @return array of blog names
 */
private static String[] getBlogNames(){
  List<Map<String,Object>> accounts=WordPress.wpDB.getVisibleAccounts();
  int blogCount=accounts.size();
  mBlogIDs=new int[blogCount];
  String[] blogNames=new String[blogCount];
  for (int i=0; i < blogCount; i++) {
    Map<String,Object> account=accounts.get(i);
    blogNames[i]=BlogUtils.getBlogNameFromAccountMap(account);
    mBlogIDs[i]=Integer.valueOf(account.get("String_Node_Str").toString());
  }
  return blogNames;
}
Program: 14511
Project: 14511
Buggy source:
@Override public void onItemSelected(AdapterView<?> parent,View view,int position,long id){
  if (!mBlogSpinnerInitialized) {
    mBlogSpinnerInitialized=true;
  }
 else {
    WordPress.setCurrentBlog(blogIDs[position]);
    updateMenuDrawer();
    blogChanged();
  }
}

Fixed version (ground truth):
@Override public void onItemSelected(AdapterView<?> parent,View view,int position,long id){
  if (!mBlogSpinnerInitialized) {
    mBlogSpinnerInitialized=true;
  }
 else {
    WordPress.setCurrentBlog(mBlogIDs[position]);
    updateMenuDrawer();
    blogChanged();
  }
}
Program: 14512
Project: 14512
Buggy source:
public ReaderBlogInfoView(Context context){
  super(context);
  View view=LayoutInflater.from(context).inflate(R.layout.reader_blog_info_view,this,true);
  mImageMshot=(WPNetworkImageView)view.findViewById(R.id.image_mshot);
  int displayWidth=DisplayUtils.getDisplayPixelWidth(getContext());
  RelativeLayout.LayoutParams params=(RelativeLayout.LayoutParams)mImageMshot.getLayoutParams();
  if (DisplayUtils.isLandscape(context)) {
    params.width=(int)(displayWidth * 0.15f);
  }
 else {
    params.width=(int)(displayWidth * 0.25f);
  }
}

Fixed version (ground truth):
public ReaderBlogInfoView(Context context){
  super(context);
  View view=LayoutInflater.from(context).inflate(R.layout.reader_blog_info_view,this,true);
  view.setId(R.id.layout_blog_info_view);
  mImageMshot=(WPNetworkImageView)view.findViewById(R.id.image_mshot);
  int displayWidth=DisplayUtils.getDisplayPixelWidth(getContext());
  RelativeLayout.LayoutParams params=(RelativeLayout.LayoutParams)mImageMshot.getLayoutParams();
  if (DisplayUtils.isLandscape(context)) {
    params.width=(int)(displayWidth * 0.15f);
  }
 else {
    params.width=(int)(displayWidth * 0.25f);
  }
}