nus-yam/ex-repair huggingface dataset:
Program: 103538
Project: 103538
Buggy source:
/** 
 * Removes <tt>DataSource</tt>s accepted by a specific <tt>DataSourceFilter</tt> from the list of input <tt>DataSource</tt>s of this <tt>AudioMixer</tt> from which it reads audio to be mixed.
 * @param dataSourceFilter the <tt>DataSourceFilter</tt> which selects the<tt>DataSource</tt>s to be removed from the list of input <tt>DataSource</tt>s of this <tt>AudioMixer</tt> from which it reads audio to be mixed
 */
public void removeInputDataSources(DataSourceFilter dataSourceFilter){
synchronized (inputDataSources) {
    Iterator<InputDataSourceDesc> inputDataSourceIter=inputDataSources.iterator();
    boolean removed=false;
    while (inputDataSourceIter.hasNext())     if (dataSourceFilter.accept(inputDataSourceIter.next().inputDataSource)) {
      inputDataSourceIter.remove();
      removed=true;
    }
    if (removed && (outputStream != null))     getOutputStream();
  }
}

Fixed version (ground truth):
/** 
 * Removes <tt>DataSource</tt>s accepted by a specific <tt>DataSourceFilter</tt> from the list of input <tt>DataSource</tt>s of this <tt>AudioMixer</tt> from which it reads audio to be mixed.
 * @param dataSourceFilter the <tt>DataSourceFilter</tt> which selects the<tt>DataSource</tt>s to be removed from the list of input <tt>DataSource</tt>s of this <tt>AudioMixer</tt> from which it reads audio to be mixed
 */
public void removeInputDataSources(DataSourceFilter dataSourceFilter){
synchronized (inputDataSources) {
    Iterator<InputDataSourceDesc> inputDataSourceIter=inputDataSources.iterator();
    boolean removed=false;
    while (inputDataSourceIter.hasNext()) {
      if (dataSourceFilter.accept(inputDataSourceIter.next().inputDataSource)) {
        inputDataSourceIter.remove();
        removed=true;
      }
    }
    if (removed && (outputStream != null))     getOutputStream();
  }
}
Program: 103540
Project: 103540
Buggy source:
/** 
 * Returns the SIP address of record (Display Name <user@server.net>) that this account is created for. The method takes into account whether or not we are running in Registar or "No Registar" mode and either returns the AOR we are using to register or an address constructed using the local address
 * @param intendedDestination the destination that we would be using thelocal address to communicate with. .
 * @return our Address Of Record that we should use in From headers.
 */
public Address getOurSipAddress(SipURI intendedDestination){
  SipRegistrarConnection src=getRegistrarConnection();
  if (src != null && !src.isRegistrarless())   return src.getAddressOfRecord();
  InetAddress destinationAddr=getIntendedDestination(intendedDestination);
  InetAddress localHost=SipActivator.getNetworkAddressManagerService().getLocalHost(destinationAddr);
  String userID=getAccountID().getUserID();
  try {
    SipURI ourSipURI=getAddressFactory().createSipURI(userID,localHost.getHostAddress());
    ListeningPoint lp=getListeningPoint(intendedDestination);
    ourSipURI.setTransportParam(lp.getTransport());
    ourSipURI.setPort(lp.getPort());
    Address ourSipAddress=getAddressFactory().createAddress(getOurDisplayName(),ourSipURI);
    ourSipAddress.setDisplayName(getOurDisplayName());
    return ourSipAddress;
  }
 catch (  ParseException exc) {
    if (logger.isTraceEnabled())     logger.trace("String_Node_Str",exc);
    throw new IllegalArgumentException("String_Node_Str",exc);
  }
}

Fixed version (ground truth):
/** 
 * Returns the SIP address of record (Display Name <user@server.net>) that this account is created for. The method takes into account whether or not we are running in Registar or "No Registar" mode and either returns the AOR we are using to register or an address constructed using the local address
 * @param intendedDestination the destination that we would be using thelocal address to communicate with. .
 * @return our Address Of Record that we should use in From headers.
 */
public Address getOurSipAddress(SipURI intendedDestination){
  SipRegistrarConnection src=getRegistrarConnection();
  if (src != null && !src.isRegistrarless())   return src.getAddressOfRecord();
  InetSocketAddress destinationAddr=getIntendedDestination(intendedDestination);
  InetAddress localHost=SipActivator.getNetworkAddressManagerService().getLocalHost(destinationAddr.getAddress());
  String userID=getAccountID().getUserID();
  try {
    SipURI ourSipURI=getAddressFactory().createSipURI(userID,localHost.getHostAddress());
    ListeningPoint lp=getListeningPoint(intendedDestination);
    ourSipURI.setTransportParam(lp.getTransport());
    ourSipURI.setPort(lp.getPort());
    Address ourSipAddress=getAddressFactory().createAddress(getOurDisplayName(),ourSipURI);
    ourSipAddress.setDisplayName(getOurDisplayName());
    return ourSipAddress;
  }
 catch (  ParseException exc) {
    if (logger.isTraceEnabled())     logger.trace("String_Node_Str",exc);
    throw new IllegalArgumentException("String_Node_Str",exc);
  }
}
Program: 103541
Project: 103541
Buggy source:
/** 
 * Returns the <tt>InetAddress</tt> that is most likely to be to be used as a next hop when contacting the specified <tt>destination</tt>. This is an utility method that is used whenever we have to choose one of our local addresses to put in the Via, Contact or (in the case of no registrar accounts) From headers. The method also takes into account the existence of an outbound proxy and in that case returns its address as the next hop.
 * @param host the destination that we would contact.
 * @return the <tt>InetAddress</tt> that is most likely to be to be usedas a next hop when contacting the specified <tt>destination</tt>.
 * @throws IllegalArgumentException if <tt>destination</tt> is not a validhost/ip/fqdn.
 */
public InetAddress getIntendedDestination(String host) throws IllegalArgumentException {
  InetAddress destinationInetAddress=null;
  InetSocketAddress outboundProxy=getOutboundProxy();
  if (outboundProxy != null) {
    if (logger.isTraceEnabled())     logger.trace("String_Node_Str");
    destinationInetAddress=outboundProxy.getAddress();
  }
 else {
    try {
      destinationInetAddress=resolveSipAddress(host).getAddress();
    }
 catch (    UnknownHostException ex) {
      throw new IllegalArgumentException(host + "String_Node_Str",ex);
    }
  }
  if (logger.isDebugEnabled())   logger.debug("String_Node_Str" + destinationInetAddress + "String_Node_Str"+ host);
  return destinationInetAddress;
}

Fixed version (ground truth):
/** 
 * Returns the <tt>InetAddress</tt> that is most likely to be to be used as a next hop when contacting the specified <tt>destination</tt>. This is an utility method that is used whenever we have to choose one of our local addresses to put in the Via, Contact or (in the case of no registrar accounts) From headers. The method also takes into account the existence of an outbound proxy and in that case returns its address as the next hop.
 * @param host the destination that we would contact.
 * @return the <tt>InetSocketAddress</tt> that is most likely to be to beused as a next hop when contacting the specified <tt>destination</tt>.
 * @throws IllegalArgumentException if <tt>destination</tt> is not a validhost/ip/fqdn.
 */
public InetSocketAddress getIntendedDestination(String host) throws IllegalArgumentException {
  InetSocketAddress destinationInetAddress=null;
  InetSocketAddress outboundProxy=getOutboundProxy();
  if (outboundProxy != null) {
    if (logger.isTraceEnabled())     logger.trace("String_Node_Str");
    destinationInetAddress=outboundProxy;
  }
 else {
    try {
      destinationInetAddress=resolveSipAddress(host);
    }
 catch (    UnknownHostException ex) {
      throw new IllegalArgumentException(host + "String_Node_Str",ex);
    }
  }
  if (logger.isDebugEnabled())   logger.debug("String_Node_Str" + destinationInetAddress + "String_Node_Str"+ host);
  return destinationInetAddress;
}
Program: 103543
Project: 103543
Buggy source:
/** 
 * Returns the <tt>InetAddress</tt> that is most likely to be to be used as a next hop when contacting the specified <tt>destination</tt>. This is an utility method that is used whenever we have to choose one of our local addresses to put in the Via, Contact or (in the case of no registrar accounts) From headers. The method also takes into account the existence of an outbound proxy and in that case returns its address as the next hop.
 * @param peer the CallPeer that we would contact.
 * @return the <tt>InetAddress</tt> that is most likely to be to be usedas a next hop when contacting the specified <tt>destination</tt>.
 * @throws IllegalArgumentException if <tt>destination</tt> is not a validhost/ip/fqdn
 */
protected InetAddress getIntendedDestination(CallPeerSipImpl peer){
  return peer.getProtocolProvider().getIntendedDestination(peer.getPeerAddress());
}

Fixed version (ground truth):
/** 
 * Returns the <tt>InetAddress</tt> that is most likely to be to be used as a next hop when contacting the specified <tt>destination</tt>. This is an utility method that is used whenever we have to choose one of our local addresses to put in the Via, Contact or (in the case of no registrar accounts) From headers. The method also takes into account the existence of an outbound proxy and in that case returns its address as the next hop.
 * @param peer the CallPeer that we would contact.
 * @return the <tt>InetAddress</tt> that is most likely to be to be usedas a next hop when contacting the specified <tt>destination</tt>.
 * @throws IllegalArgumentException if <tt>destination</tt> is not a validhost/ip/fqdn
 */
protected InetAddress getIntendedDestination(CallPeerSipImpl peer){
  return peer.getProtocolProvider().getIntendedDestination(peer.getPeerAddress()).getAddress();
}
Program: 103544
Project: 103544
Buggy source:
/** 
 * Loads the xcap-caps from the server.
 * @return the xcap-caps.
 * @throws IllegalStateException if the user has not been connected.
 * @throws XCapException         if there is some error during operation.
 */
private XCapCapsType loadXCapCaps() throws XCapException {
  String xCapCapsDocument=getXCapCapsDocument();
  XCapResourceId resourceId=new XCapResourceId(xCapCapsDocument);
  try {
    String xml=getResource(resourceId,XCapCapsClient.CONTENT_TYPE);
    if (xml == null) {
      return new XCapCapsType();
    }
    return XCapCapsParser.fromXml(xml);
  }
 catch (  ParsingException e) {
    throw new XCapException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Loads the xcap-caps from the server.
 * @return the xcap-caps.
 * @throws IllegalStateException if the user has not been connected.
 * @throws XCapException         if there is some error during operation.
 */
private XCapCapsType loadXCapCaps() throws XCapException {
  String xCapCapsDocument=getXCapCapsDocument();
  XCapResourceId resourceId=new XCapResourceId(xCapCapsDocument);
  try {
    String xml=getResource(resourceId,XCapCapsClient.CONTENT_TYPE);
    if (xml == null) {
      throw new XCapException("String_Node_Str");
    }
    return XCapCapsParser.fromXml(xml);
  }
 catch (  ParsingException e) {
    throw new XCapException("String_Node_Str",e);
  }
}
Program: 103545
Project: 103545
Buggy source:
/** 
 * Sets the reason of a call failure if one occurs. The renderer should display this reason to the user.
 * @param reason the reason to display
 */
public void setErrorReason(String reason){
  if (errorMessageComponent == null) {
    errorMessageComponent=new JTextPane();
    JTextPane textPane=(JTextPane)errorMessageComponent;
    textPane.setOpaque(false);
    StyledDocument doc=textPane.getStyledDocument();
    MutableAttributeSet standard=new SimpleAttributeSet();
    StyleConstants.setAlignment(standard,StyleConstants.ALIGN_CENTER);
    StyleConstants.setFontFamily(standard,textPane.getFont().getFamily());
    StyleConstants.setFontSize(standard,12);
    doc.setParagraphAttributes(0,0,standard,true);
    GridBagConstraints constraints=new GridBagConstraints();
    constraints.fill=GridBagConstraints.HORIZONTAL;
    constraints.gridx=0;
    constraints.gridy=4;
    constraints.weightx=1;
    constraints.weighty=0;
    constraints.insets=new Insets(5,0,0,0);
    add(errorMessageComponent,constraints);
    this.revalidate();
  }
  errorMessageComponent.setText(reason);
  if (isVisible())   errorMessageComponent.repaint();
}

Fixed version (ground truth):
/** 
 * Sets the reason of a call failure if one occurs. The renderer should display this reason to the user.
 * @param reason the reason to display
 */
public void setErrorReason(String reason){
  if (errorMessageComponent == null) {
    errorMessageComponent=new JTextPane();
    JTextPane textPane=(JTextPane)errorMessageComponent;
    textPane.setEditable(false);
    textPane.setOpaque(false);
    StyledDocument doc=textPane.getStyledDocument();
    MutableAttributeSet standard=new SimpleAttributeSet();
    StyleConstants.setAlignment(standard,StyleConstants.ALIGN_CENTER);
    StyleConstants.setFontFamily(standard,textPane.getFont().getFamily());
    StyleConstants.setFontSize(standard,12);
    doc.setParagraphAttributes(0,0,standard,true);
    GridBagConstraints constraints=new GridBagConstraints();
    constraints.fill=GridBagConstraints.HORIZONTAL;
    constraints.gridx=0;
    constraints.gridy=4;
    constraints.weightx=1;
    constraints.weighty=0;
    constraints.insets=new Insets(5,0,0,0);
    add(errorMessageComponent,constraints);
    this.revalidate();
  }
  errorMessageComponent.setText(reason);
  if (isVisible())   errorMessageComponent.repaint();
}
Program: 103546
Project: 103546
Buggy source:
/** 
 * Sets the reason of a call failure if one occurs. The renderer should display this reason to the user.
 * @param reason the reason to display
 */
protected void setErrorReason(String reason){
  if (errorMessageComponent == null) {
    errorMessageComponent=new JTextPane();
    JTextPane textPane=(JTextPane)errorMessageComponent;
    textPane.setOpaque(false);
    StyledDocument doc=textPane.getStyledDocument();
    MutableAttributeSet standard=new SimpleAttributeSet();
    StyleConstants.setFontFamily(standard,textPane.getFont().getFamily());
    StyleConstants.setFontSize(standard,12);
    doc.setParagraphAttributes(0,0,standard,true);
    addToCenter(errorMessageComponent);
    this.revalidate();
  }
  errorMessageComponent.setText(reason);
  if (isVisible())   errorMessageComponent.repaint();
}

Fixed version (ground truth):
/** 
 * Sets the reason of a call failure if one occurs. The renderer should display this reason to the user.
 * @param reason the reason to display
 */
protected void setErrorReason(String reason){
  if (errorMessageComponent == null) {
    errorMessageComponent=new JTextPane();
    JTextPane textPane=(JTextPane)errorMessageComponent;
    textPane.setEditable(false);
    textPane.setOpaque(false);
    StyledDocument doc=textPane.getStyledDocument();
    MutableAttributeSet standard=new SimpleAttributeSet();
    StyleConstants.setFontFamily(standard,textPane.getFont().getFamily());
    StyleConstants.setFontSize(standard,12);
    doc.setParagraphAttributes(0,0,standard,true);
    addToCenter(errorMessageComponent);
    this.revalidate();
  }
  errorMessageComponent.setText(reason);
  if (isVisible())   errorMessageComponent.repaint();
}
Program: 103547
Project: 103547
Buggy source:
/** 
 * Removes the corresponding server and all related chat rooms from this list.
 * @param chatRoomProvider the <tt>ChatRoomProviderWrapper</tt>corresponding to the server to remove
 */
private void removeChatProvider(ChatRoomProviderWrapper chatRoomProvider){
  providersList.remove(chatRoomProvider);
  ConfigurationService configService=GuiActivator.getConfigurationService();
  String prefix="String_Node_Str";
  String providerAccountUID=chatRoomProvider.getProtocolProvider().getAccountID().getAccountUniqueID();
  for (  String accountRootPropName : configService.getPropertyNamesByPrefix(prefix,true)) {
    String accountUID=configService.getString(accountRootPropName);
    if (accountUID.equals(providerAccountUID)) {
      List<String> chatRooms=configService.getPropertyNamesByPrefix(accountRootPropName + "String_Node_Str",true);
      for (      String chatRoomPropName : chatRooms) {
        configService.setProperty(chatRoomPropName + "String_Node_Str",null);
      }
      configService.setProperty(accountRootPropName,null);
    }
  }
  fireProviderWrapperRemoved(chatRoomProvider);
}

Fixed version (ground truth):
/** 
 * Removes the corresponding server and all related chat rooms from this list.
 * @param chatRoomProvider the <tt>ChatRoomProviderWrapper</tt>corresponding to the server to remove
 */
private void removeChatProvider(ChatRoomProviderWrapper chatRoomProvider){
  providersList.remove(chatRoomProvider);
  ConfigurationService configService=GuiActivator.getConfigurationService();
  String prefix="String_Node_Str";
  AccountID accountID=chatRoomProvider.getProtocolProvider().getAccountID();
  if (!GuiActivator.getAccountManager().getStoredAccounts().contains(accountID)) {
    String providerAccountUID=accountID.getAccountUniqueID();
    for (    String accountRootPropName : configService.getPropertyNamesByPrefix(prefix,true)) {
      String accountUID=configService.getString(accountRootPropName);
      if (accountUID.equals(providerAccountUID)) {
        List<String> chatRooms=configService.getPropertyNamesByPrefix(accountRootPropName + "String_Node_Str",true);
        for (        String chatRoomPropName : chatRooms) {
          configService.setProperty(chatRoomPropName + "String_Node_Str",null);
        }
        configService.setProperty(accountRootPropName,null);
      }
    }
  }
  fireProviderWrapperRemoved(chatRoomProvider);
}
Program: 103548
Project: 103548
Buggy source:
/** 
 * Returns the <tt>ChatRoomWrapper</tt> that correspond to the given <tt>ChatRoom</tt>. If the list of chat rooms doesn't contain a corresponding wrapper - returns null.
 * @param chatRoom the <tt>ChatRoom</tt> that we're looking for
 * @return the <tt>ChatRoomWrapper</tt> object corresponding to the given<tt>ChatRoom</tt>
 */
public ChatRoomWrapper findChatRoomWrapperFromChatRoom(ChatRoom chatRoom){
  for (  ChatRoomProviderWrapper provider : providersList) {
    ChatRoomWrapper systemRoomWrapper=provider.getSystemRoomWrapper();
    ChatRoom systemRoom=systemRoomWrapper.getChatRoom();
    if ((systemRoom != null) && systemRoom.equals(chatRoom)) {
      return systemRoomWrapper;
    }
 else {
      ChatRoomWrapper chatRoomWrapper=provider.findChatRoomWrapperForChatRoom(chatRoom);
      if (chatRoomWrapper != null) {
        if (chatRoomWrapper.getChatRoom() == null) {
          chatRoomWrapper.setChatRoom(chatRoom);
        }
        return chatRoomWrapper;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the <tt>ChatRoomWrapper</tt> that correspond to the given <tt>ChatRoom</tt>. If the list of chat rooms doesn't contain a corresponding wrapper - returns null.
 * @param chatRoom the <tt>ChatRoom</tt> that we're looking for
 * @return the <tt>ChatRoomWrapper</tt> object corresponding to the given<tt>ChatRoom</tt>
 */
public ChatRoomWrapper findChatRoomWrapperFromChatRoom(ChatRoom chatRoom){
  for (  ChatRoomProviderWrapper provider : providersList) {
    if (!chatRoom.getParentProvider().equals(provider.getProtocolProvider()))     continue;
    ChatRoomWrapper systemRoomWrapper=provider.getSystemRoomWrapper();
    ChatRoom systemRoom=systemRoomWrapper.getChatRoom();
    if ((systemRoom != null) && systemRoom.equals(chatRoom)) {
      return systemRoomWrapper;
    }
 else {
      ChatRoomWrapper chatRoomWrapper=provider.findChatRoomWrapperForChatRoom(chatRoom);
      if (chatRoomWrapper != null) {
        if (chatRoomWrapper.getChatRoom() == null) {
          chatRoomWrapper.setChatRoom(chatRoom);
        }
        return chatRoomWrapper;
      }
    }
  }
  return null;
}
Program: 103550
Project: 103550
Buggy source:
public void valueChanged(ListSelectionEvent e){
  if (!e.getValueIsAdjusting()) {
    ChatRoomWrapper room=chatRoomsTableUI.getSelectedRoom();
    if (room != null) {
      editor.setText(room.getChatRoomName());
      providersCombo.setSelectedItem(room.getParentProvider());
    }
  }
}

Fixed version (ground truth):
public void valueChanged(ListSelectionEvent e){
  if (!e.getValueIsAdjusting()) {
    ChatRoomWrapper room=chatRoomsTableUI.getSelectedRoom();
    if (room != null) {
      editor.setText(room.getChatRoomName());
      providersCombo.setSelectedItem(room.getParentProvider());
      okButton.setEnabled(true);
    }
  }
}
Program: 103551
Project: 103551
Buggy source:
@Override public void run(){
  okButton.setEnabled(false);
  roomsCombo.setEnabled(false);
  List<String> rooms=GuiActivator.getUIService().getConferenceChatManager().getExistingChatRooms(getSelectedProvider());
  roomsCombo.removeAllItems();
  if (rooms == null) {
    roomsCombo.setEnabled(true);
    okButton.setEnabled(true);
    return;
  }
  Collections.sort(rooms);
  for (  String room : rooms)   roomsCombo.addItem(room);
  roomsCombo.setSelectedIndex(-1);
  roomsCombo.setEnabled(true);
  okButton.setEnabled(true);
}

Fixed version (ground truth):
@Override public void run(){
  okButton.setEnabled(false);
  roomsCombo.setEnabled(false);
  List<String> rooms=GuiActivator.getUIService().getConferenceChatManager().getExistingChatRooms(getSelectedProvider());
  roomsCombo.removeAllItems();
  if (rooms == null) {
    roomsCombo.setEnabled(true);
    return;
  }
  Collections.sort(rooms);
  for (  String room : rooms)   roomsCombo.addItem(room);
  roomsCombo.setSelectedIndex(-1);
  roomsCombo.setEnabled(true);
}
Program: 103552
Project: 103552
Buggy source:
public void keyTyped(KeyEvent e){
  chatRoomsTableUI.clearSelection();
}

Fixed version (ground truth):
public void keyTyped(KeyEvent e){
  chatRoomsTableUI.clearSelection();
  if (editor.getText().trim().length() > 0)   okButton.setEnabled(true);
 else   okButton.setEnabled(false);
}
Program: 103553
Project: 103553
Buggy source:
/** 
 * Loads the rooms hosted on the selected provider. Loads it in different thread so it won't block the caller.
 */
public void loadProviderRooms(){
  new Thread(){
    @Override public void run(){
      okButton.setEnabled(false);
      roomsCombo.setEnabled(false);
      List<String> rooms=GuiActivator.getUIService().getConferenceChatManager().getExistingChatRooms(getSelectedProvider());
      roomsCombo.removeAllItems();
      if (rooms == null) {
        roomsCombo.setEnabled(true);
        okButton.setEnabled(true);
        return;
      }
      Collections.sort(rooms);
      for (      String room : rooms)       roomsCombo.addItem(room);
      roomsCombo.setSelectedIndex(-1);
      roomsCombo.setEnabled(true);
      okButton.setEnabled(true);
    }
  }
.start();
}

Fixed version (ground truth):
/** 
 * Loads the rooms hosted on the selected provider. Loads it in different thread so it won't block the caller.
 */
public void loadProviderRooms(){
  new Thread(){
    @Override public void run(){
      okButton.setEnabled(false);
      roomsCombo.setEnabled(false);
      List<String> rooms=GuiActivator.getUIService().getConferenceChatManager().getExistingChatRooms(getSelectedProvider());
      roomsCombo.removeAllItems();
      if (rooms == null) {
        roomsCombo.setEnabled(true);
        return;
      }
      Collections.sort(rooms);
      for (      String room : rooms)       roomsCombo.addItem(room);
      roomsCombo.setSelectedIndex(-1);
      roomsCombo.setEnabled(true);
    }
  }
.start();
}
Program: 103554
Project: 103554
Buggy source:
/** 
 * Refreshes the chat room's list when a modification in the model has occurred.
 * @param evt
 */
public void contentChanged(ChatRoomListChangeEvent evt){
  ChatRoomWrapper chatRoomWrapper=evt.getSourceChatRoom();
  if (evt.getEventID() == ChatRoomListChangeEvent.CHAT_ROOM_ADDED) {
    rooms.add(chatRoomWrapper);
    int index=rooms.indexOf(chatRoomWrapper);
    if (index != -1) {
      fireTableRowsInserted(index,index);
      parentTable.setRowSelectionInterval(index,index);
    }
  }
 else   if (evt.getEventID() == ChatRoomListChangeEvent.CHAT_ROOM_REMOVED) {
    int ix=rooms.indexOf(chatRoomWrapper);
    rooms.remove(chatRoomWrapper);
    OperationSetPresence presence=chatRoomWrapper.getParentProvider().getProtocolProvider().getOperationSet(OperationSetPresence.class);
    if (presence != null)     presence.removeProviderPresenceStatusListener(this);
    if (ix != -1) {
      fireTableRowsDeleted(ix,ix);
    }
  }
 else   if (evt.getEventID() == ChatRoomListChangeEvent.CHAT_ROOM_CHANGED) {
    int index=rooms.indexOf(chatRoomWrapper);
    if (index != -1) {
      fireTableRowsUpdated(index,index);
    }
  }
}

Fixed version (ground truth):
/** 
 * Refreshes the chat room's list when a modification in the model has occurred.
 * @param evt
 */
public void contentChanged(ChatRoomListChangeEvent evt){
  ChatRoomWrapper chatRoomWrapper=evt.getSourceChatRoom();
  if (evt.getEventID() == ChatRoomListChangeEvent.CHAT_ROOM_ADDED) {
    addChatRoom(chatRoomWrapper,true);
  }
 else   if (evt.getEventID() == ChatRoomListChangeEvent.CHAT_ROOM_REMOVED) {
    removeChatRoom(chatRoomWrapper);
  }
 else   if (evt.getEventID() == ChatRoomListChangeEvent.CHAT_ROOM_CHANGED) {
    int index=rooms.indexOf(chatRoomWrapper);
    if (index != -1) {
      fireTableRowsUpdated(index,index);
    }
  }
}
Program: 103555
Project: 103555
Buggy source:
/** 
 * Creates new model for the supplied table.
 * @param parentTable the parent table.
 */
public ChatRoomTableModel(JTable parentTable){
  this.parentTable=parentTable;
  chatRoomList=GuiActivator.getUIService().getConferenceChatManager().getChatRoomList();
  Iterator<ChatRoomProviderWrapper> iter=chatRoomList.getChatRoomProviders();
  while (iter.hasNext()) {
    ChatRoomProviderWrapper provider=iter.next();
    for (int i=0; i < provider.countChatRooms(); i++) {
      ChatRoomWrapper room=provider.getChatRoom(i);
      rooms.add(room);
    }
    OperationSetPresence presence=provider.getProtocolProvider().getOperationSet(OperationSetPresence.class);
    if (presence != null)     presence.addProviderPresenceStatusListener(this);
  }
}

Fixed version (ground truth):
/** 
 * Creates new model for the supplied table.
 * @param parentTable the parent table.
 */
public ChatRoomTableModel(JTable parentTable){
  this.parentTable=parentTable;
  chatRoomList=GuiActivator.getUIService().getConferenceChatManager().getChatRoomList();
  chatRoomList.addChatRoomProviderWrapperListener(this);
  Iterator<ChatRoomProviderWrapper> iter=chatRoomList.getChatRoomProviders();
  while (iter.hasNext()) {
    ChatRoomProviderWrapper provider=iter.next();
    if (!provider.getProtocolProvider().getAccountID().isEnabled()) {
      continue;
    }
    handleProviderAdded(provider);
  }
}
Program: 103557
Project: 103557
Buggy source:
/** 
 * Removes the specified account from the list of accounts that this provider factory is handling. If the specified accountID is unknown to the ProtocolProviderFactory, the call has no effect and false is returned. This method is persistent in nature and once called the account corresponding to the specified ID will not be loaded during future runs of the project.
 * @param accountID the ID of the account to remove.
 * @return true if an account with the specified ID existed and was removedand false otherwise.
 */
public boolean uninstallAccount(AccountID accountID){
  ServiceReference serRef=getProviderForAccount(accountID);
  if (serRef != null) {
    BundleContext bundleContext=getBundleContext();
    ProtocolProviderService protocolProvider=(ProtocolProviderService)bundleContext.getService(serRef);
    try {
      protocolProvider.unregister();
    }
 catch (    OperationFailedException ex) {
      logger.error("String_Node_Str" + accountID + "String_Node_Str"+ ex);
    }
    ServiceRegistration registration;
synchronized (registeredAccounts) {
      registration=registeredAccounts.remove(accountID);
    }
    if (registration != null) {
      registration.unregister();
    }
  }
  return removeStoredAccount(accountID);
}

Fixed version (ground truth):
/** 
 * Removes the specified account from the list of accounts that this provider factory is handling. If the specified accountID is unknown to the ProtocolProviderFactory, the call has no effect and false is returned. This method is persistent in nature and once called the account corresponding to the specified ID will not be loaded during future runs of the project.
 * @param accountID the ID of the account to remove.
 * @return true if an account with the specified ID existed and was removedand false otherwise.
 */
public boolean uninstallAccount(AccountID accountID){
  ServiceReference serRef=getProviderForAccount(accountID);
  boolean wasAccountExisting=false;
  if (serRef != null) {
    BundleContext bundleContext=getBundleContext();
    ProtocolProviderService protocolProvider=(ProtocolProviderService)bundleContext.getService(serRef);
    try {
      protocolProvider.unregister();
    }
 catch (    OperationFailedException ex) {
      logger.error("String_Node_Str" + accountID + "String_Node_Str"+ ex);
    }
    ServiceRegistration registration;
synchronized (registeredAccounts) {
      registration=registeredAccounts.remove(accountID);
    }
    wasAccountExisting=removeStoredAccount(accountID);
    if (registration != null) {
      registration.unregister();
    }
  }
  return wasAccountExisting;
}
Program: 103559
Project: 103559
Buggy source:
/** 
 * Creates the corresponding <tt>MetaContactPropertyChangeEvent</tt> instance and notifies all <tt>MetaContactListListener</tt>s that a MetaContact has been modified.
 * @param event the event to dispatch.
 */
void fireMetaContactEvent(MetaContactPropertyChangeEvent event){
  if (logger.isTraceEnabled())   logger.trace("String_Node_Str" + event);
  for (  MetaContactListListener listener : getMetaContactListListeners()) {
    if (event instanceof MetaContactMovedEvent) {
      listener.metaContactMoved((MetaContactMovedEvent)event);
    }
 else     if (event instanceof MetaContactRenamedEvent) {
      listener.metaContactRenamed((MetaContactRenamedEvent)event);
    }
 else     if (event instanceof MetaContactModifiedEvent) {
      listener.metaContactModified((MetaContactModifiedEvent)event);
    }
 else     if (event instanceof MetaContactAvatarUpdateEvent) {
      listener.metaContactAvatarUpdated((MetaContactAvatarUpdateEvent)event);
    }
  }
}

Fixed version (ground truth):
/** 
 * Creates the corresponding <tt>MetaContactPropertyChangeEvent</tt> instance and notifies all <tt>MetaContactListListener</tt>s that a MetaContact has been modified. Synchronized to avoid firing events when we are editing the account (there we temporally remove and then add again the storage manager and don't want anybody to interrupt us).
 * @param event the event to dispatch.
 */
synchronized void fireMetaContactEvent(MetaContactPropertyChangeEvent event){
  if (logger.isTraceEnabled())   logger.trace("String_Node_Str" + event);
  for (  MetaContactListListener listener : getMetaContactListListeners()) {
    if (event instanceof MetaContactMovedEvent) {
      listener.metaContactMoved((MetaContactMovedEvent)event);
    }
 else     if (event instanceof MetaContactRenamedEvent) {
      listener.metaContactRenamed((MetaContactRenamedEvent)event);
    }
 else     if (event instanceof MetaContactModifiedEvent) {
      listener.metaContactModified((MetaContactModifiedEvent)event);
    }
 else     if (event instanceof MetaContactAvatarUpdateEvent) {
      listener.metaContactAvatarUpdated((MetaContactAvatarUpdateEvent)event);
    }
  }
}
Program: 103562
Project: 103562
Buggy source:
/** 
 * Initiates the content of this frame.
 */
private void init(){
  if (GuiActivator.getUIService().getExitOnMainWindowClose())   this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
 else   this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
  this.setKeybindingInput(KeybindingSet.Category.MAIN);
  this.addKeybindingAction("String_Node_Str",new RenameAction());
  getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).remove(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,0));
  TransparentPanel northPanel=new TransparentPanel(new BorderLayout(0,0));
  this.setJMenuBar(menu);
  northPanel.add(accountStatusPanel,BorderLayout.CENTER);
  TransparentPanel searchPanel=new TransparentPanel(new BorderLayout(2,0));
  searchPanel.setBorder(BorderFactory.createEmptyBorder(0,5,5,5));
  searchPanel.add(searchField);
  searchPanel.add(new CallHistoryButton(),BorderLayout.EAST);
  centerPanel.add(searchPanel,BorderLayout.NORTH);
  centerPanel.add(contactListPanel,BorderLayout.CENTER);
  this.mainPanel.add(northPanel,BorderLayout.NORTH);
  this.mainPanel.add(centerPanel,BorderLayout.CENTER);
  java.awt.Container contentPane=getContentPane();
  contentPane.add(mainPanel,BorderLayout.CENTER);
  contentPane.add(statusBarPanel,BorderLayout.SOUTH);
}

Fixed version (ground truth):
/** 
 * Initiates the content of this frame.
 */
private void init(){
  setDefaultCloseOperation(GuiActivator.getUIService().getExitOnMainWindowClose() ? JFrame.DISPOSE_ON_CLOSE : JFrame.HIDE_ON_CLOSE);
  this.setKeybindingInput(KeybindingSet.Category.MAIN);
  this.addKeybindingAction("String_Node_Str",new RenameAction());
  getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).remove(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,0));
  TransparentPanel northPanel=new TransparentPanel(new BorderLayout(0,0));
  this.setJMenuBar(menu);
  northPanel.add(accountStatusPanel,BorderLayout.CENTER);
  TransparentPanel searchPanel=new TransparentPanel(new BorderLayout(2,0));
  searchPanel.setBorder(BorderFactory.createEmptyBorder(0,5,5,5));
  searchPanel.add(searchField);
  searchPanel.add(new CallHistoryButton(),BorderLayout.EAST);
  centerPanel.add(searchPanel,BorderLayout.NORTH);
  centerPanel.add(contactListPanel,BorderLayout.CENTER);
  this.mainPanel.add(northPanel,BorderLayout.NORTH);
  this.mainPanel.add(centerPanel,BorderLayout.CENTER);
  java.awt.Container contentPane=getContentPane();
  contentPane.add(mainPanel,BorderLayout.CENTER);
  contentPane.add(statusBarPanel,BorderLayout.SOUTH);
}
Program: 103563
Project: 103563
Buggy source:
/** 
 * Sets a name that can be used when displaying this contact in user interface components.
 * @param displayName a human readable String representing this<tt>MetaContact</tt>
 */
void setDisplayName(String displayName){
synchronized (getParentGroupModLock()) {
    if (parentGroup != null) {
      parentGroup.lightRemoveMetaContact(this);
    }
    this.displayName=(displayName == null) ? "String_Node_Str" : displayName;
    if (parentGroup != null) {
      parentGroup.lightAddMetaContact(this);
    }
  }
}

Fixed version (ground truth):
/** 
 * Sets a name that can be used when displaying this contact in user interface components.
 * @param displayName a human readable String representing this<tt>MetaContact</tt>
 */
void setDisplayName(String displayName){
synchronized (getParentGroupModLock()) {
    if (parentGroup != null)     parentGroup.lightRemoveMetaContact(this);
    this.displayName=(displayName == null) ? "String_Node_Str" : displayName;
    if (parentGroup != null)     parentGroup.lightAddMetaContact(this);
  }
}
Program: 103564
Project: 103564
Buggy source:
/** 
 * Removes the specified protocol specific contact from the contacts encapsulated in this <code>MetaContact</code>. The method also updates the total status field accordingly. And updates its ordered position in its parent group. If the display name of this <code>MetaContact</code> was the one of the removed contact, we update it.
 * @param contact the contact to remove
 */
void removeProtoContact(Contact contact){
synchronized (getParentGroupModLock()) {
    if (parentGroup != null) {
      parentGroup.lightRemoveMetaContact(this);
    }
    contactsOnline-=contact.getPresenceStatus().isOnline() ? 1 : 0;
    this.protoContacts.remove(contact);
    if (defaultContact == contact) {
      defaultContact=null;
    }
    if ((protoContacts.size() > 0) && displayName.equals(contact.getDisplayName())) {
      displayName=getDefaultContact().getDisplayName();
    }
    if (parentGroup != null) {
      parentGroup.lightAddMetaContact(this);
    }
  }
}

Fixed version (ground truth):
/** 
 * Removes the specified protocol specific contact from the contacts encapsulated in this <code>MetaContact</code>. The method also updates the total status field accordingly. And updates its ordered position in its parent group. If the display name of this <code>MetaContact</code> was the one of the removed contact, we update it.
 * @param contact the contact to remove
 */
void removeProtoContact(Contact contact){
synchronized (getParentGroupModLock()) {
    if (parentGroup != null)     parentGroup.lightRemoveMetaContact(this);
    contactsOnline-=contact.getPresenceStatus().isOnline() ? 1 : 0;
    this.protoContacts.remove(contact);
    if (defaultContact == contact)     defaultContact=null;
    if ((protoContacts.size() > 0) && displayName.equals(contact.getDisplayName())) {
      displayName=getDefaultContact().getDisplayName();
    }
    if (parentGroup != null)     parentGroup.lightAddMetaContact(this);
  }
}
Program: 103565
Project: 103565
Buggy source:
/** 
 * Adds the specified protocol specific contact to the list of contacts merged in this meta contact. The method also keeps up to date the contactsOnline field which is used in the compareTo() method.
 * @param contact the protocol specific Contact to add.
 */
void addProtoContact(Contact contact){
synchronized (getParentGroupModLock()) {
    if (parentGroup != null) {
      parentGroup.lightRemoveMetaContact(this);
    }
    contactsOnline+=contact.getPresenceStatus().isOnline() ? 1 : 0;
    this.protoContacts.add(contact);
    defaultContact=null;
    if (this.protoContacts.size() == 1 && (this.displayName == null || this.displayName.trim().length() == 0)) {
      this.displayName=contact.getDisplayName();
    }
    if (parentGroup != null) {
      parentGroup.lightAddMetaContact(this);
    }
  }
}

Fixed version (ground truth):
/** 
 * Adds the specified protocol specific contact to the list of contacts merged in this meta contact. The method also keeps up to date the contactsOnline field which is used in the compareTo() method.
 * @param contact the protocol specific Contact to add.
 */
void addProtoContact(Contact contact){
synchronized (getParentGroupModLock()) {
    if (parentGroup != null)     parentGroup.lightRemoveMetaContact(this);
    contactsOnline+=contact.getPresenceStatus().isOnline() ? 1 : 0;
    this.protoContacts.add(contact);
    defaultContact=null;
    if (this.protoContacts.size() == 1 && (this.displayName == null || this.displayName.trim().length() == 0)) {
      this.displayName=contact.getDisplayName();
    }
    if (parentGroup != null)     parentGroup.lightAddMetaContact(this);
  }
}
Program: 103566
Project: 103566
Buggy source:
/** 
 * Queries all protoco contacts in this meta contact for their avatars. Beware that this method could cause multiple network operations. Use with caution.
 * @return a byte array containing the first avatar returned by any ofthis metacontact's child contacts or <tt>null</tt> if none of them returned an avatar.
 */
private byte[] queryProtoContactAvatar(Contact contact){
  try {
    byte[] contactImage=contact.getImage();
    if (contactImage != null && contactImage.length > 0) {
      return contactImage;
    }
  }
 catch (  Exception ex) {
    logger.error("String_Node_Str",ex);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Queries all protocol contacts in this meta contact for their avatars. Beware that this method could cause multiple network operations. Use with caution.
 * @return a byte array containing the first avatar returned by any ofthis metacontact's child contacts or <tt>null</tt> if none of them returned an avatar.
 */
private byte[] queryProtoContactAvatar(Contact contact){
  try {
    byte[] contactImage=contact.getImage();
    if (contactImage != null && contactImage.length > 0) {
      return contactImage;
    }
  }
 catch (  Exception ex) {
    logger.error("String_Node_Str",ex);
  }
  return null;
}
Program: 103568
Project: 103568
Buggy source:
/** 
 * Returns the default <tt>ContactDetail</tt> to use for any operations depending to the given <tt>OperationSet</tt> class.
 * @param opSetClass the <tt>OperationSet</tt> class we're interested in
 * @return the default <tt>ContactDetail</tt> to use for any operationsdepending to the given <tt>OperationSet</tt> class
 */
public UIContactDetail getDefaultContactDetail(Class<? extends OperationSet> opSetClass){
  List<UIContactDetail> details=getContactDetailsForOperationSet(opSetClass);
  if (details != null && !details.isEmpty())   return details.get(0);
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the default <tt>ContactDetail</tt> to use for any operations depending to the given <tt>OperationSet</tt> class.
 * @param opSetClass the <tt>OperationSet</tt> class we're interested in
 * @return the default <tt>ContactDetail</tt> to use for any operationsdepending to the given <tt>OperationSet</tt> class
 */
public UIContactDetail getDefaultContactDetail(Class<? extends OperationSet> opSetClass){
  List<UIContactDetail> details=getContactDetailsForOperationSet(opSetClass);
  return (details != null && !details.isEmpty()) ? details.get(0) : null;
}
Program: 103569
Project: 103569
Buggy source:
/** 
 * Returns the display name of this <tt>MetaUIContact</tt>.
 * @return the display name of this <tt>MetaUIContact</tt>
 */
public String getDisplayName(){
  return metaContact.getDisplayName();
}

Fixed version (ground truth):
/** 
 * Returns the display name of this <tt>MetaUIContact</tt>.
 * @return the display name of this <tt>MetaUIContact</tt>
 */
public String getDisplayName(){
  String displayName=metaContact.getDisplayName();
  if ((displayName == null) || (displayName.trim().length() == 0)) {
    Iterator<Contact> contactIter=metaContact.getContacts();
    int contactCount=0;
    String address=null;
    while (contactIter.hasNext()) {
      Contact contact=contactIter.next();
      contactCount++;
      displayName=contact.getDisplayName();
      if ((displayName == null) || (displayName.trim().length() == 0)) {
        address=(contactCount == 1) ? contact.getAddress() : null;
      }
 else       break;
    }
    if ((address != null) && (address.trim().length() != 0) && ((displayName == null) || (displayName.trim().length() == 0)))     displayName=address;
  }
  return displayName;
}
Program: 103570
Project: 103570
Buggy source:
/** 
 * Returns a String that could be used by any user interacting modules for referring to this contact. An alias is not necessarily unique but is often more human readable than an address (or id).
 * @return a String that can be used for referring to this contact wheninteracting with the user.
 */
public String getDisplayName(){
  if (isResolved) {
    String name=null;
    RosterEntry entry=ssclCallback.getRosterEntry(jid);
    if (entry != null)     name=entry.getName();
    if (name == null)     name=getAddress();
    return name;
  }
 else   return tempId;
}

Fixed version (ground truth):
/** 
 * Returns a String that could be used by any user interacting modules for referring to this contact. An alias is not necessarily unique but is often more human readable than an address (or id).
 * @return a String that can be used for referring to this contact wheninteracting with the user.
 */
public String getDisplayName(){
  if (isResolved) {
    RosterEntry entry=ssclCallback.getRosterEntry(jid);
    String name=null;
    if (entry != null)     name=entry.getName();
    if ((name != null) && (name.trim().length() != 0))     return name;
  }
  return getAddress();
}
Program: 103571
Project: 103571
Buggy source:
/** 
 * Returns a reference to the contact group that this contact is currently a child of or null if the underlying protocol does not suppord persistent presence.
 * @return a reference to the contact group that this contact is currentlya child of or null if the underlying protocol does not suppord persistent presence.
 */
public ContactGroup getParentContactGroup(){
  return ssclCallback.findContactGroup(this);
}

Fixed version (ground truth):
/** 
 * Returns a reference to the contact group that this contact is currently a child of or null if the underlying protocol does not support persistent presence.
 * @return a reference to the contact group that this contact is currentlya child of or null if the underlying protocol does not support persistent presence.
 */
public ContactGroup getParentContactGroup(){
  return ssclCallback.findContactGroup(this);
}
Program: 103572
Project: 103572
Buggy source:
/** 
 * Puts the <tt>CallPeer</tt> represented by this instance on or off hold.
 * @param onHold <tt>true</tt> to have the <tt>CallPeer</tt> put on hold;<tt>false</tt>, otherwise
 * @throws OperationFailedException if we fail to construct or send theINVITE request putting the remote side on/off hold.
 */
public void putOnHold(boolean onHold) throws OperationFailedException {
  CallPeerMediaHandlerJabberImpl mediaHandler=getMediaHandler();
  mediaHandler.setLocallyOnHold(onHold);
  try {
    sendReInvite(mediaHandler.createOffer());
  }
 catch (  Exception ex) {
    ProtocolProviderServiceSipImpl.throwOperationFailedException("String_Node_Str",OperationFailedException.INTERNAL_ERROR,ex,logger);
  }
  reevalLocalHoldStatus();
}

Fixed version (ground truth):
/** 
 * Puts the <tt>CallPeer</tt> represented by this instance on or off hold.
 * @param onHold <tt>true</tt> to have the <tt>CallPeer</tt> put on hold;<tt>false</tt>, otherwise
 * @throws OperationFailedException if we fail to construct or send theINVITE request putting the remote side on/off hold.
 */
public void putOnHold(boolean onHold) throws OperationFailedException {
  CallPeerMediaHandlerJabberImpl mediaHandler=getMediaHandler();
  mediaHandler.setLocallyOnHold(onHold);
  reevalLocalHoldStatus();
}