nus-yam/ex-repair huggingface dataset:
Program: 103241
Project: 103241
Buggy source:
/** 
 * Determines the exact type of the change and acts accordingly by either updating group name or .
 * @param evt the MetaContactListEvent containing the corresponding contact
 */
public void metaContactGroupModified(MetaContactGroupEvent evt){
  MetaContactGroup mcGroup=evt.getSourceMetaContactGroup();
  Element mcGroupNode=findMetaContactGroupNode(mcGroup.getMetaUID());
  if (mcGroupNode == null) {
    logger.error("String_Node_Str" + mcGroup);
    if (logger.isTraceEnabled())     logger.trace("String_Node_Str",new Exception());
    return;
  }
switch (evt.getEventID()) {
case MetaContactGroupEvent.CONTACT_GROUP_REMOVED_FROM_META_GROUP:
case MetaContactGroupEvent.CONTACT_GROUP_ADDED_TO_META_GROUP:
    Node parentNode=mcGroupNode.getParentNode();
  parentNode.removeChild(mcGroupNode);
Element newGroupElement=createMetaContactGroupNode(mcGroup);
parentNode.appendChild(newGroupElement);
try {
scheduleContactListStorage();
}
 catch (IOException ex) {
logger.error("String_Node_Str" + mcGroup,ex);
}
break;
case MetaContactGroupEvent.META_CONTACT_GROUP_RENAMED:
mcGroupNode.setAttribute(GROUP_NAME_ATTR_NAME,mcGroup.getGroupName());
break;
case MetaContactGroupEvent.CONTACT_GROUP_RENAMED_IN_META_GROUP:
break;
}
try {
scheduleContactListStorage();
}
 catch (IOException ex) {
logger.error("String_Node_Str" + mcGroup.getGroupName(),ex);
}
}

Fixed version (ground truth):
/** 
 * Determines the exact type of the change and acts accordingly by either updating group name or .
 * @param evt the MetaContactListEvent containing the corresponding contact
 */
public void metaContactGroupModified(MetaContactGroupEvent evt){
  MetaContactGroup mcGroup=evt.getSourceMetaContactGroup();
  Element mcGroupNode=findMetaContactGroupNode(mcGroup.getMetaUID());
  if (mcGroupNode == null) {
    logger.error("String_Node_Str" + mcGroup);
    if (logger.isTraceEnabled())     logger.trace("String_Node_Str",new Exception());
    return;
  }
switch (evt.getEventID()) {
case MetaContactGroupEvent.CONTACT_GROUP_RENAMED_IN_META_GROUP:
case MetaContactGroupEvent.CONTACT_GROUP_REMOVED_FROM_META_GROUP:
case MetaContactGroupEvent.CONTACT_GROUP_ADDED_TO_META_GROUP:
    Node parentNode=mcGroupNode.getParentNode();
  parentNode.removeChild(mcGroupNode);
Element newGroupElement=createMetaContactGroupNode(mcGroup);
parentNode.appendChild(newGroupElement);
try {
scheduleContactListStorage();
}
 catch (IOException ex) {
logger.error("String_Node_Str" + mcGroup,ex);
}
break;
case MetaContactGroupEvent.META_CONTACT_GROUP_RENAMED:
mcGroupNode.setAttribute(GROUP_NAME_ATTR_NAME,mcGroup.getGroupName());
break;
}
try {
scheduleContactListStorage();
}
 catch (IOException ex) {
logger.error("String_Node_Str" + mcGroup.getGroupName(),ex);
}
}
Program: 103242
Project: 103242
Buggy source:
/** 
 * Determines whether or not this meta group contains only groups that are being stored by a server.
 * @return true if the meta group is persistent and false otherwise.
 */
public boolean isPersistent(){
  Iterator<ContactGroup> contactGroupsIter=getContactGroups();
  while (contactGroupsIter.hasNext()) {
    ContactGroup contactGroup=contactGroupsIter.next();
    if (contactGroup.isPersistent())     return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Determines whether or not this meta group contains only groups that are being stored by a server.
 * @return true if the meta group is persistent and false otherwise.
 */
public boolean isPersistent(){
  Iterator<ContactGroup> contactGroupsIter=getContactGroups();
  while (contactGroupsIter.hasNext()) {
    ContactGroup contactGroup=contactGroupsIter.next();
    if (contactGroup.isPersistent())     return true;
  }
  if (countContactGroups() == 0)   return true;
 else   return false;
}
Program: 103243
Project: 103243
Buggy source:
/** 
 * Renames the specified <tt>MetaContactGroup</tt> as indicated by the <tt>newName</tt> param. The operation would only affect the local meta group and would not "touch" any encapsulated protocol specific group. <p>
 * @param group the group to rename.
 * @param newGroupName the new name of the <tt>MetaContactGroup</tt> torename.
 */
public void renameMetaContactGroup(MetaContactGroup group,String newGroupName){
  ((MetaContactGroupImpl)group).setGroupName(newGroupName);
  fireMetaContactGroupEvent(group,null,null,MetaContactGroupEvent.META_CONTACT_GROUP_RENAMED);
}

Fixed version (ground truth):
/** 
 * Renames the specified <tt>MetaContactGroup</tt> as indicated by the <tt>newName</tt> param. The operation would only affect the local meta group and would not "touch" any encapsulated protocol specific group. <p>
 * @param group the group to rename.
 * @param newGroupName the new name of the <tt>MetaContactGroup</tt> torename.
 */
public void renameMetaContactGroup(MetaContactGroup group,String newGroupName){
  ((MetaContactGroupImpl)group).setGroupName(newGroupName);
  Iterator<ContactGroup> groups=group.getContactGroups();
  while (groups.hasNext()) {
    ContactGroup protoGroup=groups.next();
    OperationSetPersistentPresence opSetPresence=protoGroup.getProtocolProvider().getOperationSet(OperationSetPersistentPresence.class);
    if (opSetPresence != null) {
      try {
        opSetPresence.renameServerStoredContactGroup(protoGroup,newGroupName);
      }
 catch (      Throwable t) {
        logger.error("String_Node_Str" + protoGroup,t);
      }
    }
  }
  fireMetaContactGroupEvent(group,null,null,MetaContactGroupEvent.META_CONTACT_GROUP_RENAMED);
}
Program: 103244
Project: 103244
Buggy source:
public void run(){
  int resultCount=0;
  queryMetaContactSource(filterPattern,GuiActivator.getContactListService().getRoot(),query,resultCount);
  if (!query.isCanceled())   query.fireQueryEvent(MetaContactQueryStatusEvent.QUERY_COMPLETED);
 else   query.fireQueryEvent(MetaContactQueryStatusEvent.QUERY_CANCELED);
}

Fixed version (ground truth):
public void run(){
  metaContactMoved(evt);
}
Program: 103246
Project: 103246
Buggy source:
/** 
 * Change the source group change the buddies
 * @param newGroup RosterGroup
 */
void setSourceGroup(RosterGroup newGroup){
  this.id=newGroup.getName();
  buddies.clear();
  for (  RosterEntry item : newGroup.getEntries())   addContact(new ContactJabberImpl(item,ssclCallback,true,true));
}

Fixed version (ground truth):
/** 
 * Change the source group, used when renaming groups.
 * @param newGroup RosterGroup
 */
void setSourceGroup(RosterGroup newGroup){
  this.id=newGroup.getName();
}
Program: 103247
Project: 103247
Buggy source:
/** 
 * Appends the given string at the end of the contained in this panel document.
 * @param chatString the string to append
 */
public void appendMessageToEnd(String chatString,String contentType){
synchronized (scrollToBottomRunnable) {
    Element root=document.getDefaultRootElement();
    scrollToBottomIsPending=true;
    try {
      document.insertAfterEnd(root.getElement(root.getElementCount() - 1),chatString);
    }
 catch (    BadLocationException e) {
      logger.error("String_Node_Str",e);
    }
catch (    IOException e) {
      logger.error("String_Node_Str",e);
    }
    if (!isHistory)     ensureDocumentSize();
    final Element elem;
    if (!(root.getElementCount() < 2)) {
      elem=root.getElement(root.getElementCount() - 2);
    }
 else     elem=root.getElement(1);
    if (GuiActivator.getConfigurationService().getBoolean(ReplacementProperty.REPLACEMENT_ENABLE,true) || GuiActivator.getConfigurationService().getBoolean(ReplacementProperty.getPropertyName("String_Node_Str"),true)) {
      processReplacement(elem,chatString,contentType);
    }
  }
}

Fixed version (ground truth):
/** 
 * Appends the given string at the end of the contained in this panel document.
 * @param chatString the string to append
 */
public void appendMessageToEnd(String chatString,String contentType){
synchronized (scrollToBottomRunnable) {
    Element root=document.getDefaultRootElement();
    try {
      document.insertAfterEnd(root.getElement(root.getElementCount() - 1),chatString);
      SwingUtilities.invokeLater(scrollToBottomRunnable);
    }
 catch (    BadLocationException e) {
      logger.error("String_Node_Str",e);
    }
catch (    IOException e) {
      logger.error("String_Node_Str",e);
    }
    if (!isHistory)     ensureDocumentSize();
    final Element elem;
    if (!(root.getElementCount() < 2)) {
      elem=root.getElement(root.getElementCount() - 2);
    }
 else     elem=root.getElement(1);
    if (GuiActivator.getConfigurationService().getBoolean(ReplacementProperty.REPLACEMENT_ENABLE,true) || GuiActivator.getConfigurationService().getBoolean(ReplacementProperty.getPropertyName("String_Node_Str"),true)) {
      processReplacement(elem,chatString,contentType);
    }
  }
}
Program: 103249
Project: 103249
Buggy source:
/** 
 * Adds the given group to this list.
 * @param group the <tt>UIGroup</tt> to add
 * @param isSorted indicates if the contact should be sorted regarding tothe <tt>GroupNode</tt> policy
 */
public void addGroup(final UIGroup group,final boolean isSorted){
  if (!SwingUtilities.isEventDispatchThread()) {
    SwingUtilities.invokeLater(new Runnable(){
      public void run(){
        addGroup(group,isSorted);
      }
    }
);
    return;
  }
  GroupNode parentNode=treeModel.getRoot();
  if (isSorted)   parentNode.sortedAddContactGroup(group);
 else   parentNode.addContactGroup(group);
  expandGroup(treeModel.getRoot());
}

Fixed version (ground truth):
/** 
 * Adds the given group to this list.
 * @param group the <tt>UIGroup</tt> to add
 * @param isSorted indicates if the contact should be sorted regarding tothe <tt>GroupNode</tt> policy
 */
public void addGroup(final UIGroup group,final boolean isSorted){
  if (!SwingUtilities.isEventDispatchThread()) {
    SwingUtilities.invokeLater(new Runnable(){
      public void run(){
        addGroup(group,isSorted);
      }
    }
);
    return;
  }
  GroupNode groupNode=group.getGroupNode();
  if (groupNode == null) {
    GroupNode parentNode=treeModel.getRoot();
    if (isSorted)     parentNode.sortedAddContactGroup(group);
 else     parentNode.addContactGroup(group);
  }
  expandGroup(treeModel.getRoot());
}
Program: 103250
Project: 103250
Buggy source:
/** 
 * Adds a contact node corresponding to the parent <tt>MetaContact</tt> if this last is matching the current filter and wasn't previously contained in the contact list.
 * @param evt the <tt>ProtoContactEvent</tt> that notified us
 */
public void protoContactAdded(ProtoContactEvent evt){
  final MetaContact metaContact=evt.getNewParent();
  UIContact parentUIContact;
  boolean parentUIContactCreated=false;
synchronized (metaContact) {
    parentUIContact=MetaContactListSource.getUIContact(metaContact);
    if (parentUIContact == null) {
      parentUIContactCreated=true;
      parentUIContact=MetaContactListSource.createUIContact(metaContact);
    }
  }
  if (parentUIContact != null && parentUIContactCreated) {
    ContactListFilter currentFilter=GuiActivator.getContactList().getCurrentFilter();
    if (currentFilter.isMatching(parentUIContact)) {
      MetaContactGroup parentGroup=metaContact.getParentMetaContactGroup();
      UIGroup uiGroup=null;
      if (!MetaContactListSource.isRootGroup(parentGroup)) {
        uiGroup=MetaContactListSource.getUIGroup(parentGroup);
        if (uiGroup == null)         uiGroup=MetaContactListSource.createUIGroup(parentGroup);
      }
      GuiActivator.getContactList().addContact(parentUIContact,uiGroup,true,true);
    }
 else     MetaContactListSource.removeUIContact(metaContact);
  }
}

Fixed version (ground truth):
/** 
 * Adds a contact node corresponding to the parent <tt>MetaContact</tt> if this last is matching the current filter and wasn't previously contained in the contact list.
 * @param evt the <tt>ProtoContactEvent</tt> that notified us
 */
public void protoContactAdded(ProtoContactEvent evt){
  final MetaContact metaContact=evt.getNewParent();
  UIContact parentUIContact;
  boolean parentUIContactCreated=false;
synchronized (metaContact) {
    parentUIContact=MetaContactListSource.getUIContact(metaContact);
    if (parentUIContact == null) {
      parentUIContactCreated=true;
      parentUIContact=MetaContactListSource.createUIContact(metaContact);
    }
  }
  if (parentUIContact != null && parentUIContactCreated) {
    ContactListFilter currentFilter=GuiActivator.getContactList().getCurrentFilter();
    if (currentFilter.isMatching(parentUIContact)) {
      MetaContactGroup parentGroup=metaContact.getParentMetaContactGroup();
      UIGroup uiGroup=null;
      if (!MetaContactListSource.isRootGroup(parentGroup)) {
synchronized (parentGroup) {
          uiGroup=MetaContactListSource.getUIGroup(parentGroup);
          if (uiGroup == null)           uiGroup=MetaContactListSource.createUIGroup(parentGroup);
        }
      }
      GuiActivator.getContactList().addContact(parentUIContact,uiGroup,true,true);
    }
 else     MetaContactListSource.removeUIContact(metaContact);
  }
}
Program: 103251
Project: 103251
Buggy source:
/** 
 * Returns the quality control for video calls if any. Return null so protocols who supports it to override it.
 * @param peer the peer which this control operates on.
 * @return the implemented quality control.
 */
public QualityControl getQualityControl(CallPeer peer){
  return ((CallPeerJabberImpl)peer).getMediaHandler().getQualityControl();
}

Fixed version (ground truth):
/** 
 * Returns the quality control for video calls if any. Return null so protocols who supports it to override it.
 * @param peer the peer which this control operates on.
 * @return the implemented quality control.
 */
public QualityControl getQualityControl(CallPeer peer){
  if (peer instanceof CallPeerJabberImpl)   return ((CallPeerJabberImpl)peer).getMediaHandler().getQualityControl();
 else   return null;
}
Program: 103252
Project: 103252
Buggy source:
/** 
 * Returns the number of online <tt>MetaContact</tt>s that this group contains. <p>
 * @return the number of online <tt>MetaContact</tt>s that this groupcontains.
 */
public int countOnlineChildContacts(){
  int onlineContactsNumber=0;
  try {
    Iterator<MetaContact> itr=getChildContacts();
    while (itr.hasNext()) {
      if (itr.next().getDefaultContact().getPresenceStatus().isOnline()) {
        onlineContactsNumber++;
      }
    }
  }
 catch (  Exception e) {
    if (logger.isDebugEnabled())     logger.debug("String_Node_Str",e);
  }
  return onlineContactsNumber;
}

Fixed version (ground truth):
/** 
 * Returns the number of online <tt>MetaContact</tt>s that this group contains. <p>
 * @return the number of online <tt>MetaContact</tt>s that this groupcontains.
 */
public int countOnlineChildContacts(){
  int onlineContactsNumber=0;
  try {
    Iterator<MetaContact> itr=getChildContacts();
    while (itr.hasNext()) {
      Contact contact=itr.next().getDefaultContact();
      if (contact == null)       continue;
      if (contact.getPresenceStatus().isOnline()) {
        onlineContactsNumber++;
      }
    }
  }
 catch (  Exception e) {
    if (logger.isDebugEnabled())     logger.debug("String_Node_Str",e);
  }
  return onlineContactsNumber;
}
Program: 103253
Project: 103253
Buggy source:
public void run(){
  if (logger.isTraceEnabled()) {
    logger.trace(fromID + "String_Node_Str");
  }
  ContactJabberImpl srcContact=ssContactList.findContactById(fromID);
  if (srcContact == null)   srcContact=createVolatileContact(fromID);
  AuthorizationRequest req=new AuthorizationRequest();
  AuthorizationResponse response=handler.processAuthorisationRequest(req,srcContact);
  Presence.Type responsePresenceType=null;
  if (response != null) {
    if (response.getResponseCode().equals(AuthorizationResponse.ACCEPT)) {
      responsePresenceType=Presence.Type.subscribed;
      if (logger.isInfoEnabled())       logger.info("String_Node_Str");
    }
 else     if (response.getResponseCode().equals(AuthorizationResponse.REJECT)) {
      responsePresenceType=Presence.Type.unsubscribed;
      if (logger.isInfoEnabled())       logger.info("String_Node_Str");
    }
  }
  if (responsePresenceType == null)   return;
  Presence responsePacket=new Presence(responsePresenceType);
  responsePacket.setTo(fromID);
  parentProvider.getConnection().sendPacket(responsePacket);
}

Fixed version (ground truth):
public void run(){
  ssContactList.init();
  contactChangesListener=new ContactChangesListener();
  Roster roster=parentProvider.getConnection().getRoster();
  roster.addRosterListener(contactChangesListener);
  parentProvider.startJingleNodesDiscovery();
  parentProvider.getConnection().removePacketListener(this);
}
Program: 103254
Project: 103254
Buggy source:
/** 
 * Process packets.
 * @param packet packet received to be processed
 */
public void processPacket(Packet packet){
  Presence presence=(Presence)packet;
  if (presence == null)   return;
  Presence.Type presenceType=presence.getType();
  final String fromID=presence.getFrom();
  if (presenceType == Presence.Type.subscribe) {
    new Thread(new Runnable(){
      public void run(){
        if (logger.isTraceEnabled()) {
          logger.trace(fromID + "String_Node_Str");
        }
        ContactJabberImpl srcContact=ssContactList.findContactById(fromID);
        if (srcContact == null)         srcContact=createVolatileContact(fromID);
        AuthorizationRequest req=new AuthorizationRequest();
        AuthorizationResponse response=handler.processAuthorisationRequest(req,srcContact);
        Presence.Type responsePresenceType=null;
        if (response != null) {
          if (response.getResponseCode().equals(AuthorizationResponse.ACCEPT)) {
            responsePresenceType=Presence.Type.subscribed;
            if (logger.isInfoEnabled())             logger.info("String_Node_Str");
          }
 else           if (response.getResponseCode().equals(AuthorizationResponse.REJECT)) {
            responsePresenceType=Presence.Type.unsubscribed;
            if (logger.isInfoEnabled())             logger.info("String_Node_Str");
          }
        }
        if (responsePresenceType == null)         return;
        Presence responsePacket=new Presence(responsePresenceType);
        responsePacket.setTo(fromID);
        parentProvider.getConnection().sendPacket(responsePacket);
      }
    }
).start();
  }
 else   if (presenceType == Presence.Type.unsubscribed) {
    if (logger.isTraceEnabled())     logger.trace(fromID + "String_Node_Str");
    ContactJabberImpl contact=ssContactList.findContactById(fromID);
    if (contact != null) {
      AuthorizationResponse response=new AuthorizationResponse(AuthorizationResponse.REJECT,"String_Node_Str");
      handler.processAuthorizationResponse(response,contact);
      try {
        ssContactList.removeContact(contact);
      }
 catch (      OperationFailedException e) {
        logger.error("String_Node_Str");
      }
    }
  }
 else   if (presenceType == Presence.Type.subscribed) {
    ContactJabberImpl contact=ssContactList.findContactById(fromID);
    AuthorizationResponse response=new AuthorizationResponse(AuthorizationResponse.ACCEPT,"String_Node_Str");
    handler.processAuthorizationResponse(response,contact);
  }
}

Fixed version (ground truth):
/** 
 * When roaster packet with no error is received we are ready to to dispatch the contact list, doing it in different thread to avoid blocking xmpp packet receiving.
 * @param packet the roaster packet
 */
public void processPacket(Packet packet){
  if (packet.getError() != null) {
    return;
  }
  new Thread(this,getClass().getName()).start();
}
Program: 103255
Project: 103255
Buggy source:
/** 
 * The method is called by a ProtocolProvider implementation whenever a change in the registration state of the corresponding provider had occurred.
 * @param evt ProviderStatusChangeEvent the event describing the statuschange.
 */
public void registrationStateChanged(RegistrationStateChangeEvent evt){
  if (logger.isDebugEnabled())   logger.debug("String_Node_Str" + evt.getOldState() + "String_Node_Str"+ evt.getNewState());
  if (evt.getNewState() == RegistrationState.REGISTERED) {
    contactChangesListener=new ContactChangesListener();
    parentProvider.getConnection().getRoster().addRosterListener(contactChangesListener);
    fireProviderStatusChangeEvent(currentStatus,parentProvider.getJabberStatusEnum().getStatus(JabberStatusEnum.AVAILABLE));
    ssContactList.init();
  }
 else   if (evt.getNewState() == RegistrationState.UNREGISTERED || evt.getNewState() == RegistrationState.AUTHENTICATION_FAILED || evt.getNewState() == RegistrationState.CONNECTION_FAILED) {
    PresenceStatus oldStatus=currentStatus;
    PresenceStatus offlineStatus=parentProvider.getJabberStatusEnum().getStatus(JabberStatusEnum.OFFLINE);
    currentStatus=offlineStatus;
    fireProviderStatusChangeEvent(oldStatus,currentStatus);
    ssContactList.cleanup();
    subscribtionPacketListener=null;
    if (parentProvider.getConnection() != null && parentProvider.getConnection().getRoster() != null)     parentProvider.getConnection().getRoster().removeRosterListener(contactChangesListener);
    contactChangesListener=null;
  }
}

Fixed version (ground truth):
/** 
 * The method is called by a ProtocolProvider implementation whenever a change in the registration state of the corresponding provider had occurred.
 * @param evt ProviderStatusChangeEvent the event describing the statuschange.
 */
public void registrationStateChanged(RegistrationStateChangeEvent evt){
  if (logger.isDebugEnabled())   logger.debug("String_Node_Str" + evt.getOldState() + "String_Node_Str"+ evt.getNewState());
  if (evt.getNewState() == RegistrationState.REGISTERING) {
    parentProvider.getConnection().addPacketListener(new ServerStoredListInit(),new PacketTypeFilter(RosterPacket.class));
  }
 else   if (evt.getNewState() == RegistrationState.REGISTERED) {
    fireProviderStatusChangeEvent(currentStatus,parentProvider.getJabberStatusEnum().getStatus(JabberStatusEnum.AVAILABLE));
  }
 else   if (evt.getNewState() == RegistrationState.UNREGISTERED || evt.getNewState() == RegistrationState.AUTHENTICATION_FAILED || evt.getNewState() == RegistrationState.CONNECTION_FAILED) {
    PresenceStatus oldStatus=currentStatus;
    PresenceStatus offlineStatus=parentProvider.getJabberStatusEnum().getStatus(JabberStatusEnum.OFFLINE);
    currentStatus=offlineStatus;
    fireProviderStatusChangeEvent(oldStatus,currentStatus);
    ssContactList.cleanup();
    subscribtionPacketListener=null;
    if (parentProvider.getConnection() != null && parentProvider.getConnection().getRoster() != null)     parentProvider.getConnection().getRoster().removeRosterListener(contactChangesListener);
    contactChangesListener=null;
  }
}
Program: 103258
Project: 103258
Buggy source:
/** 
 * Sets a reference to the currently active and valid instance of roster that this list is to use for retrieving server stored information
 */
void init(){
  this.roster=jabberProvider.getConnection().getRoster();
  initRoster();
  rosterChangeListener=new ChangeListener();
  this.roster.addRosterListener(rosterChangeListener);
}

Fixed version (ground truth):
/** 
 * Sets a reference to the currently active and valid instance of roster that this list is to use for retrieving server stored information
 */
void init(){
  this.roster=jabberProvider.getConnection().getRoster();
  this.roster.setSubscriptionMode(Roster.SubscriptionMode.manual);
  initRoster();
  rosterChangeListener=new ChangeListener();
  this.roster.addRosterListener(rosterChangeListener);
}
Program: 103259
Project: 103259
Buggy source:
/** 
 * The method is called by a ProtocolProvider implementation whenever a change in the registration state of the corresponding provider had occurred.
 * @param evt ProviderStatusChangeEvent the event describing the statuschange.
 */
public void registrationStateChanged(RegistrationStateChangeEvent evt){
  if (logger.isDebugEnabled())   logger.debug("String_Node_Str" + evt.getOldState() + "String_Node_Str"+ evt.getNewState());
  if (evt.getNewState() == RegistrationState.REGISTERED) {
    parentProvider.getConnection().removePacketListener(this);
    parentProvider.getConnection().addPacketListener(this,null);
    keepAliveSendTask=new KeepAliveSendTask();
    keepAliveCheckInterval=2 * SmackConfiguration.getKeepAliveInterval();
    if (keepAliveCheckInterval == 0)     keepAliveCheckInterval=60000;
    keepAliveTimer=new Timer("String_Node_Str" + parentProvider.getAccountID() + "String_Node_Str",true);
    keepAliveTimer.scheduleAtFixedRate(keepAliveSendTask,keepAliveCheckInterval,keepAliveCheckInterval);
  }
 else   if (evt.getNewState() == RegistrationState.UNREGISTERED || evt.getNewState() == RegistrationState.CONNECTION_FAILED || evt.getNewState() == RegistrationState.AUTHENTICATION_FAILED) {
    if (parentProvider.getConnection() != null)     parentProvider.getConnection().removePacketListener(this);
    if (keepAliveSendTask != null) {
      keepAliveSendTask.cancel();
      keepAliveSendTask=null;
    }
    if (keepAliveTimer != null) {
      keepAliveTimer.cancel();
      keepAliveTimer=null;
    }
  }
}

Fixed version (ground truth):
/** 
 * The method is called by a ProtocolProvider implementation whenever a change in the registration state of the corresponding provider had occurred.
 * @param evt ProviderStatusChangeEvent the event describing the statuschange.
 */
public void registrationStateChanged(RegistrationStateChangeEvent evt){
  if (logger.isDebugEnabled())   logger.debug("String_Node_Str" + evt.getOldState() + "String_Node_Str"+ evt.getNewState());
  if (evt.getNewState() == RegistrationState.REGISTERED) {
    parentProvider.getConnection().removePacketListener(this);
    parentProvider.getConnection().addPacketListener(this,null);
    keepAliveSendTask=new KeepAliveSendTask();
    keepAliveCheckInterval=SmackConfiguration.getKeepAliveInterval();
    if (keepAliveCheckInterval == 0)     keepAliveCheckInterval=30000;
    keepAliveTimer=new Timer("String_Node_Str" + parentProvider.getAccountID() + "String_Node_Str",true);
    keepAliveTimer.scheduleAtFixedRate(keepAliveSendTask,keepAliveCheckInterval,keepAliveCheckInterval);
  }
 else   if (evt.getNewState() == RegistrationState.UNREGISTERED || evt.getNewState() == RegistrationState.CONNECTION_FAILED || evt.getNewState() == RegistrationState.AUTHENTICATION_FAILED) {
    if (parentProvider.getConnection() != null)     parentProvider.getConnection().removePacketListener(this);
    if (keepAliveSendTask != null) {
      keepAliveSendTask.cancel();
      keepAliveSendTask=null;
    }
    if (keepAliveTimer != null) {
      keepAliveTimer.cancel();
      keepAliveTimer=null;
    }
  }
}
Program: 103266
Project: 103266
Buggy source:
/** 
 * Initiate a Google Talk session   {@link SessionIQ}.
 * @param sessionInitiateExtensions a collection of additional and optional<tt>PacketExtension</tt>s to be added to the <tt>initiate</tt> {@link SessionIQ} which is to initiate the session with this<tt>CallPeerGTalkImpl</tt>
 * @throws OperationFailedException exception
 */
protected synchronized void initiateSession(Iterable<PacketExtension> sessionInitiateExtensions) throws OperationFailedException {
  sid=SessionIQ.generateSID();
  isInitiator=false;
  RtpDescriptionPacketExtension offer=getMediaHandler().createDescription();
  ProtocolProviderServiceJabberImpl protocolProvider=getProtocolProvider();
  sessionInitIQ=GTalkPacketFactory.createSessionInitiate(protocolProvider.getOurJID(),this.peerJID,sid,offer);
  if (sessionInitiateExtensions != null) {
    for (    PacketExtension sessionInitiateExtension : sessionInitiateExtensions) {
      sessionInitIQ.addExtension(sessionInitiateExtension);
    }
  }
  protocolProvider.getConnection().sendPacket(sessionInitIQ);
  getMediaHandler().harvestCandidates(offer.getPayloadTypes(),new CandidatesSender(){
    public void sendCandidates(    Iterable<GTalkCandidatePacketExtension> candidates){
      CallPeerGTalkImpl.this.sendCandidates(candidates);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Initiate a Google Talk session   {@link SessionIQ}.
 * @param sessionInitiateExtensions a collection of additional and optional<tt>PacketExtension</tt>s to be added to the <tt>initiate</tt> {@link SessionIQ} which is to initiate the session with this<tt>CallPeerGTalkImpl</tt>
 * @throws OperationFailedException exception
 */
protected synchronized void initiateSession(Iterable<PacketExtension> sessionInitiateExtensions) throws OperationFailedException {
  sid=SessionIQ.generateSID();
  isInitiator=false;
  RtpDescriptionPacketExtension offer=getMediaHandler().createDescription();
  ProtocolProviderServiceJabberImpl protocolProvider=getProtocolProvider();
  sessionInitIQ=GTalkPacketFactory.createSessionInitiate(protocolProvider.getOurJID(),this.peerJID,sid,offer);
  if (sessionInitiateExtensions != null) {
    for (    PacketExtension sessionInitiateExtension : sessionInitiateExtensions) {
      sessionInitIQ.addExtension(sessionInitiateExtension);
    }
  }
  protocolProvider.getConnection().sendPacket(sessionInitIQ);
  if (getAddress().endsWith(ProtocolProviderServiceJabberImpl.GOOGLE_VOICE_DOMAIN)) {
    return;
  }
  getMediaHandler().harvestCandidates(offer.getPayloadTypes(),new CandidatesSender(){
    public void sendCandidates(    Iterable<GTalkCandidatePacketExtension> candidates){
      CallPeerGTalkImpl.this.sendCandidates(candidates);
    }
  }
);
}
Program: 103267
Project: 103267
Buggy source:
/** 
 * Returns whether or not the <tt>CallPeer</tt> is an Android phone or a call pass throught Google Voice or uses Google Talk client. We base the detection of the JID's resource which in the case of Android is android/Vtok/Talk.vXXXXXXX (where XXXXXX is a suite of numbers/letters).
 */
private static boolean isAndroidOrVtokOrTalkClient(String fullJID){
  int idx=fullJID.indexOf('/');
  if (idx != -1) {
    String res=fullJID.substring(idx + 1);
    if (res.startsWith("String_Node_Str") || res.startsWith("String_Node_Str") || res.startsWith("String_Node_Str")) {
      return true;
    }
  }
  if (fullJID.contains("String_Node_Str"))   return true;
  return false;
}

Fixed version (ground truth):
/** 
 * Returns whether or not the <tt>CallPeer</tt> is an Android phone or a call pass throught Google Voice or uses Google Talk client. We base the detection of the JID's resource which in the case of Android is android/Vtok/Talk.vXXXXXXX (where XXXXXX is a suite of numbers/letters).
 */
private static boolean isAndroidOrVtokOrTalkClient(String fullJID){
  int idx=fullJID.indexOf('/');
  if (idx != -1) {
    String res=fullJID.substring(idx + 1);
    if (res.startsWith("String_Node_Str") || res.startsWith("String_Node_Str") || res.startsWith("String_Node_Str")) {
      return true;
    }
  }
  if (fullJID.contains("String_Node_Str" + ProtocolProviderServiceJabberImpl.GOOGLE_VOICE_DOMAIN))   return true;
  return false;
}
Program: 103270
Project: 103270
Buggy source:
public void itemStateChanged(ItemEvent e){
  if (e.getStateChange() == ItemEvent.SELECTED)   loadProviderRooms();
}

Fixed version (ground truth):
public void itemStateChanged(ItemEvent e){
  if (e.getStateChange() == ItemEvent.SELECTED && roomsCombo.getSelectedIndex() != -1) {
    okButton.setEnabled(true);
    addButton.setEnabled(true);
  }
}
Program: 103271
Project: 103271
Buggy source:
public void keyTyped(KeyEvent e){
  chatRoomsTableUI.clearSelection();
  if (editor.getText().trim().length() > 0) {
    okButton.setEnabled(true);
    addButton.setEnabled(true);
  }
 else {
    okButton.setEnabled(false);
    addButton.setEnabled(false);
  }
}

Fixed version (ground truth):
public void keyTyped(KeyEvent e){
}
Program: 103272
Project: 103272
Buggy source:
public void keyReleased(KeyEvent e){
}

Fixed version (ground truth):
public void keyReleased(KeyEvent e){
  chatRoomsTableUI.clearSelection();
  if (editor.getText().trim().length() > 0) {
    okButton.setEnabled(true);
    addButton.setEnabled(true);
  }
 else {
    okButton.setEnabled(false);
    addButton.setEnabled(false);
  }
}
Program: 103273
Project: 103273
Buggy source:
/** 
 * Adds new <tt>NetworkConfigurationChangeListener</tt> which will be informed for network configuration changes.
 * @param listener the listener.
 */
public void addNetworkConfigurationChangeListener(NetworkConfigurationChangeListener listener){
  if (networkConfigurationWatcher == null)   networkConfigurationWatcher=new NetworkConfigurationWatcher();
  networkConfigurationWatcher.addNetworkConfigurationChangeListener(listener);
}

Fixed version (ground truth):
/** 
 * Adds new <tt>NetworkConfigurationChangeListener</tt> which will be informed for network configuration changes.
 * @param listener the listener.
 */
public synchronized void addNetworkConfigurationChangeListener(NetworkConfigurationChangeListener listener){
  if (networkConfigurationWatcher == null)   networkConfigurationWatcher=new NetworkConfigurationWatcher();
  networkConfigurationWatcher.addNetworkConfigurationChangeListener(listener);
}
Program: 103274
Project: 103274
Buggy source:
/** 
 * Remove <tt>NetworkConfigurationChangeListener</tt>.
 * @param listener the listener.
 */
public void removeNetworkConfigurationChangeListener(NetworkConfigurationChangeListener listener){
  if (networkConfigurationWatcher != null)   networkConfigurationWatcher.removeNetworkConfigurationChangeListener(listener);
}

Fixed version (ground truth):
/** 
 * Remove <tt>NetworkConfigurationChangeListener</tt>.
 * @param listener the listener.
 */
public synchronized void removeNetworkConfigurationChangeListener(NetworkConfigurationChangeListener listener){
  if (networkConfigurationWatcher != null)   networkConfigurationWatcher.removeNetworkConfigurationChangeListener(listener);
}
Program: 103275
Project: 103275
Buggy source:
/** 
 * Specifies whether or not this contact group is to be considered resolved against the server. Note that no actions are to be undertaken against group buddies in this method.
 * @param resolved true if this group hase been resolved against the serverand false otherwise.
 */
void setResolved(boolean resolved){
  this.isResolved=resolved;
}

Fixed version (ground truth):
/** 
 * Specifies whether or not this contact group is to be considered resolved against the server. Note that no actions are to be undertaken against group buddies in this method.
 * @param resolved true if this group hase been resolved against the serverand false otherwise.
 */
void setResolved(boolean resolved){
  this.isResolved=resolved;
  this.isPersistent=true;
}
Program: 103276
Project: 103276
Buggy source:
/** 
 * Determines whether or not this contact group is being stored by the server. Non persistent contact groups exist for the sole purpose of containing non persistent contacts.
 * @return true if the contact group is persistent and false otherwise.
 */
public boolean isPersistent(){
  return !(joustSimSourceGroup instanceof VolatileGroup);
}

Fixed version (ground truth):
/** 
 * Determines whether or not this contact group is being stored by the server. Non persistent contact groups exist for the sole purpose of containing non persistent contacts.
 * @return true if the contact group is persistent and false otherwise.
 */
public boolean isPersistent(){
  return isPersistent;
}
Program: 103277
Project: 103277
Buggy source:
/** 
 * Creates an ICQ group using the specified <tt>joustSimGroup</tt> as a source. The newly created group will always return the name of the underlying joustSimGroup and would thus automatically adapt to changes. It would, however, not receive or try to poll for modifications of the buddies it contains and would therefore have to be updated manually by ServerStoredContactListImpl. <p> Note that we MUST NOT use the list of buddies obtained through the getBuddiesCopy() of the joustSimGroup arg as we'd later need to be able to directly compare ( == ) instances of buddies we've stored and others that are returned by the framework. <p>
 * @param joustSimGroup the JoustSIM Group corresponding to the group
 * @param groupMembers the group members that we should add to the group.
 * @param ssclCallback a callback to the server stored contact listwe're creating.
 * @param isResolved a boolean indicating whether or not the group has beenresolved against the server.
 */
ContactGroupIcqImpl(MutableGroup joustSimGroup,Iterable<? extends Buddy> groupMembers,ServerStoredContactListIcqImpl ssclCallback,boolean isResolved){
  this.joustSimSourceGroup=joustSimGroup;
  this.isResolved=isResolved;
  this.ssclCallback=ssclCallback;
  initNameCopy();
  if (groupMembers != null)   for (  Buddy buddy : groupMembers) {
    if (ssclCallback.findContactByJoustSimBuddy(buddy) != null) {
      continue;
    }
    addContact(new ContactIcqImpl(buddy,ssclCallback,true,true));
  }
}

Fixed version (ground truth):
/** 
 * Creates an ICQ group using the specified <tt>joustSimGroup</tt> as a source. The newly created group will always return the name of the underlying joustSimGroup and would thus automatically adapt to changes. It would, however, not receive or try to poll for modifications of the buddies it contains and would therefore have to be updated manually by ServerStoredContactListImpl. <p> Note that we MUST NOT use the list of buddies obtained through the getBuddiesCopy() of the joustSimGroup arg as we'd later need to be able to directly compare ( == ) instances of buddies we've stored and others that are returned by the framework. <p>
 * @param joustSimGroup the JoustSIM Group corresponding to the group
 * @param groupMembers the group members that we should add to the group.
 * @param ssclCallback a callback to the server stored contact listwe're creating.
 * @param isResolved a boolean indicating whether or not the group has beenresolved against the server.
 */
ContactGroupIcqImpl(MutableGroup joustSimGroup,Iterable<? extends Buddy> groupMembers,ServerStoredContactListIcqImpl ssclCallback,boolean isResolved,boolean isPersistent){
  this.joustSimSourceGroup=joustSimGroup;
  this.isResolved=isResolved;
  this.isPersistent=isPersistent;
  this.ssclCallback=ssclCallback;
  initNameCopy();
  if (groupMembers != null)   for (  Buddy buddy : groupMembers) {
    if (ssclCallback.findContactByJoustSimBuddy(buddy) != null) {
      continue;
    }
    addContact(new ContactIcqImpl(buddy,ssclCallback,true,true));
  }
}
Program: 103279
Project: 103279
Buggy source:
/** 
 * Creates a non persistent contact for the specified address. This would also create (if necessary) a group for volatile contacts that would not be added to the server stored contact list. This method would have no effect on the server stored contact list.
 * @param screenname the UIN/Screenname of the contact to create.
 * @return the newly created volatile <tt>ContactIcqImpl</tt>
 */
ContactIcqImpl createVolatileContact(Screenname screenname){
  if (logger.isTraceEnabled())   logger.trace("String_Node_Str" + screenname);
  Buddy volatileBuddy=new VolatileBuddy(screenname);
  ContactIcqImpl newVolatileContact=new ContactIcqImpl(volatileBuddy,this,false,false);
  ContactGroupIcqImpl theVolatileGroup=getNonPersistentGroup();
  if (theVolatileGroup == null) {
    List<Buddy> emptyBuddies=new LinkedList<Buddy>();
    theVolatileGroup=new ContactGroupIcqImpl(new VolatileGroup(),emptyBuddies,this,false);
    theVolatileGroup.addContact(newVolatileContact);
    this.rootGroup.addSubGroup(theVolatileGroup);
    fireGroupEvent(theVolatileGroup,ServerStoredGroupEvent.GROUP_CREATED_EVENT);
  }
 else {
    theVolatileGroup.addContact(newVolatileContact);
    fireContactAdded(theVolatileGroup,newVolatileContact);
  }
  return newVolatileContact;
}

Fixed version (ground truth):
/** 
 * Creates a non persistent contact for the specified address. This would also create (if necessary) a group for volatile contacts that would not be added to the server stored contact list. This method would have no effect on the server stored contact list.
 * @param screenname the UIN/Screenname of the contact to create.
 * @return the newly created volatile <tt>ContactIcqImpl</tt>
 */
ContactIcqImpl createVolatileContact(Screenname screenname){
  if (logger.isTraceEnabled())   logger.trace("String_Node_Str" + screenname);
  Buddy volatileBuddy=new VolatileBuddy(screenname);
  ContactIcqImpl newVolatileContact=new ContactIcqImpl(volatileBuddy,this,false,false);
  ContactGroupIcqImpl theVolatileGroup=getNonPersistentGroup();
  if (theVolatileGroup == null) {
    List<Buddy> emptyBuddies=new LinkedList<Buddy>();
    theVolatileGroup=new ContactGroupIcqImpl(new VolatileGroup(),emptyBuddies,this,false,false);
    theVolatileGroup.addContact(newVolatileContact);
    this.rootGroup.addSubGroup(theVolatileGroup);
    fireGroupEvent(theVolatileGroup,ServerStoredGroupEvent.GROUP_CREATED_EVENT);
  }
 else {
    theVolatileGroup.addContact(newVolatileContact);
    fireContactAdded(theVolatileGroup,newVolatileContact);
  }
  return newVolatileContact;
}
Program: 103280
Project: 103280
Buggy source:
/** 
 * Creates a non resolved contact group for the specified name. The newly created group would be added to the local contact list as any other group but when an event is received from the server concerning this group, then it will be reused and only its isResolved field would be updated instead of creating the whole group again. <p>
 * @param groupName the name of the group to create.
 * @return the newly created unresolved <tt>ContactGroupIcqImpl</tt>
 */
ContactGroupIcqImpl createUnresolvedContactGroup(String groupName){
  List<Buddy> emptyBuddies=new LinkedList<Buddy>();
  ContactGroupIcqImpl newUnresolvedGroup=new ContactGroupIcqImpl(new VolatileGroup(groupName),emptyBuddies,this,false);
  this.rootGroup.addSubGroup(newUnresolvedGroup);
  fireGroupEvent(newUnresolvedGroup,ServerStoredGroupEvent.GROUP_CREATED_EVENT);
  return newUnresolvedGroup;
}

Fixed version (ground truth):
/** 
 * Creates a non resolved contact group for the specified name. The newly created group would be added to the local contact list as any other group but when an event is received from the server concerning this group, then it will be reused and only its isResolved field would be updated instead of creating the whole group again. <p>
 * @param groupName the name of the group to create.
 * @return the newly created unresolved <tt>ContactGroupIcqImpl</tt>
 */
ContactGroupIcqImpl createUnresolvedContactGroup(String groupName){
  List<Buddy> emptyBuddies=new LinkedList<Buddy>();
  ContactGroupIcqImpl newUnresolvedGroup=new ContactGroupIcqImpl(new VolatileGroup(groupName),emptyBuddies,this,false,true);
  this.rootGroup.addSubGroup(newUnresolvedGroup);
  fireGroupEvent(newUnresolvedGroup,ServerStoredGroupEvent.GROUP_CREATED_EVENT);
  return newUnresolvedGroup;
}
Program: 103281
Project: 103281
Buggy source:
/** 
 * Resolve this contact group against the specified group
 * @param msnGroup the server stored group
 */
void setResolved(MsnGroup msnGroup){
  if (isResolved)   return;
  this.isResolved=true;
  this.msnGroup=msnGroup;
  MsnContact[] contacts=msnGroup.getContacts();
  for (int i=0; i < contacts.length; i++) {
    MsnContact item=contacts[i];
    ContactMsnImpl contact=ssclCallback.findContactById(item.getEmail().getEmailAddress());
    if (contact != null) {
      contact.setResolved(item);
      ssclCallback.fireContactResolved(this,contact);
    }
 else {
      ContactMsnImpl newContact=new ContactMsnImpl(item,ssclCallback,true,true);
      addContact(newContact);
      ssclCallback.fireContactAdded(this,newContact);
    }
  }
}

Fixed version (ground truth):
/** 
 * Resolve this contact group against the specified group
 * @param msnGroup the server stored group
 */
void setResolved(MsnGroup msnGroup){
  if (isResolved)   return;
  this.isResolved=true;
  this.isPersistent=true;
  this.msnGroup=msnGroup;
  MsnContact[] contacts=msnGroup.getContacts();
  for (int i=0; i < contacts.length; i++) {
    MsnContact item=contacts[i];
    ContactMsnImpl contact=ssclCallback.findContactById(item.getEmail().getEmailAddress());
    if (contact != null) {
      contact.setResolved(item);
      ssclCallback.fireContactResolved(this,contact);
    }
 else {
      ContactMsnImpl newContact=new ContactMsnImpl(item,ssclCallback,true,true);
      addContact(newContact);
      ssclCallback.fireContactAdded(this,newContact);
    }
  }
}
Program: 103282
Project: 103282
Buggy source:
/** 
 * Creates an Msn group using the specified <tt>RosterGroup</tt> as a source. The newly created group will always return the name of the underlying RosterGroup and would thus automatically adapt to changes. It would, however, not receive or try to poll for modifications of the buddies it contains and would therefore have to be updated manually by ServerStoredContactListImpl update will only be done if source group is changed.
 * @param msnGroup the Msn Group corresponding to the group
 * @param groupMembers the group members that we should add to the group.
 * @param ssclCallback a callback to the server stored contact listwe're creating.
 * @param isResolved a boolean indicating whether or not the group has beenresolved against the server.
 */
ContactGroupMsnImpl(MsnGroup msnGroup,MsnContact[] groupMembers,ServerStoredContactListMsnImpl ssclCallback,boolean isResolved){
  this.msnGroup=msnGroup;
  this.isResolved=isResolved;
  this.ssclCallback=ssclCallback;
  for (  MsnContact groupMember : groupMembers) {
    if (ssclCallback.findContactById(groupMember.getEmail().getEmailAddress()) == null)     addContact(new ContactMsnImpl(groupMember,ssclCallback,true,true));
  }
}

Fixed version (ground truth):
/** 
 * Creates an Msn group using the specified <tt>RosterGroup</tt> as a source. The newly created group will always return the name of the underlying RosterGroup and would thus automatically adapt to changes. It would, however, not receive or try to poll for modifications of the buddies it contains and would therefore have to be updated manually by ServerStoredContactListImpl update will only be done if source group is changed.
 * @param msnGroup the Msn Group corresponding to the group
 * @param groupMembers the group members that we should add to the group.
 * @param ssclCallback a callback to the server stored contact listwe're creating.
 * @param isResolved a boolean indicating whether or not the group has beenresolved against the server.
 */
ContactGroupMsnImpl(MsnGroup msnGroup,MsnContact[] groupMembers,ServerStoredContactListMsnImpl ssclCallback,boolean isResolved,boolean isPersistent){
  this.msnGroup=msnGroup;
  this.isResolved=isResolved;
  this.isPersistent=isPersistent;
  this.ssclCallback=ssclCallback;
  for (  MsnContact groupMember : groupMembers) {
    if (ssclCallback.findContactById(groupMember.getEmail().getEmailAddress()) == null)     addContact(new ContactMsnImpl(groupMember,ssclCallback,true,true));
  }
}
Program: 103283
Project: 103283
Buggy source:
/** 
 * Determines whether or not this contact group is being stored by the server. Non persistent contact groups exist for the sole purpose of containing non persistent contacts.
 * @return true if the contact group is persistent and false otherwise.
 */
public boolean isPersistent(){
  return !(msnGroup instanceof VolatileGroup);
}

Fixed version (ground truth):
/** 
 * Determines whether or not this contact group is being stored by the server. Non persistent contact groups exist for the sole purpose of containing non persistent contacts.
 * @return true if the contact group is persistent and false otherwise.
 */
public boolean isPersistent(){
  return isPersistent;
}