Program: 103388
Project: 103388
Buggy source:
/** 
 * Initializes buttons panel.
 * @param uiContact the <tt>UIContact</tt> for which we initialize thebutton panel
 */
private void initButtonsPanel(UIContact uiContact){
  this.remove(callButton);
  this.remove(callVideoButton);
  this.remove(desktopSharingButton);
  this.remove(chatButton);
  this.remove(addContactButton);
  if (!isSelected)   return;
  int statusMessageLabelHeight=0;
  if (displayDetailsLabel.getText().length() > 0)   statusMessageLabelHeight=20;
 else   statusMessageLabelHeight=15;
  UIContactDetail imContact=null;
  if (uiContact.getDescriptor() instanceof MetaContact)   imContact=uiContact.getDefaultContactDetail(OperationSetBasicInstantMessaging.class);
  int x=statusLabel.getWidth() + LEFT_BORDER + STATUS_RIGHT_BORDER;
  if (imContact != null) {
    constraints.anchor=GridBagConstraints.WEST;
    constraints.fill=GridBagConstraints.NONE;
    constraints.gridx=1;
    constraints.gridy=2;
    constraints.gridwidth=1;
    constraints.gridheight=1;
    constraints.weightx=0f;
    constraints.weighty=0f;
    this.chatButton.setBorder(null);
    this.add(chatButton,constraints);
    chatButton.setBounds(x,nameLabel.getHeight() + statusMessageLabelHeight,28,28);
    if (logger.isInfoEnabled())     logger.info("String_Node_Str" + chatButton.getBounds());
    x+=chatButton.getWidth();
  }
  UIContactDetail telephonyContact=uiContact.getDefaultContactDetail(OperationSetBasicTelephony.class);
  if (telephonyContact != null || uiContact.getDescriptor() instanceof SourceContact) {
    constraints.anchor=GridBagConstraints.WEST;
    constraints.fill=GridBagConstraints.NONE;
    constraints.gridx=2;
    constraints.gridy=2;
    constraints.gridwidth=1;
    constraints.gridheight=1;
    constraints.weightx=0f;
    constraints.weighty=0f;
    this.callButton.setBorder(null);
    this.add(callButton,constraints);
    callButton.setBounds(x,nameLabel.getHeight() + statusMessageLabelHeight,28,28);
    callButton.setEnabled(telephonyContact != null);
    if (logger.isInfoEnabled())     logger.info("String_Node_Str" + callButton.getBounds());
    x+=callButton.getWidth();
  }
  UIContactDetail videoContact=uiContact.getDefaultContactDetail(OperationSetVideoTelephony.class);
  if (videoContact != null) {
    constraints.anchor=GridBagConstraints.WEST;
    constraints.fill=GridBagConstraints.NONE;
    constraints.gridx=3;
    constraints.gridy=2;
    constraints.gridwidth=1;
    constraints.gridheight=1;
    constraints.weightx=0f;
    constraints.weighty=0f;
    this.callVideoButton.setBorder(null);
    this.add(callVideoButton,constraints);
    callVideoButton.setBounds(x,nameLabel.getHeight() + statusMessageLabelHeight,28,28);
    if (logger.isInfoEnabled())     logger.info("String_Node_Str" + callVideoButton.getBounds());
    x+=callVideoButton.getWidth();
  }
  UIContactDetail desktopContact=uiContact.getDefaultContactDetail(OperationSetDesktopSharingServer.class);
  if (desktopContact != null) {
    constraints.anchor=GridBagConstraints.WEST;
    constraints.fill=GridBagConstraints.NONE;
    constraints.gridx=4;
    constraints.gridy=2;
    constraints.gridwidth=1;
    constraints.gridheight=1;
    constraints.weightx=0f;
    constraints.weighty=0f;
    this.desktopSharingButton.setBorder(null);
    this.add(desktopSharingButton,constraints);
    desktopSharingButton.setBounds(x,nameLabel.getHeight() + statusMessageLabelHeight,28,28);
    if (logger.isInfoEnabled())     logger.info("String_Node_Str" + desktopSharingButton.getBounds());
    x+=desktopSharingButton.getWidth();
  }
  if (uiContact.getDescriptor() instanceof SourceContact) {
    constraints.anchor=GridBagConstraints.WEST;
    constraints.fill=GridBagConstraints.NONE;
    constraints.gridx=5;
    constraints.gridy=2;
    constraints.gridwidth=1;
    constraints.gridheight=1;
    constraints.weightx=0f;
    constraints.weighty=0f;
    this.addContactButton.setBorder(null);
    this.add(addContactButton,constraints);
    addContactButton.setBounds(x,nameLabel.getHeight() + statusMessageLabelHeight,28,28);
    if (logger.isInfoEnabled())     logger.info("String_Node_Str" + addContactButton.getBounds());
    x+=addContactButton.getWidth();
  }
  this.setBounds(0,0,tree.getWidth(),getPreferredSize().height);
}

Fixed version (ground truth):
/** 
 * Initializes buttons panel.
 * @param uiContact the <tt>UIContact</tt> for which we initialize thebutton panel
 */
private void initButtonsPanel(UIContact uiContact){
  this.remove(chatButton);
  this.remove(callButton);
  this.remove(callVideoButton);
  this.remove(desktopSharingButton);
  this.remove(addContactButton);
  if (!isSelected)   return;
  int statusMessageLabelHeight=0;
  if (displayDetailsLabel.getText().length() > 0)   statusMessageLabelHeight=20;
 else   statusMessageLabelHeight=15;
  UIContactDetail imContact=null;
  if (uiContact.getDescriptor() instanceof MetaContact)   imContact=uiContact.getDefaultContactDetail(OperationSetBasicInstantMessaging.class);
  int x=statusIcon.getIconWidth() + statusLabel.getIconTextGap() + LEFT_BORDER+ STATUS_RIGHT_BORDER;
  if (imContact != null) {
    constraints.anchor=GridBagConstraints.WEST;
    constraints.fill=GridBagConstraints.NONE;
    constraints.gridx=1;
    constraints.gridy=2;
    constraints.gridwidth=1;
    constraints.gridheight=1;
    constraints.weightx=0f;
    constraints.weighty=0f;
    this.chatButton.setBorder(null);
    this.add(chatButton,constraints);
    chatButton.setBounds(x,nameLabel.getHeight() + statusMessageLabelHeight,28,28);
    x+=chatButton.getWidth();
  }
  UIContactDetail telephonyContact=uiContact.getDefaultContactDetail(OperationSetBasicTelephony.class);
  if (telephonyContact != null || uiContact.getDescriptor() instanceof SourceContact) {
    constraints.anchor=GridBagConstraints.WEST;
    constraints.fill=GridBagConstraints.NONE;
    constraints.gridx=2;
    constraints.gridy=2;
    constraints.gridwidth=1;
    constraints.gridheight=1;
    constraints.weightx=0f;
    constraints.weighty=0f;
    this.callButton.setBorder(null);
    this.add(callButton,constraints);
    callButton.setBounds(x,nameLabel.getHeight() + statusMessageLabelHeight,28,28);
    callButton.setEnabled(telephonyContact != null);
    x+=callButton.getWidth();
  }
  UIContactDetail videoContact=uiContact.getDefaultContactDetail(OperationSetVideoTelephony.class);
  if (videoContact != null) {
    constraints.anchor=GridBagConstraints.WEST;
    constraints.fill=GridBagConstraints.NONE;
    constraints.gridx=3;
    constraints.gridy=2;
    constraints.gridwidth=1;
    constraints.gridheight=1;
    constraints.weightx=0f;
    constraints.weighty=0f;
    this.callVideoButton.setBorder(null);
    this.add(callVideoButton,constraints);
    callVideoButton.setBounds(x,nameLabel.getHeight() + statusMessageLabelHeight,28,28);
    x+=callVideoButton.getWidth();
  }
  UIContactDetail desktopContact=uiContact.getDefaultContactDetail(OperationSetDesktopSharingServer.class);
  if (desktopContact != null) {
    constraints.anchor=GridBagConstraints.WEST;
    constraints.fill=GridBagConstraints.NONE;
    constraints.gridx=4;
    constraints.gridy=2;
    constraints.gridwidth=1;
    constraints.gridheight=1;
    constraints.weightx=0f;
    constraints.weighty=0f;
    this.desktopSharingButton.setBorder(null);
    this.add(desktopSharingButton,constraints);
    desktopSharingButton.setBounds(x,nameLabel.getHeight() + statusMessageLabelHeight,28,28);
    x+=desktopSharingButton.getWidth();
  }
  if (uiContact.getDescriptor() instanceof SourceContact) {
    constraints.anchor=GridBagConstraints.WEST;
    constraints.fill=GridBagConstraints.NONE;
    constraints.gridx=5;
    constraints.gridy=2;
    constraints.gridwidth=1;
    constraints.gridheight=1;
    constraints.weightx=0f;
    constraints.weighty=0f;
    this.addContactButton.setBorder(null);
    this.add(addContactButton,constraints);
    addContactButton.setBounds(x,nameLabel.getHeight() + statusMessageLabelHeight,28,28);
    x+=addContactButton.getWidth();
  }
  this.setBounds(0,0,tree.getWidth(),getPreferredSize().height);
}