nus-yam/ex-repair huggingface dataset:
Program: 103895
Project: 103895
Buggy source:
/** 
 * Handles file transfer status changed in order to remove completed file transfers from the list of active transfers.
 */
public void statusChanged(FileTransferStatusChangeEvent event){
  FileTransfer fileTransfer=event.getFileTransfer();
  int newStatus=event.getNewStatus();
  if (newStatus == FileTransferStatusChangeEvent.COMPLETED || newStatus == FileTransferStatusChangeEvent.CANCELED || newStatus == FileTransferStatusChangeEvent.FAILED || newStatus == FileTransferStatusChangeEvent.REFUSED) {
    removeActiveFileTransfer(fileTransfer.getID());
    fileTransfer.removeStatusListener(this);
  }
}

Fixed version (ground truth):
/** 
 * Handles file transfer status changed in order to remove completed file transfers from the list of active transfers.
 * @param event the file transfer status change event the notified us forthe change
 */
public void statusChanged(FileTransferStatusChangeEvent event){
  FileTransfer fileTransfer=event.getFileTransfer();
  int newStatus=event.getNewStatus();
  if (newStatus == FileTransferStatusChangeEvent.COMPLETED || newStatus == FileTransferStatusChangeEvent.CANCELED || newStatus == FileTransferStatusChangeEvent.FAILED || newStatus == FileTransferStatusChangeEvent.REFUSED) {
    removeActiveFileTransfer(fileTransfer.getID());
    fileTransfer.removeStatusListener(this);
  }
}
Program: 103896
Project: 103896
Buggy source:
/** 
 * Updates the status of the given chat transport in the send via selector box and notifies the user for the status change.
 */
public void updateChatTransportStatus(ChatTransport chatTransport){
  if (transportSelectorBox != null)   transportSelectorBox.updateTransportStatus(chatTransport);
  this.addMessage(chatTransport.getName(),System.currentTimeMillis(),Chat.STATUS_MESSAGE,GuiActivator.getResources().getI18NString("String_Node_Str",new String[]{chatTransport.getStatus().getStatusName()}),"String_Node_Str");
  if (ConfigurationManager.isMultiChatWindowEnabled()) {
    if (getChatWindow().getChatTabCount() > 0) {
      getChatWindow().setTabIcon(this,new ImageIcon(Constants.getStatusIcon(chatTransport.getStatus())));
    }
  }
}

Fixed version (ground truth):
/** 
 * Updates the status of the given chat transport in the send via selector box and notifies the user for the status change.
 * @param chatTransport the <tt>chatTransport</tt> to update
 */
public void updateChatTransportStatus(ChatTransport chatTransport){
  if (transportSelectorBox != null)   transportSelectorBox.updateTransportStatus(chatTransport);
  this.addMessage(chatTransport.getName(),System.currentTimeMillis(),Chat.STATUS_MESSAGE,GuiActivator.getResources().getI18NString("String_Node_Str",new String[]{chatTransport.getStatus().getStatusName()}),"String_Node_Str");
  if (ConfigurationManager.isMultiChatWindowEnabled()) {
    if (getChatWindow().getChatTabCount() > 0) {
      getChatWindow().setTabIcon(this,new ImageIcon(Constants.getStatusIcon(chatTransport.getStatus())));
    }
  }
}
Program: 103897
Project: 103897
Buggy source:
/** 
 * Adds the given file transfer <tt>id</tt> to the list of active file transfers.
 * @param id the identifier of the file transfer to add
 */
public void addActiveFileTransfer(String id,Object descriptor){
synchronized (activeFileTransfers) {
    activeFileTransfers.put(id,descriptor);
  }
}

Fixed version (ground truth):
/** 
 * Adds the given file transfer <tt>id</tt> to the list of active file transfers.
 * @param id the identifier of the file transfer to add
 * @param descriptor the descriptor of the file transfer
 */
public void addActiveFileTransfer(String id,Object descriptor){
synchronized (activeFileTransfers) {
    activeFileTransfers.put(id,descriptor);
  }
}
Program: 103898
Project: 103898
Buggy source:
public void setChatSubject(String subject){
  if (subjectPanel != null) {
    subjectPanel.setSubject(subject);
    this.addMessage(chatSession.getChatName(),System.currentTimeMillis(),Chat.STATUS_MESSAGE,GuiActivator.getResources().getI18NString("String_Node_Str",new String[]{chatSession.getChatName(),subject}),ChatConversationPanel.TEXT_CONTENT_TYPE);
  }
}

Fixed version (ground truth):
/** 
 * Sets the given <tt>subject</tt> to this chat.
 * @param subject the subject to set
 */
public void setChatSubject(String subject){
  if (subjectPanel != null) {
    subjectPanel.setSubject(subject);
    this.addMessage(chatSession.getChatName(),System.currentTimeMillis(),Chat.STATUS_MESSAGE,GuiActivator.getResources().getI18NString("String_Node_Str",new String[]{chatSession.getChatName(),subject}),ChatConversationPanel.TEXT_CONTENT_TYPE);
  }
}
Program: 103899
Project: 103899
Buggy source:
/** 
 * Shows or hides the Stylebar depending on the value of parameter b.
 * @param b if true, makes the Stylebar visible, otherwise hides the Stylebar
 */
public void setStylebarVisible(boolean b){
  this.writeMessagePanel.setStylebarVisible(b);
}

Fixed version (ground truth):
/** 
 * Shows or hides the Stylebar depending on the value of parameter b.
 * @param b if true, makes the Stylebar visible, otherwise hides theStylebar
 */
public void setStylebarVisible(boolean b){
  this.writeMessagePanel.setStylebarVisible(b);
}
Program: 103900
Project: 103900
Buggy source:
public void updateChatContactStatus(ChatContact chatContact,String statusMessage){
  this.addMessage(chatContact.getName(),System.currentTimeMillis(),Chat.STATUS_MESSAGE,statusMessage,ChatConversationPanel.TEXT_CONTENT_TYPE);
}

Fixed version (ground truth):
/** 
 * Updates the contact status.
 * @param chatContact the chat contact to update
 * @param statusMessage the status message to show
 */
public void updateChatContactStatus(ChatContact chatContact,String statusMessage){
  this.addMessage(chatContact.getName(),System.currentTimeMillis(),Chat.STATUS_MESSAGE,statusMessage,ChatConversationPanel.TEXT_CONTENT_TYPE);
}
Program: 103901
Project: 103901
Buggy source:
public void inviteContacts(ChatTransport inviteChatTransport,Collection<String> chatContacts,String reason){
  ChatSession conferenceChatSession=null;
  if (chatSession instanceof MetaContactChatSession) {
    String newChatName=inviteChatTransport.getDisplayName();
    chatContacts.add(inviteChatTransport.getName());
    ConferenceChatManager conferenceChatManager=GuiActivator.getUIService().getConferenceChatManager();
    if (inviteChatTransport.getProtocolProvider().getOperationSet(OperationSetMultiUserChat.class) != null) {
      ChatRoomWrapper chatRoomWrapper=conferenceChatManager.createChatRoom(newChatName,inviteChatTransport.getProtocolProvider(),chatContacts);
      conferenceChatSession=new ConferenceChatSession(this,chatRoomWrapper);
    }
 else     if (inviteChatTransport.getProtocolProvider().getOperationSet(OperationSetAdHocMultiUserChat.class) != null) {
      AdHocChatRoomWrapper chatRoomWrapper=conferenceChatManager.createAdHocChatRoom(newChatName,inviteChatTransport.getProtocolProvider(),chatContacts);
      conferenceChatSession=new AdHocConferenceChatSession(this,chatRoomWrapper);
    }
    if (conferenceChatSession != null)     this.setChatSession(conferenceChatSession);
  }
 else {
    conferenceChatSession=chatSession;
    for (    String contactAddress : chatContacts) {
      conferenceChatSession.getCurrentChatTransport().inviteChatContact(contactAddress,reason);
    }
  }
}

Fixed version (ground truth):
/** 
 * Invites the given <tt>chatContacts</tt> to this chat.
 * @param inviteChatTransport the chat transport to use to send the invite
 * @param chatContacts the contacts to invite
 * @param reason the reason of the invite
 */
public void inviteContacts(ChatTransport inviteChatTransport,Collection<String> chatContacts,String reason){
  ChatSession conferenceChatSession=null;
  if (chatSession instanceof MetaContactChatSession) {
    String newChatName=inviteChatTransport.getDisplayName();
    chatContacts.add(inviteChatTransport.getName());
    ConferenceChatManager conferenceChatManager=GuiActivator.getUIService().getConferenceChatManager();
    if (inviteChatTransport.getProtocolProvider().getOperationSet(OperationSetMultiUserChat.class) != null) {
      ChatRoomWrapper chatRoomWrapper=conferenceChatManager.createChatRoom(newChatName,inviteChatTransport.getProtocolProvider(),chatContacts);
      conferenceChatSession=new ConferenceChatSession(this,chatRoomWrapper);
    }
 else     if (inviteChatTransport.getProtocolProvider().getOperationSet(OperationSetAdHocMultiUserChat.class) != null) {
      AdHocChatRoomWrapper chatRoomWrapper=conferenceChatManager.createAdHocChatRoom(newChatName,inviteChatTransport.getProtocolProvider(),chatContacts);
      conferenceChatSession=new AdHocConferenceChatSession(this,chatRoomWrapper);
    }
    if (conferenceChatSession != null)     this.setChatSession(conferenceChatSession);
  }
 else {
    conferenceChatSession=chatSession;
    for (    String contactAddress : chatContacts) {
      conferenceChatSession.getCurrentChatTransport().inviteChatContact(contactAddress,reason);
    }
  }
}
Program: 103902
Project: 103902
Buggy source:
/** 
 * Adds the given <tt>IncomingFileTransferRequest</tt> to the conversation panel in order to notify the user of the incoming file.
 * @param request the request to display in the conversation panel
 * @param date the date on which the request has been received
 */
public void addIncomingFileTransferRequest(OperationSetFileTransfer fileTransferOpSet,IncomingFileTransferRequest request,Date date){
  this.addActiveFileTransfer(request.getID(),request);
  ReceiveFileConversationComponent component=new ReceiveFileConversationComponent(this,fileTransferOpSet,request,date);
  if (ConfigurationManager.isHistoryShown() && !isHistoryLoaded) {
synchronized (incomingEventBuffer) {
      incomingEventBuffer.add(component);
    }
  }
 else   this.getChatConversationPanel().addComponent(component);
}

Fixed version (ground truth):
/** 
 * Adds the given <tt>IncomingFileTransferRequest</tt> to the conversation panel in order to notify the user of the incoming file.
 * @param fileTransferOpSet the file transfer operation set
 * @param request the request to display in the conversation panel
 * @param date the date on which the request has been received
 */
public void addIncomingFileTransferRequest(OperationSetFileTransfer fileTransferOpSet,IncomingFileTransferRequest request,Date date){
  this.addActiveFileTransfer(request.getID(),request);
  ReceiveFileConversationComponent component=new ReceiveFileConversationComponent(this,fileTransferOpSet,request,date);
  if (ConfigurationManager.isHistoryShown() && !isHistoryLoaded) {
synchronized (incomingEventBuffer) {
      incomingEventBuffer.add(component);
    }
  }
 else   this.getChatConversationPanel().addComponent(component);
}
Program: 103903
Project: 103903
Buggy source:
/** 
 * Adds the given error message to the chat window conversation area.
 * @param contactName the name of the contact, for which the error occured
 * @param message the error message
 */
public void addErrorMessage(String contactName,String title,String message){
  this.addMessage(contactName,System.currentTimeMillis(),Chat.ERROR_MESSAGE,title,message,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Adds the given error message to the chat window conversation area.
 * @param contactName the name of the contact, for which the error occurred
 * @param title the title of the error
 * @param message the error message
 */
public void addErrorMessage(String contactName,String title,String message){
  this.addMessage(contactName,System.currentTimeMillis(),Chat.ERROR_MESSAGE,title,message,"String_Node_Str");
}
Program: 103905
Project: 103905
Buggy source:
public ChatSession getChatSession(){
  return chatSession;
}

Fixed version (ground truth):
/** 
 * Returns the chat session associated with this chat panel.
 * @return the chat session associated with this chat panel
 */
public ChatSession getChatSession(){
  return chatSession;
}
Program: 103906
Project: 103906
Buggy source:
public static ResourceManagementService getResources(){
  if (resourcesService == null) {
    ServiceReference serviceReference=bundleContext.getServiceReference(ResourceManagementService.class.getName());
    if (serviceReference == null)     return null;
    resourcesService=(ResourceManagementService)bundleContext.getService(serviceReference);
  }
  return resourcesService;
}

Fixed version (ground truth):
/** 
 * Gets the <tt>ResourceManagementService</tt> instance which provides common resources such as internationalized and localized strings, images to the MSN bundle.
 * @return the <tt>ResourceManagementService</tt> instance which providescommon resources such as internationalized and localized strings, images to the MSN bundle
 */
public static ResourceManagementService getResources(){
  if (resources == null)   resources=ResourceManagementServiceUtils.getService(bundleContext);
  return resources;
}
Program: 103907
Project: 103907
Buggy source:
/** 
 * Called when this bundle is started so the Framework can perform the bundle-specific activities necessary to start this bundle.
 * @param context The execution context of the bundle being started.
 * @throws Exception If this method throws an exception, this bundle ismarked as stopped and the Framework will remove this bundle's listeners, unregister all services registered by this bundle, and release all services used by this bundle.
 */
public void start(BundleContext context) throws Exception {
  MsnActivator.bundleContext=context;
  Hashtable<String,String> hashtable=new Hashtable<String,String>();
  hashtable.put(ProtocolProviderFactory.PROTOCOL,ProtocolNames.MSN);
  msnProviderFactory=new ProtocolProviderFactoryMsnImpl();
  msnPpFactoryServReg=context.registerService(ProtocolProviderFactory.class.getName(),msnProviderFactory,hashtable);
}

Fixed version (ground truth):
/** 
 * Called when this bundle is started so the Framework can perform the bundle-specific activities necessary to start this bundle.
 * @param context The execution context of the bundle being started.
 * @throws Exception If this method throws an exception, this bundle ismarked as stopped and the Framework will remove this bundle's listeners, unregister all services registered by this bundle, and release all services used by this bundle.
 */
public void start(BundleContext context) throws Exception {
  MsnActivator.bundleContext=context;
  Hashtable<String,String> hashtable=new Hashtable<String,String>();
  hashtable.put(ProtocolProviderFactory.PROTOCOL,ProtocolNames.MSN);
  msnProviderFactory=new ProtocolProviderFactoryMsnImpl();
  ReferenceURLStreamHandlerService.registerService(bundleContext);
  msnPpFactoryServReg=context.registerService(ProtocolProviderFactory.class.getName(),msnProviderFactory,hashtable);
}
Program: 103908
Project: 103908
Buggy source:
/** 
 * Removes the specified group from the buddy list.
 * @param groupToRemove the group that we'd like removed.
 */
public void removeGroup(ContactGroupMsnImpl groupToRemove){
  if (groupToRemove.getSourceGroup().getGroupId().equals("String_Node_Str"))   return;
  logger.trace("String_Node_Str" + groupToRemove);
  MsnContact[] contacts=groupToRemove.getSourceGroup().getContacts();
  ModListenerRemoveGroup removedContactsListener=new ModListenerRemoveGroup(contacts.length);
  contactListModManager.addModificationListener(removedContactsListener);
  for (int i=0; i < contacts.length; i++) {
    logger.trace("String_Node_Str" + contacts[i]);
    msnProvider.getMessenger().removeFriend(contacts[i].getEmail(),false);
  }
  removedContactsListener.waitForLastEvent(contacts.length * 1000);
  contactListModManager.removeModificationListener(removedContactsListener);
  msnProvider.getMessenger().removeGroup(groupToRemove.getSourceGroup().getGroupId());
}

Fixed version (ground truth):
/** 
 * Removes the specified group from the buddy list.
 * @param groupToRemove the group that we'd like removed.
 */
public void removeGroup(ContactGroupMsnImpl groupToRemove){
  if (groupToRemove.getSourceGroup().getGroupId().equals("String_Node_Str"))   return;
  logger.trace("String_Node_Str" + groupToRemove);
  MsnContact[] contacts=groupToRemove.getSourceGroup().getContacts();
  ModListenerRemoveGroup removedContactsListener=new ModListenerRemoveGroup(contacts.length);
  contactListModManager.addModificationListener(removedContactsListener);
  for (int i=0; i < contacts.length; i++) {
    logger.trace("String_Node_Str" + contacts[i]);
    msnProvider.getMessenger().removeFriend(contacts[i].getEmail(),groupToRemove.getSourceGroup().getGroupId());
  }
  removedContactsListener.waitForLastEvent(contacts.length * 1000);
  contactListModManager.removeModificationListener(removedContactsListener);
  msnProvider.getMessenger().removeGroup(groupToRemove.getSourceGroup().getGroupId());
}
Program: 103909
Project: 103909
Buggy source:
/** 
 * Creates a test suite containing tests of this class in a specific order. We'll first execute tests beginning with the "test" prefix and then go to ordered tests.We first execture tests for receiving messagese, so that a volatile contact is created for the sender. we'll then be able to retrieve this volatile contact and send them a message on our turn. We need to do things this way as the contact corresponding to the tester agent has been removed in the previous test and we no longer have it in our contact list.
 * @return Test a testsuite containing all tests to execute.
 */
public static Test suite(){
  TestSuite suite=new TestSuite();
  suite.addTest(new TestOperationSetBasicInstantMessaging("String_Node_Str"));
  suite.addTestSuite(TestOperationSetBasicInstantMessaging.class);
  suite.addTest(new TestOperationSetBasicInstantMessaging("String_Node_Str"));
  return suite;
}

Fixed version (ground truth):
/** 
 * Creates a test suite containing tests of this class in a specific order. We'll first execute tests beginning with the "test" prefix and then go to ordered tests.We first execture tests for receiving messagese, so that a volatile contact is created for the sender. we'll then be able to retrieve this volatile contact and send them a message on our turn. We need to do things this way as the contact corresponding to the tester agent has been removed in the previous test and we no longer have it in our contact list.
 * @return Test a testsuite containing all tests to execute.
 */
public static Test suite(){
  TestSuite suite=new TestSuite();
  suite.addTest(new TestOperationSetBasicInstantMessaging("String_Node_Str"));
  suite.addTestSuite(TestOperationSetBasicInstantMessaging.class);
  suite.addTest(new TestOperationSetBasicInstantMessaging("String_Node_Str"));
  suite.addTest(new TestOperationSetBasicInstantMessaging("String_Node_Str"));
  return suite;
}
Program: 103910
Project: 103910
Buggy source:
/** 
 * Executes the action associated with the "Hang up" button which may be invoked by clicking the button in question or closing this dialog.
 */
private void actionPerformedOnHangupButton(){
  Call call=getCall();
  if (call != null)   CallManager.hangupCall(call);
  this.dispose();
}

Fixed version (ground truth):
/** 
 * Executes the action associated with the "Hang up" button which may be invoked by clicking the button in question or closing this dialog.
 */
private void actionPerformedOnHangupButton(){
  Call call=getCall();
  NotificationManager.stopSound(NotificationManager.OUTGOING_CALL);
  NotificationManager.stopSound(NotificationManager.BUSY_CALL);
  if (call != null)   CallManager.hangupCall(call);
  this.dispose();
}
Program: 103911
Project: 103911
Buggy source:
/** 
 * Implements CallListener.incomingCallReceived. When a call is received creates a <tt>ReceivedCallDialog</tt> and plays the ring phone sound to the user.
 */
public void incomingCallReceived(CallEvent event){
  Call sourceCall=event.getSourceCall();
  ReceivedCallDialog receivedCallDialog=new ReceivedCallDialog(sourceCall);
  receivedCallDialog.pack();
  receivedCallDialog.setVisible(true);
  NotificationManager.fireNotification(NotificationManager.INCOMING_CALL,"String_Node_Str","String_Node_Str" + sourceCall.getCallPeers().next());
}

Fixed version (ground truth):
/** 
 * Implements CallListener.incomingCallReceived. When a call is received creates a <tt>ReceivedCallDialog</tt> and plays the ring phone sound to the user.
 * @param event the <tt>CallEvent</tt>
 */
public void incomingCallReceived(CallEvent event){
  Call sourceCall=event.getSourceCall();
  ReceivedCallDialog receivedCallDialog=new ReceivedCallDialog(sourceCall);
  receivedCallDialog.pack();
  receivedCallDialog.setVisible(true);
  NotificationManager.fireNotification(NotificationManager.INCOMING_CALL,"String_Node_Str","String_Node_Str" + sourceCall.getCallPeers().next());
}
Program: 103912
Project: 103912
Buggy source:
/** 
 * Implements CallListener.callEnded. Stops sounds that are playing at the moment if there're any. Removes the call panel and disables the hang up button.
 */
public void callEnded(CallEvent event){
  Call sourceCall=event.getSourceCall();
  NotificationManager.stopSound(NotificationManager.BUSY_CALL);
  NotificationManager.stopSound(NotificationManager.INCOMING_CALL);
  NotificationManager.stopSound(NotificationManager.OUTGOING_CALL);
  if (activeCalls.get(sourceCall) != null) {
    CallDialog callDialog=activeCalls.get(sourceCall);
    disposeCallDialogWait(callDialog);
  }
}

Fixed version (ground truth):
/** 
 * Implements CallListener.callEnded. Stops sounds that are playing at the moment if there're any. Removes the call panel and disables the hang up button.
 * @param event the <tt>CallEvent</tt>
 */
public void callEnded(CallEvent event){
  Call sourceCall=event.getSourceCall();
  NotificationManager.stopSound(NotificationManager.BUSY_CALL);
  NotificationManager.stopSound(NotificationManager.INCOMING_CALL);
  NotificationManager.stopSound(NotificationManager.OUTGOING_CALL);
  if (activeCalls.get(sourceCall) != null) {
    CallDialog callDialog=activeCalls.get(sourceCall);
    disposeCallDialogWait(callDialog);
  }
}
Program: 103913
Project: 103913
Buggy source:
/** 
 * Hang ups the given call.
 * @param call the call to answer
 */
public static void hangupCall(final Call call){
  NotificationManager.stopSound(NotificationManager.BUSY_CALL);
  NotificationManager.stopSound(NotificationManager.INCOMING_CALL);
  NotificationManager.stopSound(NotificationManager.OUTGOING_CALL);
  new HangupCallThread(call).start();
}

Fixed version (ground truth):
/** 
 * Hang ups the given call.
 * @param call the call to answer
 */
public static void hangupCall(final Call call){
  new HangupCallThread(call).start();
}
Program: 103914
Project: 103914
Buggy source:
/** 
 * Creates and opens a call dialog. Implements CallListener.outGoingCallCreated. .
 */
public void outgoingCallCreated(CallEvent event){
  Call sourceCall=event.getSourceCall();
  CallDialog callDialog=CallManager.openCallDialog(sourceCall);
  activeCalls.put(sourceCall,callDialog);
}

Fixed version (ground truth):
/** 
 * Creates and opens a call dialog. Implements CallListener.outGoingCallCreated.
 * @param event the <tt>CallEvent</tt>
 */
public void outgoingCallCreated(CallEvent event){
  Call sourceCall=event.getSourceCall();
  CallDialog callDialog=CallManager.openCallDialog(sourceCall);
  activeCalls.put(sourceCall,callDialog);
}
Program: 103915
Project: 103915
Buggy source:
/** 
 * Handles <tt>ActionEvent</tt>s triggered by pressing the call or the hangup buttons.
 * @param e The <tt>ActionEvent</tt> to handle.
 */
public void actionPerformed(ActionEvent e){
  JButton button=(JButton)e.getSource();
  String buttonName=button.getName();
  if (buttonName.equals(CALL_BUTTON)) {
    CallManager.answerCall(incomingCall);
  }
 else   if (buttonName.equals(HANGUP_BUTTON)) {
    CallManager.hangupCall(incomingCall);
  }
  this.dispose();
}

Fixed version (ground truth):
/** 
 * Handles <tt>ActionEvent</tt>s triggered by pressing the call or the hangup buttons.
 * @param e The <tt>ActionEvent</tt> to handle.
 */
public void actionPerformed(ActionEvent e){
  JButton button=(JButton)e.getSource();
  String buttonName=button.getName();
  if (buttonName.equals(CALL_BUTTON)) {
    CallManager.answerCall(incomingCall);
  }
 else   if (buttonName.equals(HANGUP_BUTTON)) {
    NotificationManager.stopSound(NotificationManager.INCOMING_CALL);
    CallManager.hangupCall(incomingCall);
  }
  this.dispose();
}
Program: 103916
Project: 103916
Buggy source:
public void outgoingCallCreated(CallEvent event){
}

Fixed version (ground truth):
/** 
 * Indicates that an outgoing call has been created.
 */
public void outgoingCallCreated(CallEvent event){
}
Program: 103917
Project: 103917
Buggy source:
public void incomingCallReceived(CallEvent event){
}

Fixed version (ground truth):
/** 
 * Indicates that an incoming call has been received.
 */
public void incomingCallReceived(CallEvent event){
}
Program: 103918
Project: 103918
Buggy source:
public void callEnded(CallEvent event){
  this.dispose();
}

Fixed version (ground truth):
/** 
 * When call is remotely ended we close this dialog.
 * @param event the <tt>CallEvent</tt> that has been triggered
 */
public void callEnded(CallEvent event){
  Call sourceCall=event.getSourceCall();
  if (sourceCall.equals(incomingCall)) {
    this.dispose();
  }
}
Program: 103919
Project: 103919
Buggy source:
@Override protected void close(boolean isEscaped){
}

Fixed version (ground truth):
/** 
 * Invoked when this dialog is closed.
 */
protected void close(boolean isEscaped){
}
Program: 103920
Project: 103920
Buggy source:
/** 
 * Create the list to be sure that contacts exchanging messages exists in each other lists
 * @throws Exception
 */
public void prepareContactList() throws Exception {
  if (getContact1() == null && getContact2() == null)   fixture.clearProvidersLists();
  if (getContact1() == null) {
    Object o=new Object();
synchronized (o) {
      o.wait(2000);
    }
    try {
      opSetPresence1.setAuthorizationHandler(new AuthHandler());
      opSetPresence1.subscribe(fixture.userID2);
    }
 catch (    OperationFailedException ex) {
    }
  }
  if (getContact2() == null) {
    try {
      opSetPresence2.setAuthorizationHandler(new AuthHandler());
      opSetPresence2.subscribe(fixture.userID1);
    }
 catch (    OperationFailedException ex1) {
    }
    logger.info("String_Node_Str");
    Object o=new Object();
synchronized (o) {
      o.wait(2000);
    }
  }
}

Fixed version (ground truth):
/** 
 * Create the list to be sure that contacts exchanging messages exists in each other lists
 * @throws Exception
 */
public void prepareContactList() throws Exception {
  if (contact1 == null && contact2 == null) {
    fixture.clearProvidersLists();
  }
  if (getContact1() == null) {
    Object o=new Object();
synchronized (o) {
      o.wait(2000);
    }
    try {
      opSetPresence1.setAuthorizationHandler(new AuthHandler());
      opSetPresence1.subscribe(fixture.userID2);
    }
 catch (    OperationFailedException ex) {
    }
  }
  if (getContact2() == null) {
    try {
      opSetPresence2.setAuthorizationHandler(new AuthHandler());
      opSetPresence2.subscribe(fixture.userID1);
    }
 catch (    OperationFailedException ex1) {
    }
    logger.info("String_Node_Str");
    Object o=new Object();
synchronized (o) {
      o.wait(2000);
    }
  }
}
Program: 103921
Project: 103921
Buggy source:
protected OperationSetServerStoredContactInfoFacebookImpl(ProtocolProviderServiceFacebookImpl provider){
  this.parentProvider=provider;
}

Fixed version (ground truth):
/** 
 * Creates a new instance of this class using the specified parent <tt>provider</tt>.
 * @param provider the provider that's creating us.
 */
protected OperationSetServerStoredContactInfoFacebookImpl(ProtocolProviderServiceFacebookImpl provider){
  this.parentProvider=provider;
}
Program: 103922
Project: 103922
Buggy source:
public static byte[] getImage(String urlStr){
  ByteArrayOutputStream byteArrayOS=new ByteArrayOutputStream();
  try {
    URL url=new URL(urlStr);
    BufferedImage newAvatar=ImageIO.read(url);
    javax.imageio.ImageIO.write(newAvatar,"String_Node_Str",byteArrayOS);
  }
 catch (  IOException e) {
    logger.warn("String_Node_Str",e);
    return null;
  }
 finally {
    try {
      byteArrayOS.close();
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
  return byteArrayOS.toByteArray();
}

Fixed version (ground truth):
/** 
 * Returns the bytes of the image at the specified <tt>urlStr</tt> location or <tt>null</tt> if we fail to retrieve it for some reason.
 * @param urlStr
 * @return a <tt>byte[]</tt> array containing the bytes of the image at thespecified <tt>urlStr</tt> location or <tt>null</tt> if we fail to retrieve it for some reason.
 */
public static byte[] getImage(String urlStr){
  ByteArrayOutputStream byteArrayOS=new ByteArrayOutputStream();
  try {
    URL url=new URL(urlStr);
    BufferedImage newAvatar=ImageIO.read(url);
    javax.imageio.ImageIO.write(newAvatar,"String_Node_Str",byteArrayOS);
  }
 catch (  IOException e) {
    logger.warn("String_Node_Str",e);
    return null;
  }
 finally {
    try {
      byteArrayOS.close();
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
  return byteArrayOS.toByteArray();
}
Program: 103923
Project: 103923
Buggy source:
public void initialEmailNotificationReceived(MsnSwitchboard switchboard,MsnEmailInitMessage message,MsnContact contact){
}

Fixed version (ground truth):
/** 
 * Not interested in this event.
 */
public void initialEmailNotificationReceived(MsnSwitchboard switchboard,MsnEmailInitMessage message,MsnContact contact){
}
Program: 103924
Project: 103924
Buggy source:
public void switchboardClosed(MsnSwitchboard switchboard){
  AdHocChatRoomMsnImpl adHocChatRoom=getLocalAdHocChatRoomInstance(switchboard);
  if (adHocChatRoom == null)   return;
 else {
    adHocChatRoom.setSwitchboard(null);
    adHocChatRoom.leave();
    fireLocalUserPresenceEvent(adHocChatRoom,LocalUserChatRoomPresenceChangeEvent.LOCAL_USER_DROPPED,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Indicates that a switchboard has been closed.
 * @param switchboard the switchboard that has been closed
 */
public void switchboardClosed(MsnSwitchboard switchboard){
  AdHocChatRoomMsnImpl adHocChatRoom=getLocalAdHocChatRoomInstance(switchboard);
  if (adHocChatRoom == null)   return;
 else {
    adHocChatRoom.setSwitchboard(null);
    adHocChatRoom.leave();
    fireLocalUserPresenceEvent(adHocChatRoom,LocalUserChatRoomPresenceChangeEvent.LOCAL_USER_DROPPED,"String_Node_Str");
  }
}
Program: 103925
Project: 103925
Buggy source:
/** 
 * Creates an <tt>AdHocChatRoom</tt> whose name is _adHocRoomName with the properties contained in _adHocRoomProperties
 * @param adHocRoomName the name of the ad-hoc room
 * @param adHocRoomProperties the ad-hoc room's properties
 * @throws OperationFailedException
 * @throws OperationNotSupportedException
 */
public AdHocChatRoom createAdHocChatRoom(String adHocRoomName,Map<String,Object> adHocRoomProperties) throws OperationFailedException, OperationNotSupportedException {
  AdHocChatRoom adHocRoom=adHocChatRoomCache.get(adHocRoomName);
  if (adHocRoom == null) {
    assertConnected();
    Object id=new Object();
    this.provider.getMessenger().newSwitchboard(id);
    adHocRoom=createLocalAdHocChatRoomInstance(adHocRoomName,id);
  }
  return adHocRoom;
}

Fixed version (ground truth):
/** 
 * Creates an <tt>AdHocChatRoom</tt> whose name is _adHocRoomName with the properties contained in _adHocRoomProperties
 * @param adHocRoomName the name of the ad-hoc room
 * @param adHocRoomProperties the ad-hoc room's properties
 * @return the created ad-hoc room
 * @throws OperationFailedException
 * @throws OperationNotSupportedException
 */
public AdHocChatRoom createAdHocChatRoom(String adHocRoomName,Map<String,Object> adHocRoomProperties) throws OperationFailedException, OperationNotSupportedException {
  AdHocChatRoom adHocRoom=adHocChatRoomCache.get(adHocRoomName);
  if (adHocRoom == null) {
    assertConnected();
    Object id=new Object();
    this.provider.getMessenger().newSwitchboard(id);
    adHocRoom=createLocalAdHocChatRoomInstance(adHocRoomName,id);
  }
  return adHocRoom;
}
Program: 103926
Project: 103926
Buggy source:
public void initialEmailDataReceived(MsnSwitchboard switchboard,MsnEmailInitEmailData message,MsnContact contact){
}

Fixed version (ground truth):
/** 
 * Not interested in this event.
 */
public void initialEmailDataReceived(MsnSwitchboard switchboard,MsnEmailInitEmailData message,MsnContact contact){
}
Program: 103927
Project: 103927
Buggy source:
public void contactJoinSwitchboard(MsnSwitchboard switchboard,MsnContact msnContact){
  if (!isGroupChatMessage(switchboard))   return;
  try {
    AdHocChatRoomMsnImpl chatRoom=getLocalAdHocChatRoomInstance(switchboard);
    if (chatRoom == null) {
      chatRoom=createLocalAdHocChatRoomInstance(switchboard);
    }
    OperationSetPersistentPresenceMsnImpl presenceOpSet=(OperationSetPersistentPresenceMsnImpl)provider.getOperationSet(OperationSetPersistentPresence.class);
    ContactMsnImpl contact=presenceOpSet.getServerStoredContactList().findContactById(msnContact.getEmail().getEmailAddress());
    if (contact == null)     contact=new ContactMsnImpl(msnContact,presenceOpSet.getServerStoredContactList(),false,false);
    chatRoom.addAdHocChatRoomParticipant(msnContact.getId(),contact);
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Indicates that the given <tt>msnContact</tt> has joined the given <tt>switchboard</tt>.
 * @param switchboard the switchboard
 * @param msnContact the contact that has joined
 */
public void contactJoinSwitchboard(MsnSwitchboard switchboard,MsnContact msnContact){
  if (!isGroupChatMessage(switchboard))   return;
  try {
    AdHocChatRoomMsnImpl chatRoom=getLocalAdHocChatRoomInstance(switchboard);
    if (chatRoom == null) {
      chatRoom=createLocalAdHocChatRoomInstance(switchboard);
    }
    OperationSetPersistentPresenceMsnImpl presenceOpSet=(OperationSetPersistentPresenceMsnImpl)provider.getOperationSet(OperationSetPersistentPresence.class);
    ContactMsnImpl contact=presenceOpSet.getServerStoredContactList().findContactById(msnContact.getEmail().getEmailAddress());
    if (contact == null)     contact=new ContactMsnImpl(msnContact,presenceOpSet.getServerStoredContactList(),false,false);
    chatRoom.addAdHocChatRoomParticipant(msnContact.getId(),contact);
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
  }
}
Program: 103928
Project: 103928
Buggy source:
public void activityEmailNotificationReceived(MsnSwitchboard switchboard,MsnEmailActivityMessage message,MsnContact contact){
}

Fixed version (ground truth):
/** 
 * Not interested in this event.
 */
public void activityEmailNotificationReceived(MsnSwitchboard switchboard,MsnEmailActivityMessage message,MsnContact contact){
}
Program: 103929
Project: 103929
Buggy source:
public void contactLeaveSwitchboard(MsnSwitchboard switchboard,MsnContact contact){
  logger.debug(contact.getDisplayName() + "String_Node_Str");
  AdHocChatRoomMsnImpl chatRoom=getLocalAdHocChatRoomInstance(switchboard);
  if (chatRoom == null) {
    chatRoom=createLocalAdHocChatRoomInstance(switchboard);
  }
  String participantId=contact.getId();
  Contact participant=chatRoom.getAdHocChatRoomParticipant(participantId);
  if (participant != null) {
    chatRoom.removeParticipant(participantId);
  }
}

Fixed version (ground truth):
/** 
 * Indicates that the given <tt>contact</tt> has left the given <tt>switchboard</tt>.
 * @param switchboard the switchboard
 * @param contact the contact that has left
 */
public void contactLeaveSwitchboard(MsnSwitchboard switchboard,MsnContact contact){
  logger.debug(contact.getDisplayName() + "String_Node_Str");
  AdHocChatRoomMsnImpl chatRoom=getLocalAdHocChatRoomInstance(switchboard);
  if (chatRoom == null)   return;
  String participantId=contact.getId();
  Contact participant=chatRoom.getAdHocChatRoomParticipant(participantId);
  if (participant != null) {
    chatRoom.removeParticipant(participantId);
  }
}
Program: 103930
Project: 103930
Buggy source:
public void newEmailNotificationReceived(MsnSwitchboard switchboard,MsnEmailNotifyMessage message,MsnContact contact){
}

Fixed version (ground truth):
/** 
 * Not interested in this event.
 */
public void newEmailNotificationReceived(MsnSwitchboard switchboard,MsnEmailNotifyMessage message,MsnContact contact){
}
Program: 103931
Project: 103931
Buggy source:
/** 
 * Creates an <tt>OperationSetAdHocMultiUserChatMsnImpl</tt> by specifying the parent provider.
 */
public OperationSetAdHocMultiUserChatMsnImpl(ProtocolProviderServiceMsnImpl provider){
  this.provider=provider;
  this.provider.addRegistrationStateChangeListener(new RegistrationStateListener());
}

Fixed version (ground truth):
/** 
 * Creates an <tt>OperationSetAdHocMultiUserChatMsnImpl</tt> by specifying the parent provider.
 * @param provider the Msn provider
 */
public OperationSetAdHocMultiUserChatMsnImpl(ProtocolProviderServiceMsnImpl provider){
  this.provider=provider;
  this.provider.addRegistrationStateChangeListener(new RegistrationStateListener());
}
Program: 103932
Project: 103932
Buggy source:
public void instantMessageReceived(MsnSwitchboard switchboard,MsnInstantMessage message,MsnContact contact){
  if (!isGroupChatMessage(switchboard))   return;
  Message newMessage=createMessage(message.getContent());
  logger.debug("String_Node_Str");
  AdHocChatRoomMsnImpl chatRoom=getLocalAdHocChatRoomInstance(switchboard);
  if (chatRoom == null) {
    chatRoom=createLocalAdHocChatRoomInstance(switchboard);
  }
  Contact participant=chatRoom.getAdHocChatRoomParticipant(contact.getId());
  AdHocChatRoomMessageReceivedEvent msgReceivedEvent=new AdHocChatRoomMessageReceivedEvent(chatRoom,participant,System.currentTimeMillis(),newMessage,AdHocChatRoomMessageReceivedEvent.CONVERSATION_MESSAGE_RECEIVED);
  chatRoom.fireMessageEvent(msgReceivedEvent);
}

Fixed version (ground truth):
/** 
 * Indicates that an instant message has been received.
 * @param switchboard the switchboard
 * @param message the message
 * @param contact the contact sending the message
 */
public void instantMessageReceived(MsnSwitchboard switchboard,MsnInstantMessage message,MsnContact contact){
  if (!isGroupChatMessage(switchboard))   return;
  Message newMessage=createMessage(message.getContent());
  logger.debug("String_Node_Str");
  AdHocChatRoomMsnImpl chatRoom=getLocalAdHocChatRoomInstance(switchboard);
  if (chatRoom == null) {
    chatRoom=createLocalAdHocChatRoomInstance(switchboard);
  }
  Contact participant=chatRoom.getAdHocChatRoomParticipant(contact.getId());
  AdHocChatRoomMessageReceivedEvent msgReceivedEvent=new AdHocChatRoomMessageReceivedEvent(chatRoom,participant,System.currentTimeMillis(),newMessage,AdHocChatRoomMessageReceivedEvent.CONVERSATION_MESSAGE_RECEIVED);
  chatRoom.fireMessageEvent(msgReceivedEvent);
}
Program: 103933
Project: 103933
Buggy source:
public void switchboardStarted(MsnSwitchboard switchboard){
  Object switchboardID=switchboard.getAttachment();
  AdHocChatRoomMsnImpl adHocChatRoom=null;
  if (switchboardID != null && pendingAdHocChatRoomList.containsKey(switchboardID)) {
    adHocChatRoom=(AdHocChatRoomMsnImpl)pendingAdHocChatRoomList.get(switchboardID);
    pendingAdHocChatRoomList.remove(switchboardID);
    adHocChatRoom.setSwitchboard(switchboard);
    adHocChatRoom.updateParticipantsList(switchboard);
    adHocChatRoomCache.put(switchboard,adHocChatRoom);
  }
 else {
    logger.debug("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Indicates that a switchboard has been started.
 * @param switchboard the switchboard that has been started
 */
public void switchboardStarted(MsnSwitchboard switchboard){
  Object switchboardID=switchboard.getAttachment();
  AdHocChatRoomMsnImpl adHocChatRoom=null;
  if (switchboardID != null && pendingAdHocChatRoomList.containsKey(switchboardID)) {
    adHocChatRoom=(AdHocChatRoomMsnImpl)pendingAdHocChatRoomList.get(switchboardID);
    pendingAdHocChatRoomList.remove(switchboardID);
    adHocChatRoom.setSwitchboard(switchboard);
    adHocChatRoom.updateParticipantsList(switchboard);
    adHocChatRoomCache.put(switchboard,adHocChatRoom);
  }
}
Program: 103934
Project: 103934
Buggy source:
/** 
 * Creates an <tt>AdHocChatRoomMsnImpl</tt> corresponding to the given <tt>switchboard</tt>.
 * @param switchboard  the Msn switchboard that will correspond to thecreated chat room
 * @return  an <tt>AdHocChatRoomMsnImpl</tt> corresponding to the given<tt>switchboard</tt>
 */
private AdHocChatRoomMsnImpl createLocalAdHocChatRoomInstance(MsnSwitchboard switchboard){
  AdHocChatRoomMsnImpl adHocChatRoom=(AdHocChatRoomMsnImpl)this.adHocChatRoomCache.get(String.valueOf(switchboard.hashCode()));
  if (adHocChatRoom == null) {
    String name=String.valueOf(switchboard.hashCode());
    adHocChatRoom=new AdHocChatRoomMsnImpl(name,provider,switchboard);
    this.adHocChatRoomCache.put(switchboard,adHocChatRoom);
    Object attachment=switchboard.getAttachment();
    if (attachment != null && pendingAdHocChatRoomList.containsKey(attachment)) {
      pendingAdHocChatRoomList.remove(attachment);
    }
  }
  adHocChatRoom.join();
  return adHocChatRoom;
}

Fixed version (ground truth):
/** 
 * Creates an <tt>AdHocChatRoomMsnImpl</tt> corresponding to the given <tt>switchboard</tt>.
 * @param switchboard  the Msn switchboard that will correspond to thecreated chat room
 * @return  an <tt>AdHocChatRoomMsnImpl</tt> corresponding to the given<tt>switchboard</tt>
 */
private AdHocChatRoomMsnImpl createLocalAdHocChatRoomInstance(MsnSwitchboard switchboard){
  AdHocChatRoomMsnImpl adHocChatRoom=(AdHocChatRoomMsnImpl)this.adHocChatRoomCache.get(switchboard);
  if (adHocChatRoom == null) {
    String name=String.valueOf(switchboard.hashCode());
    adHocChatRoom=new AdHocChatRoomMsnImpl(name,provider,switchboard);
    this.adHocChatRoomCache.put(switchboard,adHocChatRoom);
    Object attachment=switchboard.getAttachment();
    if (attachment != null && pendingAdHocChatRoomList.containsKey(attachment)) {
      pendingAdHocChatRoomList.remove(attachment);
    }
  }
  adHocChatRoom.join();
  return adHocChatRoom;
}
Program: 103935
Project: 103935
Buggy source:
/** 
 * Returns the buffered image corresponding to the given url image path.
 * @param imagePath the path indicating, where we can find the image.
 * @return the buffered image corresponding to the given url image path.
 */
public static BufferedImage getBufferedImage(URL imagePath){
  BufferedImage image=null;
  if (imagePath == null) {
    return null;
  }
  try {
    image=ImageIO.read(imagePath);
  }
 catch (  Exception exc) {
    logger.debug("String_Node_Str" + imagePath,exc);
  }
  return image;
}

Fixed version (ground truth):
/** 
 * Returns the buffered image corresponding to the given url image path.
 * @param imagePath the path indicating, where we can find the image.
 * @return the buffered image corresponding to the given url image path.
 */
public static BufferedImage getBufferedImage(URL imagePath){
  BufferedImage image=null;
  if (imagePath != null) {
    try {
      image=ImageIO.read(imagePath);
    }
 catch (    IOException ex) {
      logger.debug("String_Node_Str" + imagePath,ex);
    }
  }
  return image;
}
Program: 103936
Project: 103936
Buggy source:
/** 
 * Returns a scaled image fitting within the given bounds while keeping the aspect ratio.
 * @param image the image to scale
 * @param width maximum width of the scaled image
 * @param height maximum height of the scaled image
 * @return the scaled image
 */
public static Image scaleImageWithinBounds(Image image,int width,int height){
  int initialWidth=image.getWidth(null);
  int initialHeight=image.getHeight(null);
  Image scaledImage;
  int scaleHint=Image.SCALE_SMOOTH;
  double originalRatio=(double)initialWidth / initialHeight;
  double areaRatio=(double)width / height;
  if (originalRatio > areaRatio) {
    scaledImage=image.getScaledInstance(width,-1,scaleHint);
  }
 else {
    scaledImage=image.getScaledInstance(-1,height,scaleHint);
  }
  return scaledImage;
}

Fixed version (ground truth):
/** 
 * Returns a scaled image fitting within the given bounds while keeping the aspect ratio.
 * @param image the image to scale
 * @param width maximum width of the scaled image
 * @param height maximum height of the scaled image
 * @return the scaled image
 */
public static Image scaleImageWithinBounds(Image image,int width,int height){
  int initialWidth=image.getWidth(null);
  int initialHeight=image.getHeight(null);
  Image scaledImage;
  int scaleHint=Image.SCALE_SMOOTH;
  double originalRatio=(double)initialWidth / initialHeight;
  double areaRatio=(double)width / height;
  if (originalRatio > areaRatio)   scaledImage=image.getScaledInstance(width,-1,scaleHint);
 else   scaledImage=image.getScaledInstance(-1,height,scaleHint);
  return scaledImage;
}
Program: 103937
Project: 103937
Buggy source:
/** 
 * Sets the image to display in the frame.
 * @param imageIcon the image to display in the frame
 */
public void setImageIcon(ImageIcon imageIcon){
  this.image=ImageUtils.getScaledRoundedImage(imageIcon.getImage(),width - 2,height - 2);
}

Fixed version (ground truth):
/** 
 * Sets the image to display in the frame.
 * @param imageIcon the image to display in the frame
 */
public void setImageIcon(ImageIcon imageIcon){
  image=ImageUtils.getScaledRoundedImage(imageIcon.getImage(),width - 2,height - 2);
}
Program: 103938
Project: 103938
Buggy source:
/** 
 * Paints the contained image in a frame. Overrides   {@link JComponent#paintComponent(Graphics)}.
 */
public void paintComponent(Graphics g){
  if (image == null)   return;
  g.drawImage(image,width / 2 - image.getWidth(null) / 2,height / 2 - image.getHeight(null) / 2,null);
  g.drawImage(frameImage,width / 2 - frameImage.getWidth(null) / 2,height / 2 - frameImage.getHeight(null) / 2,null);
}

Fixed version (ground truth):
/** 
 * Paints the contained image in a frame. Overrides   {@link JComponent#paintComponent(Graphics)}.
 */
public void paintComponent(Graphics g){
  if (image != null) {
    int imageWidth=image.getWidth(this);
    int imageHeight=image.getHeight(this);
    if ((imageWidth != -1) && (imageHeight != -1))     g.drawImage(image,width / 2 - imageWidth / 2,height / 2 - imageHeight / 2,null);
  }
  int frameWidth=frameImage.getWidth(this);
  int frameHeight=frameImage.getHeight(this);
  if ((frameWidth != -1) && (frameHeight != -1))   g.drawImage(frameImage,width / 2 - frameWidth / 2,height / 2 - frameHeight / 2,null);
}