nus-yam/ex-repair huggingface dataset:
Program: 103024
Project: 103024
Buggy source:
/** 
 * Gets the telephony conference-related state of this <tt>Call</tt>. Since a non-conference <tt>Call</tt> may be converted into a conference <tt>Call</tt> at any time, every <tt>Call</tt> instance maintains a <tt>CallConference</tt> instance regardless of whether the <tt>Call</tt> in question is participating in a telephony conference.
 * @return a <tt>CallConference</tt> instance which represents thetelephony conference-related state of this <tt>Call</tt>.
 */
public CallConference getConference(){
  if (conference == null) {
    CallConference newValue=createConference();
    if (newValue == null) {
      throw new IllegalStateException("String_Node_Str");
    }
 else     setConference(newValue);
  }
  return conference;
}

Fixed version (ground truth):
/** 
 * Gets the telephony conference-related state of this <tt>Call</tt>. Since a non-conference <tt>Call</tt> may be converted into a conference <tt>Call</tt> at any time, every <tt>Call</tt> instance maintains a <tt>CallConference</tt> instance regardless of whether the <tt>Call</tt> in question is participating in a telephony conference.
 * @return a <tt>CallConference</tt> instance which represents thetelephony conference-related state of this <tt>Call</tt>.
 */
public CallConference getConference(){
  if (conference == null) {
    CallConference newValue=createConference();
    if (newValue == null) {
      throw new IllegalStateException("String_Node_Str");
    }
 else {
      setConference(newValue);
    }
  }
  return conference;
}
Program: 103025
Project: 103025
Buggy source:
public void callPeerAdded(CallPeerEvent ev){
  CallConference.this.onCallPeerEvent(ev);
}

Fixed version (ground truth):
@Override public void callPeerAdded(CallPeerEvent ev){
  CallConference.this.onCallPeerEvent(ev);
}
Program: 103026
Project: 103026
Buggy source:
public void callPeerRemoved(CallPeerEvent ev){
  CallConference.this.onCallPeerEvent(ev);
}

Fixed version (ground truth):
@Override public void callPeerRemoved(CallPeerEvent ev){
  CallConference.this.onCallPeerEvent(ev);
}
Program: 103027
Project: 103027
Buggy source:
/** 
 * Notifies this instance that a value of a specific property of the <tt>Call</tt> of   {@link #peer} has changed from a specific old value to aspecific new value.
 * @param event a <tt>PropertyChangeEvent</tt> which specified the propertywhich had its value changed and the old and new values of that property
 */
private void callPropertyChange(PropertyChangeEvent event){
  String propertyName=event.getPropertyName();
  if (MediaAwareCall.CONFERENCE.equals(propertyName) || MediaAwareCall.DEFAULT_DEVICE.equals(propertyName)) {
    MediaAwareCall<?,?,?> call=getPeer().getCall();
    if (call == null)     return;
    for (    MediaType mediaType : MediaType.values()) {
      MediaStream stream=getStream(mediaType);
      if (stream == null)       continue;
      MediaDevice oldDevice=stream.getDevice();
      if (oldDevice != null) {
        if (oldDevice instanceof MediaDeviceWrapper) {
          oldDevice=((MediaDeviceWrapper)oldDevice).getWrappedDevice();
        }
        MediaDevice newDevice=getDefaultDevice(mediaType);
        MediaDevice newWrappedDevice=newDevice;
        if (newDevice instanceof MediaDeviceWrapper) {
          newWrappedDevice=((MediaDeviceWrapper)newDevice).getWrappedDevice();
        }
        if (oldDevice != newWrappedDevice)         stream.setDevice(newDevice);
      }
      stream.setRTPTranslator(call.getRTPTranslator(mediaType));
    }
  }
}

Fixed version (ground truth):
/** 
 * Notifies this instance that a value of a specific property of the <tt>Call</tt> of   {@link #peer} has changed from a specific old value to aspecific new value.
 * @param ev a <tt>PropertyChangeEvent</tt> which specified the propertywhich had its value changed and the old and new values of that property
 */
private void callPropertyChange(PropertyChangeEvent ev){
  String propertyName=ev.getPropertyName();
  boolean callConferenceChange=MediaAwareCall.CONFERENCE.equals(propertyName);
  if (callConferenceChange || MediaAwareCall.DEFAULT_DEVICE.equals(propertyName)) {
    MediaAwareCall<?,?,?> call=getPeer().getCall();
    if (call == null)     return;
    for (    MediaType mediaType : MediaType.values()) {
      MediaStream stream=getStream(mediaType);
      if (stream == null)       continue;
      MediaDevice oldDevice=stream.getDevice();
      if (oldDevice != null) {
        MediaDevice oldValue=(!callConferenceChange && (oldDevice instanceof MediaDeviceWrapper)) ? ((MediaDeviceWrapper)oldDevice).getWrappedDevice() : oldDevice;
        MediaDevice newDevice=getDefaultDevice(mediaType);
        MediaDevice newValue=(!callConferenceChange && (newDevice instanceof MediaDeviceWrapper)) ? ((MediaDeviceWrapper)newDevice).getWrappedDevice() : newDevice;
        if (oldValue != newValue)         stream.setDevice(newDevice);
      }
      stream.setRTPTranslator(call.getRTPTranslator(mediaType));
    }
  }
}
Program: 103028
Project: 103028
Buggy source:
/** 
 * {@inheritDoc}Notifies this instance about a <tt>PropertyChangeEvent</tt> fired by  {@link #notifier}.
 */
public void propertyChange(PropertyChangeEvent ev){
  PropertyChangeListener[] ls;
  int n;
synchronized (this) {
    Iterator<WeakReference<PropertyChangeListener>> i=listeners.iterator();
    ls=new PropertyChangeListener[listeners.size()];
    n=0;
    while (i.hasNext()) {
      PropertyChangeListener l=i.next().get();
      if (l == null)       i.remove();
 else       ls[n++]=l;
    }
    if ((n == 0) && this.added) {
      removeThisFromNotifier();
      this.added=false;
    }
  }
  if (n != 0) {
    for (    PropertyChangeListener l : ls) {
      if (l == null)       break;
 else       l.propertyChange(ev);
    }
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}Notifies this instance about a <tt>PropertyChangeEvent</tt> fired by  {@link #notifier}.
 */
@Override public void propertyChange(PropertyChangeEvent ev){
  PropertyChangeListener[] ls;
  int n;
synchronized (this) {
    Iterator<WeakReference<PropertyChangeListener>> i=listeners.iterator();
    ls=new PropertyChangeListener[listeners.size()];
    n=0;
    while (i.hasNext()) {
      PropertyChangeListener l=i.next().get();
      if (l == null)       i.remove();
 else       ls[n++]=l;
    }
    if ((n == 0) && this.added) {
      removeThisFromNotifier();
      this.added=false;
    }
  }
  if (n != 0) {
    for (    PropertyChangeListener l : ls) {
      if (l == null)       break;
 else       l.propertyChange(ev);
    }
  }
}
Program: 103029
Project: 103029
Buggy source:
/** 
 * Removes the protocol specific group from the specified meta contact group and removes from meta contacts all proto contacts that belong to the same provider as the group which is being removed.
 * @param metaContainer the MetaContactGroup that we'd like to remove acontact group from.
 * @param groupToRemove the ContactGroup that we'd like removed.
 * @param sourceProvider the ProtocolProvider that the contact group belongsto.
 */
public void removeContactGroupFromMetaContactGroup(MetaContactGroupImpl metaContainer,ContactGroup groupToRemove,ProtocolProviderService sourceProvider){
  if (metaContainer == null) {
    return;
  }
  locallyRemoveAllContactsForProvider(metaContainer,groupToRemove);
  fireMetaContactGroupEvent(metaContainer,sourceProvider,groupToRemove,MetaContactGroupEvent.CONTACT_GROUP_REMOVED_FROM_META_GROUP);
}

Fixed version (ground truth):
/** 
 * Removes the protocol specific group from the specified meta contact group and removes from meta contacts all proto contacts that belong to the same provider as the group which is being removed.
 * @param metaContainer the MetaContactGroup that we'd like to remove acontact group from.
 * @param groupToRemove the ContactGroup that we'd like removed.
 * @param sourceProvider the ProtocolProvider that the contact group belongsto.
 */
public void removeContactGroupFromMetaContactGroup(MetaContactGroupImpl metaContainer,ContactGroup groupToRemove,ProtocolProviderService sourceProvider){
  if (metaContainer == null) {
    logger.warn("String_Node_Str" + groupToRemove);
    return;
  }
  locallyRemoveAllContactsForProvider(metaContainer,groupToRemove);
  fireMetaContactGroupEvent(metaContainer,sourceProvider,groupToRemove,MetaContactGroupEvent.CONTACT_GROUP_REMOVED_FROM_META_GROUP);
}
Program: 103030
Project: 103030
Buggy source:
/** 
 * Removes the specified provider from the list of currently known providers and ignores all the contacts that it has registered locally.
 * @param provider the ProtocolProviderService that has been unregistered.
 */
private void handleProviderRemoved(ProtocolProviderService provider){
  if (logger.isDebugEnabled())   logger.debug("String_Node_Str" + provider.getProtocolName());
  this.currentlyInstalledProviders.remove(provider.getAccountID().getAccountUniqueID());
  OperationSetPersistentPresence persPresOpSet=provider.getOperationSet(OperationSetPersistentPresence.class);
  if (persPresOpSet != null) {
    persPresOpSet.removeContactPresenceStatusListener(this);
    persPresOpSet.removeSubscriptionListener(clSubscriptionEventHandler);
    persPresOpSet.removeServerStoredGroupChangeListener(clGroupEventHandler);
    ContactGroup rootGroup=persPresOpSet.getServerStoredContactListRoot();
    Iterator<ContactGroup> subgroups=rootGroup.subgroups();
    while (subgroups.hasNext()) {
      ContactGroup group=subgroups.next();
      this.removeContactGroupFromMetaContactGroup((MetaContactGroupImpl)findMetaContactGroupByContactGroup(group),group,provider);
    }
    this.removeContactGroupFromMetaContactGroup(this.rootMetaGroup,rootGroup,provider);
  }
  OperationSetContactCapabilities capOpSet=provider.getOperationSet(OperationSetContactCapabilities.class);
  if (capOpSet != null)   capOpSet.removeContactCapabilitiesListener(this);
}

Fixed version (ground truth):
/** 
 * Removes the specified provider from the list of currently known providers and ignores all the contacts that it has registered locally.
 * @param provider the ProtocolProviderService that has been unregistered.
 */
private void handleProviderRemoved(ProtocolProviderService provider){
  if (logger.isDebugEnabled())   logger.debug("String_Node_Str" + provider);
  this.currentlyInstalledProviders.remove(provider.getAccountID().getAccountUniqueID());
  OperationSetPersistentPresence persPresOpSet=provider.getOperationSet(OperationSetPersistentPresence.class);
  if (persPresOpSet != null) {
    persPresOpSet.removeContactPresenceStatusListener(this);
    persPresOpSet.removeSubscriptionListener(clSubscriptionEventHandler);
    persPresOpSet.removeServerStoredGroupChangeListener(clGroupEventHandler);
    ContactGroup rootGroup=persPresOpSet.getServerStoredContactListRoot();
    Iterator<ContactGroup> subgroups=rootGroup.subgroups();
    while (subgroups.hasNext()) {
      ContactGroup group=subgroups.next();
      this.removeContactGroupFromMetaContactGroup((MetaContactGroupImpl)findMetaContactGroupByContactGroup(group),group,provider);
    }
    this.removeContactGroupFromMetaContactGroup(this.rootMetaGroup,rootGroup,provider);
  }
  OperationSetContactCapabilities capOpSet=provider.getOperationSet(OperationSetContactCapabilities.class);
  if (capOpSet != null)   capOpSet.removeContactCapabilitiesListener(this);
}
Program: 103031
Project: 103031
Buggy source:
/** 
 * Indicates whether some other object is "equal to" this group.
 * @param obj   the reference object with which to compare.
 * @return  <tt>true</tt> if this object is the same as the objargument; <tt>false</tt> otherwise.
 */
@Override public boolean equals(Object obj){
  if (obj == this)   return true;
  if (obj == null || !(obj instanceof ContactGroupJabberImpl))   return false;
  if (!((ContactGroup)obj).getGroupName().equals(getGroupName()))   return false;
  return true;
}

Fixed version (ground truth):
/** 
 * Indicates whether some other object is "equal to" this group.
 * @param obj   the reference object with which to compare.
 * @return  <tt>true</tt> if this object is the same as the objargument; <tt>false</tt> otherwise.
 */
@Override public boolean equals(Object obj){
  if (obj == this)   return true;
  if (obj == null || !(obj instanceof ContactGroupJabberImpl))   return false;
  if (!((ContactGroup)obj).getGroupName().equals(getGroupName()))   return false;
  if (getProtocolProvider() != ((ContactGroup)obj).getProtocolProvider())   return false;
  return true;
}
Program: 103034
Project: 103034
Buggy source:
/** 
 * Cleans the contactsMap when <tt>ProtocolProviderService</tt> gets unregistered.
 */
public void serviceChanged(ServiceEvent ev){
  Object service=OtrActivator.bundleContext.getService(ev.getServiceReference());
  if (!(service instanceof ProtocolProviderService))   return;
  if (ev.getType() == ServiceEvent.UNREGISTERING) {
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str" + "String_Node_Str");
      logger.debug("String_Node_Str" + "String_Node_Str");
    }
    ProtocolProviderService provider=(ProtocolProviderService)service;
synchronized (contactsMap) {
      Iterator<Contact> i=contactsMap.values().iterator();
      while (i.hasNext()) {
        if (provider.equals(i.next().getProtocolProvider()))         i.remove();
      }
    }
    Iterator<Contact> i=progressDialogMap.keySet().iterator();
    while (i.hasNext()) {
      if (provider.equals(i.next().getProtocolProvider()))       i.remove();
    }
  }
}

Fixed version (ground truth):
/** 
 * Cleans the contactsMap when <tt>ProtocolProviderService</tt> gets unregistered.
 */
public void serviceChanged(ServiceEvent ev){
  Object service=OtrActivator.bundleContext.getService(ev.getServiceReference());
  if (!(service instanceof ProtocolProviderService))   return;
  if (ev.getType() == ServiceEvent.UNREGISTERING) {
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str" + "String_Node_Str");
      logger.debug("String_Node_Str" + "String_Node_Str");
    }
    ProtocolProviderService provider=(ProtocolProviderService)service;
synchronized (contactsMap) {
      Iterator<Contact> i=contactsMap.values().iterator();
      while (i.hasNext()) {
        Contact contact=i.next();
        if (provider.equals(contact.getProtocolProvider())) {
          scSessionStatusMap.remove(getSessionID(contact));
          i.remove();
        }
      }
    }
    Iterator<Contact> i=progressDialogMap.keySet().iterator();
    while (i.hasNext()) {
      if (provider.equals(i.next().getProtocolProvider()))       i.remove();
    }
    scheduler.serviceChanged(ev);
  }
}
Program: 103035
Project: 103035
Buggy source:
/** 
 * Creates an instance of <tt>ConferenceChatSession</tt>, by specifying the sessionRenderer to be used for communication with the UI and the chatRoom corresponding to this conference session.
 * @param sessionRenderer the renderer to be used for communication with theUI.
 * @param chatRoomWrapper the chat room corresponding to this conferencesession.
 */
public ConferenceChatSession(ChatSessionRenderer sessionRenderer,ChatRoomWrapper chatRoomWrapper){
  this.sessionRenderer=sessionRenderer;
  this.chatRoomWrapper=chatRoomWrapper;
  currentChatTransport=new ConferenceChatTransport(this,chatRoomWrapper.getChatRoom());
  chatTransports.add(currentChatTransport);
  this.initChatParticipants();
  ChatRoom chatRoom=chatRoomWrapper.getChatRoom();
  chatRoom.addMemberPresenceListener(this);
  chatRoom.addPropertyChangeListener(this);
  chatRoom.addConferencePublishedListener(this);
}

Fixed version (ground truth):
/** 
 * Creates an instance of <tt>ConferenceChatSession</tt>, by specifying the sessionRenderer to be used for communication with the UI and the chatRoom corresponding to this conference session.
 * @param sessionRenderer the renderer to be used for communication with theUI.
 * @param chatRoomWrapper the chat room corresponding to this conferencesession.
 */
public ConferenceChatSession(ChatSessionRenderer sessionRenderer,ChatRoomWrapper chatRoomWrapper){
  this.sessionRenderer=sessionRenderer;
  this.chatRoomWrapper=chatRoomWrapper;
  currentChatTransport=new ConferenceChatTransport(this,chatRoomWrapper.getChatRoom());
  chatTransports.add(currentChatTransport);
synchronized (this.chatParticipants) {
    this.initChatParticipants();
  }
  ChatRoom chatRoom=chatRoomWrapper.getChatRoom();
  chatRoom.addMemberPresenceListener(this);
  chatRoom.addPropertyChangeListener(this);
  chatRoom.addConferencePublishedListener(this);
}
Program: 103036
Project: 103036
Buggy source:
/** 
 * Initializes the list of participants.
 */
private void initChatParticipants(){
  ChatRoom chatRoom=chatRoomWrapper.getChatRoom();
  if ((chatRoom != null) && chatRoom.isJoined())   for (  ChatRoomMember member : chatRoom.getMembers())   chatParticipants.add(new ConferenceChatContact(member));
}

Fixed version (ground truth):
/** 
 * Initializes the list of participants.(It is assumed that <tt>chatParticipants</tt> is locked.)
 */
private void initChatParticipants(){
  ChatRoom chatRoom=chatRoomWrapper.getChatRoom();
  if ((chatRoom != null) && chatRoom.isJoined())   for (  ChatRoomMember member : chatRoom.getMembers())   chatParticipants.add(new ConferenceChatContact(member));
}
Program: 103037
Project: 103037
Buggy source:
/** 
 * Loads the given chat room in the this chat conference panel. Loads all members and adds all corresponding listeners.
 * @param chatRoom the <tt>ChatRoom</tt> to load
 */
public void loadChatRoom(ChatRoom chatRoom){
  currentChatTransport=new ConferenceChatTransport(this,chatRoomWrapper.getChatRoom());
  chatTransports.clear();
  chatTransports.add(currentChatTransport);
  sessionRenderer.removeAllChatContacts();
  for (  ChatRoomMember member : chatRoom.getMembers()) {
    sessionRenderer.addChatContact(new ConferenceChatContact(member));
  }
  chatRoom.addPropertyChangeListener(this);
  chatRoom.addMemberPresenceListener(this);
  sessionRenderer.setChatSubject(chatRoom.getSubject());
}

Fixed version (ground truth):
/** 
 * Loads the given chat room in the this chat conference panel. Loads all members and adds all corresponding listeners.
 * @param chatRoom the <tt>ChatRoom</tt> to load
 */
public void loadChatRoom(ChatRoom chatRoom){
  currentChatTransport=new ConferenceChatTransport(this,chatRoomWrapper.getChatRoom());
  chatTransports.clear();
  chatTransports.add(currentChatTransport);
synchronized (this.chatParticipants) {
    sessionRenderer.removeAllChatContacts();
    this.chatParticipants.clear();
    for (    ChatRoomMember member : chatRoom.getMembers()) {
      ConferenceChatContact contact=new ConferenceChatContact(member);
      chatParticipants.add(contact);
      sessionRenderer.addChatContact(contact);
    }
  }
  chatRoom.addPropertyChangeListener(this);
  chatRoom.addMemberPresenceListener(this);
  sessionRenderer.setChatSubject(chatRoom.getSubject());
}
Program: 103039
Project: 103039
Buggy source:
public ContactSearchFieldUI(){
  String callButtonEnabledString=UtilActivator.getResources().getSettingsString("String_Node_Str");
  if ((callButtonEnabledString != null) && (callButtonEnabledString.length() > 0)) {
    isCallButtonEnabled=!Boolean.parseBoolean(callButtonEnabledString);
  }
  loadSkin();
}

Fixed version (ground truth):
public ContactSearchFieldUI(){
  String callButtonEnabledString=UtilActivator.getResources().getSettingsString("String_Node_Str");
  if ((callButtonEnabledString != null) && (callButtonEnabledString.length() > 0)) {
    setCallButtonEnabled(!Boolean.parseBoolean(callButtonEnabledString));
  }
  loadSkin();
}
Program: 103040
Project: 103040
Buggy source:
/** 
 * Paints the background of the associated component.
 * @param g the <tt>Graphics</tt> object used for painting
 */
@Override protected void customPaintBackground(Graphics g){
  isCallButtonEnabled=CallManager.getTelephonyProviders().size() > 0;
  setSMSButtonEnabled(GuiActivator.getUIService().getMainFrame().hasOperationSet(OperationSetSmsMessaging.class));
  super.customPaintBackground(g);
}

Fixed version (ground truth):
/** 
 * Paints the background of the associated component.
 * @param g the <tt>Graphics</tt> object used for painting
 */
@Override protected void customPaintBackground(Graphics g){
  setSMSButtonEnabled(GuiActivator.getUIService().getMainFrame().hasOperationSet(OperationSetSmsMessaging.class));
  super.customPaintBackground(g);
}
Program: 103041
Project: 103041
Buggy source:
/** 
 * Creates the <tt>SearchField</tt>.
 * @param frame the main application window
 * @param searchFilter the filter to apply on search
 * @param isCallButtonEnabled indicates if the call button should beenabled in this search field
 */
public SearchField(MainFrame frame,ContactListSearchFilter searchFilter,boolean isCallButtonEnabled){
  super(GuiActivator.getResources().getI18NString("String_Node_Str"));
  this.mainFrame=frame;
  this.searchFilter=searchFilter;
  if (getUI() instanceof ContactSearchFieldUI) {
    ((ContactSearchFieldUI)getUI()).setDeleteButtonEnabled(true);
    ((ContactSearchFieldUI)getUI()).setCallButtonEnabled(isCallButtonEnabled);
  }
  this.setBorder(null);
  this.setOpaque(false);
  this.setDragEnabled(true);
  this.addTextChangeListener(this);
  InputMap imap=getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
  imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,0),"String_Node_Str");
  ActionMap amap=getActionMap();
  amap.put("String_Node_Str",new AbstractAction(){
    public void actionPerformed(    ActionEvent e){
      setText("String_Node_Str");
      if (SearchField.this.mainFrame != null)       SearchField.this.mainFrame.requestFocusInContactList();
    }
  }
);
  loadSkin();
}

Fixed version (ground truth):
/** 
 * Creates the <tt>SearchField</tt>.
 * @param frame the main application window
 * @param searchFilter the filter to apply on search
 * @param isCallButtonEnabled indicates if the call button should beenabled in this search field
 */
public SearchField(MainFrame frame,ContactListSearchFilter searchFilter,boolean isCallButtonEnabled){
  super(GuiActivator.getResources().getI18NString("String_Node_Str"));
  this.mainFrame=frame;
  this.searchFilter=searchFilter;
  if (getUI() instanceof ContactSearchFieldUI) {
    ((ContactSearchFieldUI)getUI()).setupListeners();
    ((ContactSearchFieldUI)getUI()).setDeleteButtonEnabled(true);
    ((ContactSearchFieldUI)getUI()).setCallButtonEnabled(isCallButtonEnabled);
  }
  this.setBorder(null);
  this.setOpaque(false);
  this.setDragEnabled(true);
  this.addTextChangeListener(this);
  InputMap imap=getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
  imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,0),"String_Node_Str");
  ActionMap amap=getActionMap();
  amap.put("String_Node_Str",new AbstractAction(){
    public void actionPerformed(    ActionEvent e){
      setText("String_Node_Str");
      if (SearchField.this.mainFrame != null)       SearchField.this.mainFrame.requestFocusInContactList();
    }
  }
);
  loadSkin();
}
Program: 103042
Project: 103042
Buggy source:
/** 
 * Paints the background of the associated component.
 * @param g the <tt>Graphics</tt> object used for painting
 */
@Override protected void customPaintBackground(Graphics g){
  Graphics2D g2=(Graphics2D)g.create();
  try {
    AntialiasingManager.activateAntialiasing(g2);
    super.customPaintBackground(g2);
    JTextComponent c=this.getComponent();
    int dy=(c.getY() + c.getHeight()) / 2 - searchIcon.getIconHeight() / 2;
    g2.drawImage(searchIcon.getImage(),3,dy,null);
    if (c.getText() != null && c.getText().length() > 0 && isSMSButtonEnabled) {
      Rectangle smsRect=getSMSButtonRect();
      int dx=smsRect.x;
      dy=smsRect.y;
      if (isSMSMousePressed)       g2.drawImage(smsPressedIcon,dx,dy,null);
 else       if (isSMSMouseOver) {
        g2.drawImage(smsRolloverIcon,dx,dy,null);
      }
 else       g2.drawImage(smsIcon,dx,dy,null);
      isSMSIconVisible=true;
    }
 else     isSMSIconVisible=false;
    if (c.getText() != null && c.getText().length() > 0 && isCallButtonEnabled) {
      Rectangle callRect=getCallButtonRect();
      int dx=callRect.x;
      dy=callRect.y;
      if (isCallMousePressed)       g2.drawImage(callPressedIcon,dx,dy,null);
 else       if (isCallMouseOver)       g2.drawImage(callRolloverIcon,dx,dy,null);
 else       g2.drawImage(callIcon,dx,dy,null);
      g2.drawImage(separatorIcon,dx + callRect.width + 3,dy + (callRect.height - separatorIcon.getHeight(null)) / 2,null);
      isCallIconVisible=true;
    }
 else     isCallIconVisible=false;
  }
  finally {
    g2.dispose();
  }
}

Fixed version (ground truth):
/** 
 * Paints the background of the associated component.
 * @param g the <tt>Graphics</tt> object used for painting
 */
@Override protected void customPaintBackground(Graphics g){
  Graphics2D g2=(Graphics2D)g.create();
  try {
    AntialiasingManager.activateAntialiasing(g2);
    super.customPaintBackground(g2);
    JTextComponent c=this.getComponent();
    int dy=c.getHeight() / 2 - searchIcon.getIconHeight() / 2;
    g2.drawImage(searchIcon.getImage(),3,dy,null);
    if (c.getText() != null && c.getText().length() > 0 && isSMSButtonEnabled) {
      Rectangle smsRect=getSMSButtonRect();
      int dx=smsRect.x;
      dy=smsRect.y;
      if (isSMSMousePressed)       g2.drawImage(smsPressedIcon,dx,dy,null);
 else       if (isSMSMouseOver) {
        g2.drawImage(smsRolloverIcon,dx,dy,null);
      }
 else       g2.drawImage(smsIcon,dx,dy,null);
      isSMSIconVisible=true;
    }
 else     isSMSIconVisible=false;
    if (c.getText() != null && c.getText().length() > 0 && isCallButtonEnabled) {
      Rectangle callRect=getCallButtonRect();
      int dx=callRect.x;
      dy=callRect.y;
      if (isCallMousePressed)       g2.drawImage(callPressedIcon,dx,dy,null);
 else       if (isCallMouseOver)       g2.drawImage(callRolloverIcon,dx,dy,null);
 else       g2.drawImage(callIcon,dx,dy,null);
      g2.drawImage(separatorIcon,dx + callRect.width + 3,dy + (callRect.height - separatorIcon.getHeight(null)) / 2,null);
      isCallIconVisible=true;
    }
 else     isCallIconVisible=false;
  }
  finally {
    g2.dispose();
  }
}
Program: 103043
Project: 103043
Buggy source:
/** 
 * Calculates the call button rectangle.
 * @return the call button rectangle
 */
protected Rectangle getCallButtonRect(){
  Component c=getComponent();
  Rectangle rect=c.getBounds();
  int dx=getDeleteButtonRect().x - callRolloverIcon.getWidth(null) - 8;
  int dy=(rect.y + rect.height) / 2 - callRolloverIcon.getHeight(null) / 2;
  return new Rectangle(dx,dy,callRolloverIcon.getWidth(null),callRolloverIcon.getHeight(null));
}

Fixed version (ground truth):
/** 
 * Calculates the call button rectangle.
 * @return the call button rectangle
 */
protected Rectangle getCallButtonRect(){
  Component c=getComponent();
  Rectangle rect=c.getBounds();
  int dx=getDeleteButtonRect().x - callRolloverIcon.getWidth(null) - 8;
  int dy=(rect.height) / 2 - callRolloverIcon.getHeight(null) / 2;
  return new Rectangle(dx,dy,callRolloverIcon.getWidth(null),callRolloverIcon.getHeight(null));
}
Program: 103044
Project: 103044
Buggy source:
/** 
 * Enables/disabled the call button in the search field.
 * @param isEnabled indicates if the call button is enabled
 */
public void setCallButtonEnabled(boolean isEnabled){
  this.isCallButtonEnabled=isEnabled;
}

Fixed version (ground truth):
/** 
 * Enables/disabled the call button in the search field.
 * @param isEnabled indicates if the call button is enabled
 */
public void setCallButtonEnabled(boolean isEnabled){
  JTextComponent c=this.getComponent();
  if (isCallButtonEnabled != isEnabled) {
    this.isCallButtonEnabled=isEnabled;
    loadSkin();
    if (c != null && c.isVisible())     c.repaint();
  }
}
Program: 103045
Project: 103045
Buggy source:
/** 
 * Gets the SSRCs of RTP streams with a specific <tt>MediaType</tt> known to be received by a <tt>MediaStream</tt> associated with this instance. <p> <b>Warning</b>: The method may return only one of the many possible remote SSRCs in the case of no utilization of the Jitsi Videobridge server-side technology because the super implementation does not currently provide support for keeping track of multiple remote SSRCs. </p>
 * @param mediaType the <tt>MediaType</tt> of the RTP streams the SSRCs ofwhich are to be returned
 * @return an array of <tt>long</tt> values which represent the SSRCs of RTPstreams with the specified <tt>mediaType</tt> known to be received by a <tt>MediaStream</tt> associated with this instance
 */
public long[] getRemoteSSRCs(MediaType mediaType){
  ColibriConferenceIQ.Channel channel=getColibriChannel(mediaType);
  if (channel != null)   return channel.getSSRCs();
  long ssrc=super.getRemoteSSRC(mediaType);
  return (ssrc == SSRC_UNKNOWN) ? ColibriConferenceIQ.NO_SSRCS : new long[]{ssrc};
}

Fixed version (ground truth):
/** 
 * Gets the SSRCs of RTP streams with a specific <tt>MediaType</tt> known to be received by a <tt>MediaStream</tt> associated with this instance. <p> <b>Warning</b>: The method may return only one of the many possible remote SSRCs in the case of no utilization of the Jitsi Videobridge server-side technology because the super implementation does not currently provide support for keeping track of multiple remote SSRCs. </p>
 * @param mediaType the <tt>MediaType</tt> of the RTP streams the SSRCs ofwhich are to be returned
 * @return an array of <tt>int</tt> values which represent the SSRCs of RTPstreams with the specified <tt>mediaType</tt> known to be received by a <tt>MediaStream</tt> associated with this instance
 */
private int[] getRemoteSSRCs(MediaType mediaType){
  ColibriConferenceIQ.Channel channel=getColibriChannel(mediaType);
  if (channel != null)   return channel.getSSRCs();
  long ssrc=super.getRemoteSSRC(mediaType);
  return (ssrc == SSRC_UNKNOWN) ? ColibriConferenceIQ.NO_SSRCS : new int[]{(int)ssrc};
}
Program: 103046
Project: 103046
Buggy source:
/** 
 * {@inheritDoc}In the case of a telephony conference organized by the local peer/user via the Jitsi Videobridge server-side technology, returns an SSRC reported by the server as received on the channel allocated by the local peer/user for the purposes of communicating with the <tt>CallPeer</tt> associated with this instance.
 */
@Override public long getRemoteSSRC(MediaType mediaType){
  long[] ssrcs=getRemoteSSRCs(mediaType);
  for (int i=ssrcs.length - 1; i >= 0; i--) {
    long ssrc=ssrcs[i];
    if (ssrc != SSRC_UNKNOWN)     return ssrc;
  }
  return getPeer().isJitsiVideobridge() ? SSRC_UNKNOWN : super.getRemoteSSRC(mediaType);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}In the case of a telephony conference organized by the local peer/user via the Jitsi Videobridge server-side technology, returns an SSRC reported by the server as received on the channel allocated by the local peer/user for the purposes of communicating with the <tt>CallPeer</tt> associated with this instance.
 */
@Override public long getRemoteSSRC(MediaType mediaType){
  int[] ssrcs=getRemoteSSRCs(mediaType);
  if (ssrcs.length != 0)   return 0xFFFFFFFFL & ssrcs[ssrcs.length - 1];
  return getPeer().isJitsiVideobridge() ? SSRC_UNKNOWN : super.getRemoteSSRC(mediaType);
}
Program: 103047
Project: 103047
Buggy source:
/** 
 * {@inheritDoc}In the case of utilization of the Jitsi Videobridge server-side technology, returns the visual <tt>Component</tt>s which display RTP video streams reported by the server to be sent by the remote peer represented by this instance.
 */
@Override public List<Component> getVisualComponents(){
  CallJabberImpl call;
  MediaAwareCallConference conference;
  if (((call=getPeer().getCall()) != null) && ((conference=call.getConference()) != null) && conference.isJitsiVideobridge()) {
    MediaStream stream=getStream(MediaType.VIDEO);
    if (stream == null)     return Collections.emptyList();
 else {
      long[] remoteSSRCs=getRemoteSSRCs(MediaType.VIDEO);
      if (remoteSSRCs.length == 0)       return Collections.emptyList();
 else {
        VideoMediaStream videoStream=(VideoMediaStream)stream;
        List<Component> visualComponents=new LinkedList<Component>();
        for (        long remoteSSRC : remoteSSRCs) {
          if (remoteSSRC != -1) {
            Component visualComponent=videoStream.getVisualComponent(remoteSSRC);
            if (visualComponent != null)             visualComponents.add(visualComponent);
          }
        }
        return visualComponents;
      }
    }
  }
  return super.getVisualComponents();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}In the case of utilization of the Jitsi Videobridge server-side technology, returns the visual <tt>Component</tt>s which display RTP video streams reported by the server to be sent by the remote peer represented by this instance.
 */
@Override public List<Component> getVisualComponents(){
  CallJabberImpl call;
  MediaAwareCallConference conference;
  if (((call=getPeer().getCall()) != null) && ((conference=call.getConference()) != null) && conference.isJitsiVideobridge()) {
    MediaStream stream=getStream(MediaType.VIDEO);
    if (stream == null)     return Collections.emptyList();
 else {
      int[] remoteSSRCs=getRemoteSSRCs(MediaType.VIDEO);
      if (remoteSSRCs.length == 0)       return Collections.emptyList();
 else {
        VideoMediaStream videoStream=(VideoMediaStream)stream;
        List<Component> visualComponents=new LinkedList<Component>();
        for (int i=0; i < remoteSSRCs.length; i++) {
          int remoteSSRC=remoteSSRCs[i];
          Component visualComponent=videoStream.getVisualComponent(0xFFFFFFFFL & remoteSSRC);
          if (visualComponent != null)           visualComponents.add(visualComponent);
        }
        return visualComponents;
      }
    }
  }
  return super.getVisualComponents();
}
Program: 103049
Project: 103049
Buggy source:
/** 
 * Gets the <tt>direction</tt> of this <tt>Channel</tt>.
 * @return the <tt>direction</tt> of this <tt>Channel</tt>.
 */
public MediaDirection getDirection(){
  return direction == null ? MediaDirection.SENDRECV : direction;
}

Fixed version (ground truth):
/** 
 * Gets the <tt>direction</tt> of this <tt>Channel</tt>.
 * @return the <tt>direction</tt> of this <tt>Channel</tt>.
 */
public MediaDirection getDirection(){
  return (direction == null) ? MediaDirection.SENDRECV : direction;
}
Program: 103050
Project: 103050
Buggy source:
/** 
 * Sets the list of (RTP) SSRCs seen/received on this <tt>Channel</tt>.
 * @param ssrcs the list of (RTP) SSRCs to be set as seen/received onthis <tt>Channel</tt>
 */
public void setSSRCs(long[] ssrcs){
  this.ssrcs=((ssrcs == null) || (ssrcs.length == 0)) ? NO_SSRCS : ssrcs.clone();
}

Fixed version (ground truth):
/** 
 * Sets the list of (RTP) SSRCs seen/received on this <tt>Channel</tt>.
 * @param ssrcs the list of (RTP) SSRCs to be set as seen/received onthis <tt>Channel</tt>
 */
public void setSSRCs(int[] ssrcs){
  this.ssrcs=((ssrcs == null) || (ssrcs.length == 0)) ? NO_SSRCS : ssrcs.clone();
}
Program: 103051
Project: 103051
Buggy source:
/** 
 * Removes a specific (RTP) SSRC from the list of SSRCs seen/received on this <tt>Channel</tt>. Invoked by the Jitsi Videobridge server, not its clients.
 * @param ssrc the (RTP) SSRC to be removed from the list of SSRCsseen/received on this <tt>Channel</tt>
 * @return <tt>true</tt> if the list of SSRCs seen/received on this<tt>Channel</tt> has been modified as part of the method call; otherwise, <tt>false</tt>
 */
public synchronized boolean removeSSRC(long ssrc){
  if (ssrcs.length == 1) {
    if (ssrcs[0] == ssrc) {
      ssrcs=NO_SSRCS;
      return true;
    }
 else     return false;
  }
 else {
    for (int i=0; i < ssrcs.length; i++) {
      if (ssrcs[i] == ssrc) {
        long[] newSSRCs=new long[ssrcs.length - 1];
        if (i != 0)         System.arraycopy(ssrcs,0,newSSRCs,0,i);
        if (i != newSSRCs.length) {
          System.arraycopy(ssrcs,i + 1,newSSRCs,i,newSSRCs.length - i);
        }
        ssrcs=newSSRCs;
        return true;
      }
    }
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Removes a specific (RTP) SSRC from the list of SSRCs seen/received on this <tt>Channel</tt>. Invoked by the Jitsi Videobridge server, not its clients.
 * @param ssrc the (RTP) SSRC to be removed from the list of SSRCsseen/received on this <tt>Channel</tt>
 * @return <tt>true</tt> if the list of SSRCs seen/received on this<tt>Channel</tt> has been modified as part of the method call; otherwise, <tt>false</tt>
 */
public synchronized boolean removeSSRC(int ssrc){
  if (ssrcs.length == 1) {
    if (ssrcs[0] == ssrc) {
      ssrcs=NO_SSRCS;
      return true;
    }
 else     return false;
  }
 else {
    for (int i=0; i < ssrcs.length; i++) {
      if (ssrcs[i] == ssrc) {
        int[] newSSRCs=new int[ssrcs.length - 1];
        if (i != 0)         System.arraycopy(ssrcs,0,newSSRCs,0,i);
        if (i != newSSRCs.length) {
          System.arraycopy(ssrcs,i + 1,newSSRCs,i,newSSRCs.length - i);
        }
        ssrcs=newSSRCs;
        return true;
      }
    }
    return false;
  }
}
Program: 103052
Project: 103052
Buggy source:
/** 
 * Gets (a copy of) the list of (RTP) SSRCs seen/received on this <tt>Channel</tt>.
 * @return an array of <tt>long</tt>s which represents (a copy of) thelist of (RTP) SSRCs seen/received on this <tt>Channel</tt>
 */
public synchronized long[] getSSRCs(){
  return (ssrcs.length == 0) ? NO_SSRCS : ssrcs.clone();
}

Fixed version (ground truth):
/** 
 * Gets (a copy of) the list of (RTP) SSRCs seen/received on this <tt>Channel</tt>.
 * @return an array of <tt>int</tt>s which represents (a copy of) thelist of (RTP) SSRCs seen/received on this <tt>Channel</tt>
 */
public synchronized int[] getSSRCs(){
  return (ssrcs.length == 0) ? NO_SSRCS : ssrcs.clone();
}
Program: 103053
Project: 103053
Buggy source:
/** 
 * Adds a specific (RTP) SSRC to the list of SSRCs seen/received on this <tt>Channel</tt>. Invoked by the Jitsi Videobridge server, not its clients.
 * @param ssrc the (RTP) SSRC to be added to the list of SSRCsseen/received on this <tt>Channel</tt>
 * @return <tt>true</tt> if the list of SSRCs seen/received on this<tt>Channel</tt> has been modified as part of the method call; otherwise, <tt>false</tt>
 */
public synchronized boolean addSSRC(long ssrc){
  for (  long element : ssrcs)   if (element == ssrc)   return false;
  long[] newSSRCs=new long[ssrcs.length + 1];
  System.arraycopy(ssrcs,0,newSSRCs,0,ssrcs.length);
  newSSRCs[ssrcs.length]=ssrc;
  ssrcs=newSSRCs;
  return true;
}

Fixed version (ground truth):
/** 
 * Adds a specific (RTP) SSRC to the list of SSRCs seen/received on this <tt>Channel</tt>. Invoked by the Jitsi Videobridge server, not its clients.
 * @param ssrc the (RTP) SSRC to be added to the list of SSRCsseen/received on this <tt>Channel</tt>
 * @return <tt>true</tt> if the list of SSRCs seen/received on this<tt>Channel</tt> has been modified as part of the method call; otherwise, <tt>false</tt>
 */
public synchronized boolean addSSRC(int ssrc){
  for (int i=0; i < ssrcs.length; i++)   if (ssrcs[i] == ssrc)   return false;
  int[] newSSRCs=new int[ssrcs.length + 1];
  System.arraycopy(ssrcs,0,newSSRCs,0,ssrcs.length);
  newSSRCs[ssrcs.length]=ssrc;
  ssrcs=newSSRCs;
  return true;
}
Program: 103056
Project: 103056
Buggy source:
/** 
 * Adds a <tt>ConferenceDescription</tt> to the list of conferences.
 * @param chatConference the <tt>ConferenceDescription</tt> to add
 */
public void addConference(ConferenceDescription conferenceDescription){
  chatConferenceListPanel.addConference(conferenceDescription);
}

Fixed version (ground truth):
/** 
 * Adds a <tt>ConferenceDescription</tt> to the list of conferences.
 * @param conferenceDescription the <tt>ConferenceDescription</tt> to add
 */
public void addConference(ConferenceDescription conferenceDescription){
  chatConferenceListPanel.addConference(conferenceDescription);
}
Program: 103057
Project: 103057
Buggy source:
/** 
 * Joins an existing chat room conference call.
 */
private void joinConference(){
  ConferenceDescription chatConference=(ConferenceDescription)chatConferenceListPanel.getSelectedValue();
  if (chatConference != null)   CallManager.call(chatPanel.getChatSession().getCurrentChatTransport().getProtocolProvider(),chatConference,chatRoom);
}

Fixed version (ground truth):
/** 
 * Joins an existing chat room conference call.
 */
private void joinConference(){
  ConferenceDescription chatConference=chatConferenceListPanel.getSelectedValue();
  if (chatConference != null)   CallManager.call(chatPanel.getChatSession().getCurrentChatTransport().getProtocolProvider(),chatConference,chatRoom);
}
Program: 103058
Project: 103058
Buggy source:
/** 
 * Creates an instance of <tt>ChatRoomQuery</tt> by specifying the parent contact source, the query string to match and the maximum result contacts to return.
 * @param contactSource the parent contact source
 * @param queryString the query string to match
 * @param contactCount the maximum result contact count
 */
public ChatRoomQuery(String queryString,int count,ChatRoomContactSourceService contactSource){
  super(contactSource,Pattern.compile(queryString,Pattern.CASE_INSENSITIVE | Pattern.LITERAL),true);
  this.count=count;
  this.queryString=queryString;
  for (  ProtocolProviderService pps : MUCActivator.getChatRoomProviders()) {
    OperationSetMultiUserChat opSetMUC=(OperationSetMultiUserChat)pps.getOperationSet(OperationSetMultiUserChat.class);
    if (opSetMUC != null) {
      opSetMUC.addPresenceListener(this);
    }
  }
  MUCActivator.getMUCService().addChatRoomListChangeListener(this);
}

Fixed version (ground truth):
/** 
 * Creates an instance of <tt>ChatRoomQuery</tt> by specifying the parent contact source, the query string to match and the maximum result contacts to return.
 * @param contactSource the parent contact source
 * @param queryString the query string to match
 * @param count the maximum result contact count
 */
public ChatRoomQuery(String queryString,int count,ChatRoomContactSourceService contactSource){
  super(contactSource,Pattern.compile(queryString,Pattern.CASE_INSENSITIVE | Pattern.LITERAL),true);
  this.count=count;
  this.queryString=queryString;
  for (  ProtocolProviderService pps : MUCActivator.getChatRoomProviders()) {
    OperationSetMultiUserChat opSetMUC=pps.getOperationSet(OperationSetMultiUserChat.class);
    if (opSetMUC != null) {
      opSetMUC.addPresenceListener(this);
    }
  }
  MUCActivator.getMUCService().addChatRoomListChangeListener(this);
}
Program: 103059
Project: 103059
Buggy source:
@Override protected void run(){
  ConfigurationService configService=MUCActivator.getConfigurationService();
  String prefix="String_Node_Str";
  List<String> accounts=configService.getPropertyNamesByPrefix(prefix,true);
  for (  ProtocolProviderService pps : MUCActivator.getChatRoomProviders()) {
    for (    String accountRootPropName : accounts) {
      String accountUID=configService.getString(accountRootPropName);
      if (accountUID.equals(pps.getAccountID().getAccountUniqueID())) {
        List<String> chatRooms=configService.getPropertyNamesByPrefix(accountRootPropName + "String_Node_Str",true);
        for (        String chatRoomPropName : chatRooms) {
          if (count > 0 && getQueryResultCount() > count) {
            if (getStatus() != QUERY_CANCELED)             setStatus(QUERY_COMPLETED);
            return;
          }
          addChatRoom(pps,configService.getString(chatRoomPropName + "String_Node_Str"),configService.getString(chatRoomPropName));
        }
      }
    }
  }
  if (getStatus() != QUERY_CANCELED)   setStatus(QUERY_COMPLETED);
}

Fixed version (ground truth):
@Override protected void run(){
  Iterator<ChatRoomProviderWrapper> chatRoomProviders=MUCActivator.getMUCService().getChatRoomList().getChatRoomProviders();
  while (chatRoomProviders.hasNext()) {
    ChatRoomProviderWrapper provider=chatRoomProviders.next();
    for (int i=0; i < provider.countChatRooms(); i++) {
      if (count > 0 && getQueryResultCount() > count) {
        if (getStatus() != QUERY_CANCELED)         setStatus(QUERY_COMPLETED);
        return;
      }
      ChatRoomWrapper chatRoom=provider.getChatRoom(i);
      addChatRoom(provider.getProtocolProvider(),chatRoom.getChatRoomName(),chatRoom.getChatRoomID());
    }
  }
  if (getStatus() != QUERY_CANCELED)   setStatus(QUERY_COMPLETED);
}
Program: 103060
Project: 103060
Buggy source:
/** 
 * Returns a reference to a CredentialsStorageService implementation currently registered in the bundle context or null if no such implementation was found.
 * @return a currently valid implementation of theCredentialsStorageService.
 */
public static CredentialsStorageService getCredentialsStorageService(){
  if (credentialsService == null) {
    credentialsService=(CredentialsStorageService)ServiceUtils.getService(bundleContext,CredentialsStorageService.class);
  }
  return credentialsService;
}

Fixed version (ground truth):
/** 
 * Returns a reference to a CredentialsStorageService implementation currently registered in the bundle context or null if no such implementation was found.
 * @return a currently valid implementation of theCredentialsStorageService.
 */
public static CredentialsStorageService getCredentialsStorageService(){
  if (credentialsService == null) {
    credentialsService=ServiceUtils.getService(bundleContext,CredentialsStorageService.class);
  }
  return credentialsService;
}
Program: 103061
Project: 103061
Buggy source:
/** 
 * @override {@link SwingWorker}{@link #doInBackground()} to performall asynchronous tasks.
 * @return SUCCESS if success, otherwise the error code
 */
@Override public void run(){
  ChatRoom chatRoom=chatRoomWrapper.getChatRoom();
  try {
    if (password != null && password.length > 0)     chatRoom.joinAs(nickName,password);
 else     if (nickName != null)     chatRoom.joinAs(nickName);
 else     chatRoom.join();
    done(SUCCESS);
  }
 catch (  OperationFailedException e) {
    if (logger.isTraceEnabled())     logger.trace("String_Node_Str" + chatRoom.getName(),e);
switch (e.getErrorCode()) {
case OperationFailedException.AUTHENTICATION_FAILED:
      done(AUTHENTICATION_FAILED);
case OperationFailedException.REGISTRATION_REQUIRED:
    done(REGISTRATION_REQUIRED);
case OperationFailedException.PROVIDER_NOT_REGISTERED:
  done(PROVIDER_NOT_REGISTERED);
case OperationFailedException.SUBSCRIPTION_ALREADY_EXISTS:
done(SUBSCRIPTION_ALREADY_EXISTS);
default :
done(UNKNOWN_ERROR);
}
}
}

Fixed version (ground truth):
/** 
 * @override {@link Thread}{@link #run()} to perform all asynchronous tasks.
 */
@Override public void run(){
  ChatRoom chatRoom=chatRoomWrapper.getChatRoom();
  try {
    if (password != null && password.length > 0)     chatRoom.joinAs(nickName,password);
 else     if (nickName != null)     chatRoom.joinAs(nickName);
 else     chatRoom.join();
    done(SUCCESS);
  }
 catch (  OperationFailedException e) {
    if (logger.isTraceEnabled())     logger.trace("String_Node_Str" + chatRoom.getName(),e);
switch (e.getErrorCode()) {
case OperationFailedException.AUTHENTICATION_FAILED:
      done(AUTHENTICATION_FAILED);
    break;
case OperationFailedException.REGISTRATION_REQUIRED:
  done(REGISTRATION_REQUIRED);
break;
case OperationFailedException.PROVIDER_NOT_REGISTERED:
done(PROVIDER_NOT_REGISTERED);
break;
case OperationFailedException.SUBSCRIPTION_ALREADY_EXISTS:
done(SUBSCRIPTION_ALREADY_EXISTS);
break;
default :
done(UNKNOWN_ERROR);
}
}
}