Program: 114095
Project: 114095
Buggy source:
@Override public void bindView(View view,final Context context,Cursor cursor){
  ViewHolder viewHolder=(ViewHolder)view.getTag();
  MessageCache messageCache=ChatDatabaseManager.getMessageCacheFromCursor(cursor);
  boolean ownMessage=isOwnMessage(messageCache.getSenderId());
  boolean friendsRequestMessage=MessagesNotificationType.FRIENDS_REQUEST.equals(messageCache.getMessagesNotificationType());
  boolean friendsInfoRequestMessage=messageCache.getMessagesNotificationType() != null && !friendsRequestMessage;
  if (friendsRequestMessage) {
    viewHolder.messageTextView.setText(messageCache.getMessage());
    viewHolder.timeTextMessageTextView.setText(DateUtils.longToMessageDate(messageCache.getTime()));
    setVisibilityFriendsActions(viewHolder,View.GONE);
  }
 else   if (friendsInfoRequestMessage) {
    viewHolder.messageTextView.setText(messageCache.getMessage());
    viewHolder.timeTextMessageTextView.setText(DateUtils.longToMessageDate(messageCache.getTime()));
    setVisibilityFriendsActions(viewHolder,View.GONE);
    lastInfoRequestPosition=cursor.getPosition();
  }
 else   if (!TextUtils.isEmpty(messageCache.getAttachUrl())) {
    resetUI(viewHolder);
    setViewVisibility(viewHolder.progressRelativeLayout,View.VISIBLE);
    viewHolder.timeAttachMessageTextView.setText(DateUtils.longToMessageDate(messageCache.getTime()));
    if (ownMessage) {
      setMessageStatus(viewHolder.attachDeliveryStatusImageView,messageCache.isDelivered(),messageCache.isRead());
    }
    displayAttachImage(messageCache.getAttachUrl(),viewHolder);
  }
 else {
    resetUI(viewHolder);
    setViewVisibility(viewHolder.textMessageView,View.VISIBLE);
    viewHolder.messageTextView.setText(messageCache.getMessage());
    viewHolder.timeTextMessageTextView.setText(DateUtils.longToMessageDate(messageCache.getTime()));
    if (ownMessage) {
      setMessageStatus(viewHolder.messageDeliveryStatusImageView,messageCache.isDelivered(),messageCache.isRead());
    }
  }
  if (!messageCache.isRead() && !ownMessage) {
    messageCache.setRead(true);
    QBUpdateStatusMessageCommand.start(context,dialog,messageCache,true);
  }
  boolean lastRequestMessage=cursor.getPosition() == cursor.getCount() - 1 && friendsRequestMessage;
  if (lastRequestMessage) {
    findLastFriendsRequestForCursor(cursor);
  }
  if (lastRequestPosition != EMPTY_POSITION && lastRequestPosition < lastInfoRequestPosition) {
    lastRequestPosition=EMPTY_POSITION;
  }
 else   if ((lastRequestPosition != EMPTY_POSITION && lastRequestPosition == cursor.getPosition())) {
    setVisibilityFriendsActions(viewHolder,View.VISIBLE);
    initListeners(viewHolder,messageCache.getSenderId());
  }
}

Fixed version (ground truth):
@Override public void bindView(View view,final Context context,Cursor cursor){
  ViewHolder viewHolder=(ViewHolder)view.getTag();
  MessageCache messageCache=ChatDatabaseManager.getMessageCacheFromCursor(cursor);
  boolean ownMessage=isOwnMessage(messageCache.getSenderId());
  boolean friendsRequestMessage=MessagesNotificationType.FRIENDS_REQUEST.equals(messageCache.getMessagesNotificationType());
  boolean friendsInfoRequestMessage=messageCache.getMessagesNotificationType() != null && !friendsRequestMessage;
  if (!ownMessage && !messageCache.isRead()) {
    if (positionLastReadMessage == -1) {
      positionLastReadMessage=cursor.getPosition();
    }
  }
  if (friendsRequestMessage) {
    viewHolder.messageTextView.setText(messageCache.getMessage());
    viewHolder.timeTextMessageTextView.setText(DateUtils.longToMessageDate(messageCache.getTime()));
    setVisibilityFriendsActions(viewHolder,View.GONE);
  }
 else   if (friendsInfoRequestMessage) {
    viewHolder.messageTextView.setText(messageCache.getMessage());
    viewHolder.timeTextMessageTextView.setText(DateUtils.longToMessageDate(messageCache.getTime()));
    setVisibilityFriendsActions(viewHolder,View.GONE);
    lastInfoRequestPosition=cursor.getPosition();
  }
 else   if (!TextUtils.isEmpty(messageCache.getAttachUrl())) {
    resetUI(viewHolder);
    setViewVisibility(viewHolder.progressRelativeLayout,View.VISIBLE);
    viewHolder.timeAttachMessageTextView.setText(DateUtils.longToMessageDate(messageCache.getTime()));
    if (ownMessage) {
      setMessageStatus(viewHolder.attachDeliveryStatusImageView,messageCache.isDelivered(),messageCache.isRead());
    }
    displayAttachImage(messageCache.getAttachUrl(),viewHolder);
  }
 else {
    resetUI(viewHolder);
    setViewVisibility(viewHolder.textMessageView,View.VISIBLE);
    viewHolder.messageTextView.setText(messageCache.getMessage());
    viewHolder.timeTextMessageTextView.setText(DateUtils.longToMessageDate(messageCache.getTime()));
    if (ownMessage) {
      setMessageStatus(viewHolder.messageDeliveryStatusImageView,messageCache.isDelivered(),messageCache.isRead());
    }
  }
  if (!messageCache.isRead() && !ownMessage) {
    messageCache.setRead(true);
    QBUpdateStatusMessageCommand.start(context,dialog,messageCache,true);
  }
  boolean lastRequestMessage=cursor.getPosition() == cursor.getCount() - 1 && friendsRequestMessage;
  if (lastRequestMessage) {
    findLastFriendsRequestForCursor(cursor);
  }
  if (lastRequestPosition != EMPTY_POSITION && lastRequestPosition < lastInfoRequestPosition) {
    lastRequestPosition=EMPTY_POSITION;
  }
 else   if ((lastRequestPosition != EMPTY_POSITION && lastRequestPosition == cursor.getPosition())) {
    setVisibilityFriendsActions(viewHolder,View.VISIBLE);
    initListeners(viewHolder,messageCache.getSenderId());
  }
}