Program: 32178
Project: 32178
Buggy source:
/** 
 * Refresh the receiver thumbnails
 * @param receiversLayout the receiver layout
 * @param leftAlign the avatars are left align i.e. they are ddisplayed from the left to the right one.
 * @param eventId the event Id
 * @param roomState the roomstate.
 */
protected void refreshReceiverLayout(final LinearLayout receiversLayout,final boolean leftAlign,final String eventId,final RoomState roomState){
  if (null == roomState) {
    return;
  }
  IMXStore store=mSession.getDataHandler().getStore();
  List<ReceiptData> receipts=store.getEventReceipts(roomState.roomId,eventId,true,true);
  ArrayList<View> imageViews=new ArrayList<View>();
  imageViews.add(receiversLayout.findViewById(R.id.messagesAdapter_avatar1).findViewById(R.id.avatar_img));
  imageViews.add(receiversLayout.findViewById(R.id.messagesAdapter_avatar2).findViewById(R.id.avatar_img));
  imageViews.add(receiversLayout.findViewById(R.id.messagesAdapter_avatar3).findViewById(R.id.avatar_img));
  if (!leftAlign) {
    Collections.reverse(imageViews);
  }
  TextView moreViewLeft=(TextView)receiversLayout.findViewById(R.id.messagesAdapter_more_than_three_left);
  TextView moreViewRight=(TextView)receiversLayout.findViewById(R.id.messagesAdapter_more_than_three_right);
  int index=0;
  if ((null != receipts) && (0 != receipts.size())) {
    int bound=Math.min(receipts.size(),imageViews.size());
    for (; index < bound; index++) {
      final ReceiptData r=receipts.get(index);
      RoomMember member=roomState.getMember(r.userId);
      ImageView imageView=(ImageView)imageViews.get(index);
      imageView.setVisibility(View.VISIBLE);
      imageView.setTag(null);
      imageView.setImageResource(R.drawable.ic_contact_picture_holo_light);
      if (null != member.avatarUrl) {
        loadSmallAvatar(imageView,member.avatarUrl);
      }
      final String userId=member.getUserId();
      imageView.setOnClickListener(new View.OnClickListener(){
        @Override public void onClick(        View v){
          mMessagesAdapterEventsListener.onReadReceiptClick(eventId,userId,r);
        }
      }
);
      imageView.setOnLongClickListener(new View.OnLongClickListener(){
        @Override public boolean onLongClick(        View v){
          return mMessagesAdapterEventsListener.onReadReceiptLongClick(eventId,userId,r);
        }
      }
);
    }
    TextView displayedMoreTextView=null;
    if (receipts.size() <= imageViews.size()) {
      moreViewLeft.setVisibility(View.GONE);
      moreViewRight.setVisibility(View.GONE);
    }
 else {
      int diff=receipts.size() - imageViews.size();
      if (!leftAlign) {
        displayedMoreTextView=moreViewLeft;
        moreViewLeft.setVisibility(View.VISIBLE);
        moreViewRight.setVisibility(View.GONE);
        moreViewLeft.setText(diff + "String_Node_Str");
      }
 else {
        displayedMoreTextView=moreViewRight;
        moreViewLeft.setVisibility(View.GONE);
        moreViewRight.setVisibility(View.VISIBLE);
        moreViewRight.setText("String_Node_Str" + diff);
      }
      displayedMoreTextView.setVisibility((receipts.size() > imageViews.size()) ? View.VISIBLE : View.GONE);
      displayedMoreTextView.setOnClickListener(new View.OnClickListener(){
        @Override public void onClick(        View v){
          mMessagesAdapterEventsListener.onMoreReadReceiptClick(eventId);
        }
      }
);
      displayedMoreTextView.setOnLongClickListener(new View.OnLongClickListener(){
        @Override public boolean onLongClick(        View v){
          return mMessagesAdapterEventsListener.onMoreReadReceiptLongClick(eventId);
        }
      }
);
    }
  }
 else {
    moreViewRight.setVisibility(View.GONE);
    moreViewLeft.setVisibility(View.GONE);
  }
  for (; index < imageViews.size(); index++) {
    imageViews.get(index).setVisibility(View.INVISIBLE);
  }
}

Fixed version (ground truth):
/** 
 * Refresh the receiver thumbnails
 * @param receiversLayout the receiver layout
 * @param leftAlign the avatars are left align i.e. they are ddisplayed from the left to the right one.
 * @param eventId the event Id
 * @param roomState the roomstate.
 */
protected void refreshReceiverLayout(final LinearLayout receiversLayout,final boolean leftAlign,final String eventId,final RoomState roomState){
  if (null == roomState) {
    return;
  }
  IMXStore store=mSession.getDataHandler().getStore();
  List<ReceiptData> receipts=store.getEventReceipts(roomState.roomId,eventId,true,true);
  ArrayList<View> imageViews=new ArrayList<View>();
  imageViews.add(receiversLayout.findViewById(R.id.messagesAdapter_avatar1).findViewById(R.id.avatar_img));
  imageViews.add(receiversLayout.findViewById(R.id.messagesAdapter_avatar2).findViewById(R.id.avatar_img));
  imageViews.add(receiversLayout.findViewById(R.id.messagesAdapter_avatar3).findViewById(R.id.avatar_img));
  if (!leftAlign) {
    Collections.reverse(imageViews);
  }
  TextView moreViewLeft=(TextView)receiversLayout.findViewById(R.id.messagesAdapter_more_than_three_left);
  TextView moreViewRight=(TextView)receiversLayout.findViewById(R.id.messagesAdapter_more_than_three_right);
  int index=0;
  if ((null != receipts) && (0 != receipts.size())) {
    int bound=Math.min(receipts.size(),imageViews.size());
    for (; index < bound; index++) {
      final ReceiptData r=receipts.get(index);
      RoomMember member=roomState.getMember(r.userId);
      ImageView imageView=(ImageView)imageViews.get(index);
      imageView.setVisibility(View.VISIBLE);
      imageView.setTag(null);
      imageView.setImageResource(R.drawable.ic_contact_picture_holo_light);
      if ((null != member) && (null != member.avatarUrl)) {
        loadSmallAvatar(imageView,member.avatarUrl);
      }
      final String userId=r.userId;
      imageView.setOnClickListener(new View.OnClickListener(){
        @Override public void onClick(        View v){
          mMessagesAdapterEventsListener.onReadReceiptClick(eventId,userId,r);
        }
      }
);
      imageView.setOnLongClickListener(new View.OnLongClickListener(){
        @Override public boolean onLongClick(        View v){
          return mMessagesAdapterEventsListener.onReadReceiptLongClick(eventId,userId,r);
        }
      }
);
    }
    TextView displayedMoreTextView=null;
    if (receipts.size() <= imageViews.size()) {
      moreViewLeft.setVisibility(View.GONE);
      moreViewRight.setVisibility(View.GONE);
    }
 else {
      int diff=receipts.size() - imageViews.size();
      if (!leftAlign) {
        displayedMoreTextView=moreViewLeft;
        moreViewLeft.setVisibility(View.VISIBLE);
        moreViewRight.setVisibility(View.GONE);
        moreViewLeft.setText(diff + "String_Node_Str");
      }
 else {
        displayedMoreTextView=moreViewRight;
        moreViewLeft.setVisibility(View.GONE);
        moreViewRight.setVisibility(View.VISIBLE);
        moreViewRight.setText("String_Node_Str" + diff);
      }
      displayedMoreTextView.setVisibility((receipts.size() > imageViews.size()) ? View.VISIBLE : View.GONE);
      displayedMoreTextView.setOnClickListener(new View.OnClickListener(){
        @Override public void onClick(        View v){
          mMessagesAdapterEventsListener.onMoreReadReceiptClick(eventId);
        }
      }
);
      displayedMoreTextView.setOnLongClickListener(new View.OnLongClickListener(){
        @Override public boolean onLongClick(        View v){
          return mMessagesAdapterEventsListener.onMoreReadReceiptLongClick(eventId);
        }
      }
);
    }
  }
 else {
    moreViewRight.setVisibility(View.GONE);
    moreViewLeft.setVisibility(View.GONE);
  }
  for (; index < imageViews.size(); index++) {
    imageViews.get(index).setVisibility(View.INVISIBLE);
  }
}