Program: 15204
Project: 15204
Buggy source:
public boolean loadComments(boolean refresh,boolean loadMore){
  refreshOnly=refresh;
  String author, postID, commentID, comment, dateCreatedFormatted, status, authorEmail, authorURL, postTitle;
  Vector<?> loadedPosts=WordPress.wpDB.loadComments(WordPress.currentBlog.getId());
  if (loadedPosts != null) {
    numRecords=loadedPosts.size();
    if (refreshOnly) {
      if (model != null) {
        model.clear();
      }
    }
 else {
      model=new ArrayList<Comment>();
    }
    checkedComments=new Vector<String>();
    for (int i=0; i < loadedPosts.size(); i++) {
      checkedComments.add(i,"String_Node_Str");
      HashMap<?,?> contentHash=(HashMap<?,?>)loadedPosts.get(i);
      allComments.put(contentHash.get("String_Node_Str").toString(),contentHash);
      author=EscapeUtils.unescapeHtml(contentHash.get("String_Node_Str").toString());
      commentID=contentHash.get("String_Node_Str").toString();
      postID=contentHash.get("String_Node_Str").toString();
      comment=EscapeUtils.unescapeHtml(contentHash.get("String_Node_Str").toString());
      dateCreatedFormatted=contentHash.get("String_Node_Str").toString();
      status=contentHash.get("String_Node_Str").toString();
      authorEmail=EscapeUtils.unescapeHtml(contentHash.get("String_Node_Str").toString());
      authorURL=EscapeUtils.unescapeHtml(contentHash.get("String_Node_Str").toString());
      postTitle=EscapeUtils.unescapeHtml(contentHash.get("String_Node_Str").toString());
      if (model == null) {
        model=new ArrayList<Comment>();
      }
      model.add(new Comment(postID,commentID,i,author,dateCreatedFormatted,comment,status,postTitle,authorURL,authorEmail,URI.create("String_Node_Str" + getMd5Hash(authorEmail.trim()) + "String_Node_Str")));
    }
    if (!refreshOnly) {
      try {
        ThumbnailBus bus=new ThumbnailBus();
        thumbs=new ThumbnailAdapter(getActivity(),new CommentAdapter(),new SimpleWebImageCache<ThumbnailBus,ThumbnailMessage>(null,null,101,bus),IMAGE_IDS);
      }
 catch (      Exception e1) {
        e1.printStackTrace();
      }
      ListView listView=this.getListView();
      listView.removeFooterView(switcher);
      if (loadedPosts.size() % 30 == 0) {
        listView.addFooterView(switcher);
      }
      setListAdapter(thumbs);
      listView.setOnItemClickListener(new OnItemClickListener(){
        public void onItemClick(        AdapterView<?> arg0,        View view,        int position,        long id){
          selectedPosition=position;
          Comment comment=model.get((int)id);
          onCommentSelectedListener.onCommentSelected(comment);
        }
      }
);
      listView.setOnCreateContextMenuListener(new OnCreateContextMenuListener(){
        public void onCreateContextMenu(        ContextMenu menu,        View v,        ContextMenuInfo menuInfo){
          AdapterView.AdapterContextMenuInfo info;
          try {
            info=(AdapterView.AdapterContextMenuInfo)menuInfo;
          }
 catch (          ClassCastException e) {
            return;
          }
          WordPress.currentComment=model.get(info.position);
          menu.setHeaderTitle(getResources().getText(R.string.comment_actions));
          menu.add(0,0,0,getResources().getText(R.string.mark_approved));
          menu.add(0,1,0,getResources().getText(R.string.mark_unapproved));
          menu.add(0,2,0,getResources().getText(R.string.mark_spam));
          menu.add(0,3,0,getResources().getText(R.string.reply));
          menu.add(0,4,0,getResources().getText(R.string.delete));
        }
      }
);
    }
 else {
      if (thumbs != null) {
        thumbs.notifyDataSetChanged();
      }
    }
    if (this.shouldSelectAfterLoad) {
      if (model != null) {
        if (model.size() > 0) {
          selectedPosition=0;
          Comment aComment=model.get((int)0);
          onCommentSelectedListener.onCommentSelected(aComment);
          thumbs.notifyDataSetChanged();
        }
      }
      shouldSelectAfterLoad=false;
    }
    if (loadMore && scrollPosition > 0) {
      ListView listView=this.getListView();
      try {
        listView.setSelectionFromTop(scrollPosition,scrollPositionTop);
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
public boolean loadComments(boolean refresh,boolean loadMore){
  refreshOnly=refresh;
  String author, postID, comment, dateCreatedFormatted, status, authorEmail, authorURL, postTitle;
  int commentID;
  Vector<?> loadedPosts=WordPress.wpDB.loadComments(WordPress.currentBlog.getId());
  if (loadedPosts != null) {
    numRecords=loadedPosts.size();
    if (refreshOnly) {
      if (model != null) {
        model.clear();
      }
    }
 else {
      model=new ArrayList<Comment>();
    }
    checkedComments=new Vector<String>();
    for (int i=0; i < loadedPosts.size(); i++) {
      checkedComments.add(i,"String_Node_Str");
      HashMap<?,?> contentHash=(HashMap<?,?>)loadedPosts.get(i);
      allComments.put((Integer)contentHash.get("String_Node_Str"),contentHash);
      author=EscapeUtils.unescapeHtml(contentHash.get("String_Node_Str").toString());
      commentID=(Integer)contentHash.get("String_Node_Str");
      postID=contentHash.get("String_Node_Str").toString();
      comment=EscapeUtils.unescapeHtml(contentHash.get("String_Node_Str").toString());
      dateCreatedFormatted=contentHash.get("String_Node_Str").toString();
      status=contentHash.get("String_Node_Str").toString();
      authorEmail=EscapeUtils.unescapeHtml(contentHash.get("String_Node_Str").toString());
      authorURL=EscapeUtils.unescapeHtml(contentHash.get("String_Node_Str").toString());
      postTitle=EscapeUtils.unescapeHtml(contentHash.get("String_Node_Str").toString());
      if (model == null) {
        model=new ArrayList<Comment>();
      }
      model.add(new Comment(postID,commentID,i,author,dateCreatedFormatted,comment,status,postTitle,authorURL,authorEmail,URI.create("String_Node_Str" + getMd5Hash(authorEmail.trim()) + "String_Node_Str")));
    }
    if (!refreshOnly) {
      try {
        ThumbnailBus bus=new ThumbnailBus();
        thumbs=new ThumbnailAdapter(getActivity(),new CommentAdapter(),new SimpleWebImageCache<ThumbnailBus,ThumbnailMessage>(null,null,101,bus),IMAGE_IDS);
      }
 catch (      Exception e1) {
        e1.printStackTrace();
      }
      ListView listView=this.getListView();
      listView.removeFooterView(switcher);
      if (loadedPosts.size() % 30 == 0) {
        listView.addFooterView(switcher);
      }
      setListAdapter(thumbs);
      listView.setOnItemClickListener(new OnItemClickListener(){
        public void onItemClick(        AdapterView<?> arg0,        View view,        int position,        long id){
          selectedPosition=position;
          Comment comment=model.get((int)id);
          onCommentSelectedListener.onCommentSelected(comment);
        }
      }
);
      listView.setOnCreateContextMenuListener(new OnCreateContextMenuListener(){
        public void onCreateContextMenu(        ContextMenu menu,        View v,        ContextMenuInfo menuInfo){
          AdapterView.AdapterContextMenuInfo info;
          try {
            info=(AdapterView.AdapterContextMenuInfo)menuInfo;
          }
 catch (          ClassCastException e) {
            return;
          }
          WordPress.currentComment=model.get(info.position);
          menu.setHeaderTitle(getResources().getText(R.string.comment_actions));
          menu.add(0,0,0,getResources().getText(R.string.mark_approved));
          menu.add(0,1,0,getResources().getText(R.string.mark_unapproved));
          menu.add(0,2,0,getResources().getText(R.string.mark_spam));
          menu.add(0,3,0,getResources().getText(R.string.reply));
          menu.add(0,4,0,getResources().getText(R.string.delete));
        }
      }
);
    }
 else {
      if (thumbs != null) {
        thumbs.notifyDataSetChanged();
      }
    }
    if (this.shouldSelectAfterLoad) {
      if (model != null) {
        if (model.size() > 0) {
          selectedPosition=0;
          Comment aComment=model.get((int)0);
          onCommentSelectedListener.onCommentSelected(aComment);
          thumbs.notifyDataSetChanged();
        }
      }
      shouldSelectAfterLoad=false;
    }
    if (loadMore && scrollPosition > 0) {
      ListView listView=this.getListView();
      try {
        listView.setSelectionFromTop(scrollPosition,scrollPositionTop);
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
    return true;
  }
 else {
    return false;
  }
}