nus-yam/ex-repair huggingface dataset:
Program: 103068
Project: 103068
Buggy source:
/** 
 * Initializes a new <tt>ChatRoomConferenceCallsListPanel</tt> instance  which is to depict the conferences of a chat specified by its  <tt>ChatPanel</tt>.
 * @param chatPanel the <tt>ChatPanel</tt> which specifies the chat.
 */
public ChatRoomConferenceCallsListPanel(final ChatPanel chatPanel){
  super(new BorderLayout());
  this.chatPanel=chatPanel;
  this.conferenceCallsListModel=new ChatConferenceCallsListModels(chatPanel.getChatSession());
  this.conferenceCallList=new JList<ConferenceDescription>(conferenceCallsListModel);
  this.conferenceCallList.addKeyListener(new CListKeySearchListener(conferenceCallList));
  this.conferenceCallList.setCellRenderer(new ChatConferenceCallsListRenderer());
  JScrollPane conferenceCallsScrollPane=new SIPCommScrollPane();
  conferenceCallsScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  conferenceCallsScrollPane.setOpaque(false);
  conferenceCallsScrollPane.setBorder(null);
  JViewport viewport=conferenceCallsScrollPane.getViewport();
  viewport.setOpaque(false);
  viewport.add(conferenceCallList);
  this.add(conferenceCallsScrollPane);
}

Fixed version (ground truth):
/** 
 * Initializes a new <tt>ChatRoomConferenceCallsListPanel</tt> instance  which is to depict the conferences of a chat specified by its  <tt>ChatPanel</tt>.
 * @param chatPanel the <tt>ChatPanel</tt> which specifies the chat.
 */
public ChatRoomConferenceCallsListPanel(final ChatPanel chatPanel){
  super(new BorderLayout());
  this.chatPanel=chatPanel;
  this.conferenceCallsListModel=new ChatConferenceCallsListModels(chatPanel.getChatSession());
  this.conferenceCallList=new JList(conferenceCallsListModel);
  this.conferenceCallList.addKeyListener(new CListKeySearchListener(conferenceCallList));
  this.conferenceCallList.setCellRenderer(new ChatConferenceCallsListRenderer());
  JScrollPane conferenceCallsScrollPane=new SIPCommScrollPane();
  conferenceCallsScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  conferenceCallsScrollPane.setOpaque(false);
  conferenceCallsScrollPane.setBorder(null);
  JViewport viewport=conferenceCallsScrollPane.getViewport();
  viewport.setOpaque(false);
  viewport.add(conferenceCallList);
  this.add(conferenceCallsScrollPane);
}
Program: 103069
Project: 103069
Buggy source:
/** 
 * Handles the <tt>ActionEvent</tt> when one of the menu items is selected.
 * @param e the <tt>ActionEvent</tt> that notified us
 */
@Override public void actionPerformed(ActionEvent e){
  super.actionPerformed(e);
  JMenuItem menuItem=(JMenuItem)e.getSource();
  String itemText=menuItem.getName();
  if (itemText.equalsIgnoreCase("String_Node_Str")) {
    ChatRoomTableDialog.showChatRoomTableDialog();
  }
 else   if (itemText.equals("String_Node_Str")) {
    HistoryWindow history;
    HistoryWindowManager historyWindowManager=GuiActivator.getUIService().getHistoryWindowManager();
    ChatPanel chatPanel=this.chatWindow.getCurrentChat();
    ChatSession chatSession=chatPanel.getChatSession();
    if (historyWindowManager.containsHistoryWindowForContact(chatSession.getDescriptor())) {
      history=historyWindowManager.getHistoryWindowForContact(chatSession.getDescriptor());
      if (history.getState() == JFrame.ICONIFIED)       history.setState(JFrame.NORMAL);
      history.toFront();
    }
 else {
      history=new HistoryWindow(chatPanel.getChatSession().getDescriptor());
      history.setVisible(true);
      historyWindowManager.addHistoryWindowForContact(chatSession.getDescriptor(),history);
    }
  }
 else   if (itemText.equalsIgnoreCase("String_Node_Str")) {
    this.chatWindow.setVisible(false);
    this.chatWindow.dispose();
  }
}

Fixed version (ground truth):
/** 
 * Handles the <tt>ActionEvent</tt> when one of the menu items is selected.
 * @param e the <tt>ActionEvent</tt> that notified us
 */
@Override public void actionPerformed(ActionEvent e){
  JMenuItem menuItem=(JMenuItem)e.getSource();
  String itemText=menuItem.getName();
  if (itemText.equalsIgnoreCase("String_Node_Str")) {
    this.chatWindow.setVisible(false);
    this.chatWindow.dispose();
    return;
  }
  super.actionPerformed(e);
  if (itemText.equalsIgnoreCase("String_Node_Str")) {
    ChatRoomTableDialog.showChatRoomTableDialog();
  }
 else   if (itemText.equals("String_Node_Str")) {
    HistoryWindow history;
    HistoryWindowManager historyWindowManager=GuiActivator.getUIService().getHistoryWindowManager();
    ChatPanel chatPanel=this.chatWindow.getCurrentChat();
    ChatSession chatSession=chatPanel.getChatSession();
    if (historyWindowManager.containsHistoryWindowForContact(chatSession.getDescriptor())) {
      history=historyWindowManager.getHistoryWindowForContact(chatSession.getDescriptor());
      if (history.getState() == JFrame.ICONIFIED)       history.setState(JFrame.NORMAL);
      history.toFront();
    }
 else {
      history=new HistoryWindow(chatPanel.getChatSession().getDescriptor());
      history.setVisible(true);
      historyWindowManager.addHistoryWindowForContact(chatSession.getDescriptor(),history);
    }
  }
}
Program: 103071
Project: 103071
Buggy source:
/** 
 * Checks whether metaContact has mobile indicator. Needs all of the contacts to have it to indicate it.
 * @param metaContact the metacontact to check for mobile indicator
 * @return whether to indicate contact as mobile one.
 */
private boolean isMobile(MetaContact metaContact){
  Iterator<Contact> iter=metaContact.getContacts();
  while (iter.hasNext()) {
    Contact contact=iter.next();
    if (contact.getPresenceStatus().isOnline() && !contact.isMobile())     return false;
  }
  return metaContact.getContactCount() > 0 ? true : false;
}

Fixed version (ground truth):
/** 
 * Checks whether metaContact has mobile indicator. Needs all of the contacts to have it to indicate it.
 * @param metaContact the metacontact to check for mobile indicator
 * @return whether to indicate contact as mobile one.
 */
private boolean isMobile(MetaContact metaContact){
  boolean hasConnectedStatus=false;
  Iterator<Contact> iter=metaContact.getContacts();
  while (iter.hasNext()) {
    Contact contact=iter.next();
    boolean isConnected=contact.getPresenceStatus().isOnline();
    if (isConnected)     hasConnectedStatus=true;
    if (isConnected && !contact.isMobile())     return false;
  }
  if (!hasConnectedStatus)   return false;
 else   return metaContact.getContactCount() > 0 ? true : false;
}
Program: 103072
Project: 103072
Buggy source:
/** 
 * Update mobile indicator for contact, searching in contact caps.
 * @param user the contact address with or without resource.
 */
private void updateMobileIndicatorUsingCaps(String user){
  ContactJabberImpl contact=ssclCallback.findContactById(StringUtils.parseBareAddress(user));
  if (contact == null)   return;
  int currentMostConnectedStatus=0;
  List<ContactResource> mostAvailableResources=new ArrayList<ContactResource>();
  for (  ContactResource res : contact.getResources()) {
    if (!res.getPresenceStatus().isOnline())     continue;
    int status=res.getPresenceStatus().getStatus();
    if (status > currentMostConnectedStatus) {
      if (currentMostConnectedStatus != status)       mostAvailableResources.clear();
      currentMostConnectedStatus=status;
      mostAvailableResources.add(res);
    }
  }
  boolean allMobile=false;
  for (  ContactResource res : mostAvailableResources) {
    if (res.isMobile())     allMobile=true;
 else {
      allMobile=false;
      break;
    }
  }
  if (mostAvailableResources.size() > 0)   contact.setMobile(allMobile);
 else   contact.setMobile(false);
}

Fixed version (ground truth):
/** 
 * Update mobile indicator for contact, searching in contact caps.
 * @param user the contact address with or without resource.
 */
private void updateMobileIndicatorUsingCaps(String user){
  ContactJabberImpl contact=ssclCallback.findContactById(StringUtils.parseBareAddress(user));
  if (contact == null)   return;
  int currentMostConnectedStatus=0;
  List<ContactResource> mostAvailableResources=new ArrayList<ContactResource>();
  for (  Map.Entry<String,ContactResourceJabberImpl> resEntry : contact.getResourcesMap().entrySet()) {
    ContactResourceJabberImpl res=resEntry.getValue();
    if (!res.getPresenceStatus().isOnline())     continue;
    boolean oldIndicator=res.isMobile();
    res.setMobile(isMobileResource(res.getResourceName(),res.getFullJid()));
    if (oldIndicator != res.isMobile()) {
      contact.fireContactResourceEvent(new ContactResourceEvent(contact,res,ContactResourceEvent.RESOURCE_MODIFIED));
    }
    int status=res.getPresenceStatus().getStatus();
    if (status > currentMostConnectedStatus) {
      if (currentMostConnectedStatus != status)       mostAvailableResources.clear();
      currentMostConnectedStatus=status;
      mostAvailableResources.add(res);
    }
  }
  boolean allMobile=false;
  for (  ContactResource res : mostAvailableResources) {
    if (res.isMobile())     allMobile=true;
 else {
      allMobile=false;
      break;
    }
  }
  if (mostAvailableResources.size() > 0)   contact.setMobile(allMobile);
 else   contact.setMobile(false);
}
Program: 103077
Project: 103077
Buggy source:
public void fireContactPresenceStatusChangeEvent(Contact source,ContactGroup parentGroup,PresenceStatus oldValue,PresenceStatus newValue){
  ContactPresenceStatusChangeEvent evt=new ContactPresenceStatusChangeEvent(source,parentProvider,parentGroup,oldValue,newValue);
  Collection<ContactPresenceStatusListener> listeners;
synchronized (contactPresenceStatusListeners) {
    listeners=new ArrayList<ContactPresenceStatusListener>(contactPresenceStatusListeners);
  }
  if (logger.isDebugEnabled())   logger.debug("String_Node_Str" + listeners.size() + "String_Node_Str"+ evt);
  for (  ContactPresenceStatusListener listener : listeners)   listener.contactPresenceStatusChanged(evt);
}

Fixed version (ground truth):
public void fireContactPresenceStatusChangeEvent(Contact source,ContactGroup parentGroup,PresenceStatus oldValue,PresenceStatus newValue,boolean isResourceChange){
  ContactPresenceStatusChangeEvent evt=new ContactPresenceStatusChangeEvent(source,parentProvider,parentGroup,oldValue,newValue,isResourceChange);
  Collection<ContactPresenceStatusListener> listeners;
synchronized (contactPresenceStatusListeners) {
    listeners=new ArrayList<ContactPresenceStatusListener>(contactPresenceStatusListeners);
  }
  if (logger.isDebugEnabled())   logger.debug("String_Node_Str" + listeners.size() + "String_Node_Str"+ evt);
  for (  ContactPresenceStatusListener listener : listeners)   listener.contactPresenceStatusChanged(evt);
}
Program: 103078
Project: 103078
Buggy source:
/** 
 * Creates an event instance indicating that the specified source contact has changed status from <tt>oldValue</tt> to <tt>newValue</tt>.
 * @param source the provider that generated the event
 * @param sourceProvider the protocol provider that the contact belongs to.
 * @param parentGroup the group containing the contact that caused thisevent (to be set as null in cases where groups are not supported);
 * @param oldValue the status the source countact was in before eneteringthe new state.
 * @param newValue the status the source contact is currently in.
 */
public ContactPresenceStatusChangeEvent(Contact source,ProtocolProviderService sourceProvider,ContactGroup parentGroup,PresenceStatus oldValue,PresenceStatus newValue){
  super(source,ContactPresenceStatusChangeEvent.class.getName(),oldValue,newValue);
  this.sourceProvider=sourceProvider;
  this.parentGroup=parentGroup;
}

Fixed version (ground truth):
/** 
 * Creates an event instance indicating that the specified source contact has changed status from <tt>oldValue</tt> to <tt>newValue</tt>.
 * @param source the provider that generated the event
 * @param sourceProvider the protocol provider that the contact belongs to.
 * @param parentGroup the group containing the contact that caused thisevent (to be set as null in cases where groups are not supported);
 * @param oldValue the status the source countact was in before eneteringthe new state.
 * @param newValue the status the source contact is currently in.
 */
public ContactPresenceStatusChangeEvent(Contact source,ProtocolProviderService sourceProvider,ContactGroup parentGroup,PresenceStatus oldValue,PresenceStatus newValue,boolean resourceChanged){
  super(source,ContactPresenceStatusChangeEvent.class.getName(),oldValue,newValue);
  this.sourceProvider=sourceProvider;
  this.parentGroup=parentGroup;
  this.resourceChanged=resourceChanged;
}
Program: 103079
Project: 103079
Buggy source:
/** 
 * Connects to the chosen server and creates a new account with Smack.
 * @param server the server domain
 * @param port TCP port to connect
 * @param username the account username
 * @param password the account password
 */
private boolean createJabberAccount(String server,int port,String username,String password){
  try {
    ConnectionConfiguration config=new ConnectionConfiguration(server,port);
    xmppConnection=new XMPPConnection(config);
    xmppConnection.connect();
    accountManager=new AccountManager(xmppConnection);
    accountManager.createAccount(username,password);
    return true;
  }
 catch (  XMPPException exc) {
    logger.error(exc);
    if (exc.getXMPPError().getCode() == 409) {
      showErrorMessage(Resources.getString("String_Node_Str"));
      logger.error("String_Node_Str" + "String_Node_Str");
    }
 else {
      showErrorMessage(Resources.getResources().getI18NString("String_Node_Str",new String[]{exc.getMessage()}));
    }
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Connects to the chosen server and creates a new account with Smack.
 * @param server the server domain
 * @param port TCP port to connect
 * @param username the account username
 * @param password the account password
 */
private boolean createJabberAccount(String server,int port,String username,String password){
  try {
    ConnectionConfiguration config=new ConnectionConfiguration(server,port);
    xmppConnection=new XMPPConnection(config);
    xmppConnection.connect();
    accountManager=new AccountManager(xmppConnection);
    accountManager.createAccount(username,password);
    return true;
  }
 catch (  XMPPException exc) {
    logger.error(exc);
    if (exc.getXMPPError() != null && exc.getXMPPError().getCode() == 409) {
      showErrorMessage(Resources.getString("String_Node_Str"));
      logger.error("String_Node_Str" + "String_Node_Str");
    }
 else {
      showErrorMessage(Resources.getResources().getI18NString("String_Node_Str",new String[]{exc.getMessage()}));
    }
    return false;
  }
}
Program: 103084
Project: 103084
Buggy source:
/** 
 * Creates an account.
 * @return the created account
 */
public NewAccount createAccount(){
  String userID=userIDField.getText();
  char[] password=passField.getPassword();
  char[] password2=pass2Field.getPassword();
  String server=serverField.getText();
  String port=portField.getText();
  if (new String(password).equals(new String(password2))) {
    boolean result=createJabberAccount(server,5222,userID,new String(password));
    if (result == true) {
      return new NewAccount(getCompleteUserID(userID,server),password,server,port);
    }
  }
 else {
    showErrorMessage(Resources.getString("String_Node_Str"));
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Creates an account.
 * @return the created account
 */
public NewAccount createAccount(){
  String userID=userIDField.getText();
  char[] password=passField.getPassword();
  char[] password2=pass2Field.getPassword();
  String server=serverField.getText();
  int port=5222;
  try {
    port=Integer.parseInt(portField.getText());
  }
 catch (  NumberFormatException e) {
  }
  if (new String(password).equals(new String(password2))) {
    boolean result=createJabberAccount(server,port,userID,new String(password));
    if (result == true) {
      return new NewAccount(getCompleteUserID(userID,server),password,server,String.valueOf(port));
    }
  }
 else {
    showErrorMessage(Resources.getString("String_Node_Str"));
  }
  return null;
}
Program: 103088
Project: 103088
Buggy source:
/** 
 * Loading the values stored onto configuration form
 */
private void loadValues(){
  ConfigurationService configService=GlobalProxyPluginActivator.getConfigurationService();
  String serverAddress=configService.getString(ProxyInfo.CONNECTON_PROXY_ADDRESS_PROPERTY_NAME);
  if (serverAddress != null)   serverAddressField.setText(serverAddress);
  String port=configService.getString(ProxyInfo.CONNECTON_PROXY_PORT_PROPERTY_NAME);
  if (port != null)   portField.setText(port);
  String username=configService.getString(ProxyInfo.CONNECTON_PROXY_USERNAME_PROPERTY_NAME);
  if (username != null)   usernameField.setText(username);
  String password=configService.getString(ProxyInfo.CONNECTON_PROXY_PASSWORD_PROPERTY_NAME);
  if (password != null)   passwordField.setText(password);
  try {
    String type=configService.getString(ProxyInfo.CONNECTON_PROXY_TYPE_PROPERTY_NAME);
    if (type != null)     typeCombo.setSelectedItem(ProxyInfo.ProxyType.valueOf(type));
  }
 catch (  IllegalArgumentException e) {
  }
  if (typeCombo.getSelectedItem().equals(ProxyInfo.ProxyType.NONE)) {
    serverAddressField.setEnabled(false);
    portField.setEnabled(false);
    usernameField.setEnabled(false);
    passwordField.setEnabled(false);
  }
}

Fixed version (ground truth):
/** 
 * Loading the values stored onto configuration form
 */
private void loadValues(){
  ConfigurationService configService=GlobalProxyPluginActivator.getConfigurationService();
  String serverAddress=configService.getString(ProxyInfo.CONNECTION_PROXY_ADDRESS_PROPERTY_NAME);
  if (serverAddress != null)   serverAddressField.setText(serverAddress);
  String port=configService.getString(ProxyInfo.CONNECTION_PROXY_PORT_PROPERTY_NAME);
  if (port != null)   portField.setText(port);
  String username=configService.getString(ProxyInfo.CONNECTION_PROXY_USERNAME_PROPERTY_NAME);
  if (username != null)   usernameField.setText(username);
  String password=configService.getString(ProxyInfo.CONNECTION_PROXY_PASSWORD_PROPERTY_NAME);
  if (password != null)   passwordField.setText(password);
  try {
    String type=configService.getString(ProxyInfo.CONNECTION_PROXY_TYPE_PROPERTY_NAME);
    if (type != null)     typeCombo.setSelectedItem(ProxyInfo.ProxyType.valueOf(type));
  }
 catch (  IllegalArgumentException e) {
  }
  if (typeCombo.getSelectedItem().equals(ProxyInfo.ProxyType.NONE)) {
    serverAddressField.setEnabled(false);
    portField.setEnabled(false);
    usernameField.setEnabled(false);
    passwordField.setEnabled(false);
  }
}
Program: 103090
Project: 103090
Buggy source:
/** 
 * Creates a new   {@link Lookup} instance using our own {@link ParallelResolverImpl} if it is enabled and DNSSEC is not active.
 * @param domain the domain we will be resolving
 * @param type the type of the record we will be trying to obtain.
 * @return the newly created {@link Lookup} instance.
 * @throws TextParseException if <tt>domain</tt> is not a valid domain name.
 */
private static Lookup createLookup(String domain,int type) throws TextParseException {
  if (UtilActivator.getConfigurationService().getBoolean(PNAME_DNS_ALWAYS_ABSOLUTE,PDEFAULT_DNS_ALWAYS_ABSOLUTE)) {
    if (!Name.fromString(domain).isAbsolute())     domain=domain + "String_Node_Str";
  }
  Lookup lookup=new Lookup(domain,type);
  if (logger.isTraceEnabled()) {
    StringBuilder sb=new StringBuilder();
    sb.append("String_Node_Str");
    for (    String s : ResolverConfig.getCurrentConfig().servers()) {
      sb.append(s);
      sb.append("String_Node_Str");
    }
    logger.trace(sb.toString());
  }
  return lookup;
}

Fixed version (ground truth):
/** 
 * Creates a new   {@link Lookup} instance.
 * @param domain the domain we will be resolving
 * @param type the type of the record we will be trying to obtain.
 * @return the newly created {@link Lookup} instance.
 * @throws TextParseException if <tt>domain</tt> is not a valid domain name.
 */
private static Lookup createLookup(String domain,int type) throws TextParseException {
  if (UtilActivator.getConfigurationService().getBoolean(PNAME_DNS_ALWAYS_ABSOLUTE,PDEFAULT_DNS_ALWAYS_ABSOLUTE)) {
    if (!Name.fromString(domain).isAbsolute())     domain=domain + "String_Node_Str";
  }
  Lookup lookup=new Lookup(domain,type);
  if (logger.isTraceEnabled()) {
    StringBuilder sb=new StringBuilder();
    sb.append("String_Node_Str");
    for (    String s : ResolverConfig.getCurrentConfig().servers()) {
      sb.append(s);
      sb.append("String_Node_Str");
    }
    logger.trace(sb.toString());
  }
  return lookup;
}
Program: 103091
Project: 103091
Buggy source:
/** 
 * Creates this operation set, loads stored values, populating local variable settings.
 * @param protocolProvider the parent Protocol Provider.
 */
public OperationSetAutoAnswerJabberImpl(ProtocolProviderServiceJabberImpl protocolProvider){
  super(protocolProvider);
}

Fixed version (ground truth):
/** 
 * Creates this operation set, loads stored values, populating local variable settings.
 * @param protocolProvider the parent Protocol Provider.
 */
public OperationSetAutoAnswerJabberImpl(ProtocolProviderServiceJabberImpl protocolProvider){
  super(protocolProvider);
  this.load();
}
Program: 103092
Project: 103092
Buggy source:
/** 
 * Makes a check after creating call locally, should we answer it.
 * @param call The new incoming call to auto-answer if needed.
 * @param isVideoCall Indicates if the remote peer which has created thiscall wish to have a video call.
 * @return <tt>true</tt> if we have processed and no further processing isneeded, <tt>false</tt> otherwise.
 */
public boolean autoAnswer(Call call){
  if (answerUnconditional || satisfyAutoAnswerConditions(call)) {
    boolean isVideoCall=doesRequestContainsActiveVideoMediaType(call);
    this.answerCall(call,isVideoCall);
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Makes a check after creating call locally, should we answer it.
 * @param call The new incoming call to auto-answer if needed.
 * @return <tt>true</tt> if we have processed and no further processing isneeded, <tt>false</tt> otherwise.
 */
public boolean autoAnswer(Call call){
  if (answerUnconditional || satisfyAutoAnswerConditions(call)) {
    boolean isVideoCall=doesRequestContainsActiveVideoMediaType(call);
    this.answerCall(call,isVideoCall);
    return true;
  }
  return false;
}
Program: 103093
Project: 103093
Buggy source:
/** 
 * Creates this operation set, loads stored values, populating local variable settings.
 * @param protocolProvider the parent Protocol Provider.
 */
public OperationSetAutoAnswerSipImpl(ProtocolProviderServiceSipImpl protocolProvider){
  super(protocolProvider);
}

Fixed version (ground truth):
/** 
 * Creates this operation set, loads stored values, populating local variable settings.
 * @param protocolProvider the parent Protocol Provider.
 */
public OperationSetAutoAnswerSipImpl(ProtocolProviderServiceSipImpl protocolProvider){
  super(protocolProvider);
  this.load();
}
Program: 103094
Project: 103094
Buggy source:
/** 
 * Creates this operation set, loads stored values, populating local variable settings.
 * @param protocolProvider the parent Protocol Provider.
 */
public AbstractOperationSetBasicAutoAnswer(ProtocolProviderService protocolProvider){
  this.protocolProvider=protocolProvider;
  load();
}

Fixed version (ground truth):
/** 
 * Creates this operation set, loads stored values, populating local variable settings.
 * @param protocolProvider the parent Protocol Provider.
 */
public AbstractOperationSetBasicAutoAnswer(ProtocolProviderService protocolProvider){
  this.protocolProvider=protocolProvider;
}
Program: 103096
Project: 103096
Buggy source:
/** 
 * Processes the content-modify   {@link JingleIQ}.
 * @param content The {@link JingleIQ} that contains content that remotepeer wants to be modified
 */
public void processContentModify(JingleIQ content){
  ContentPacketExtension ext=content.getContentList().get(0);
  MediaType mediaType=getMediaType(ext);
  try {
    boolean modify=(ext.getFirstChildOfType(RtpDescriptionPacketExtension.class) != null);
    getMediaHandler().reinitContent(ext.getName(),ext,modify);
    setSenders(mediaType,ext.getSenders());
    if (MediaType.VIDEO.equals(mediaType))     ;
    getCall().modifyVideoContent();
  }
 catch (  Exception e) {
    logger.info("String_Node_Str",e);
    String reason="String_Node_Str" + e.getMessage();
    JingleIQ errResp=JinglePacketFactory.createSessionTerminate(getProtocolProvider().getOurJID(),peerJID,sessionInitIQ.getSID(),Reason.INCOMPATIBLE_PARAMETERS,reason);
    setState(CallPeerState.FAILED,reason);
    getProtocolProvider().getConnection().sendPacket(errResp);
    return;
  }
}

Fixed version (ground truth):
/** 
 * Processes the content-modify   {@link JingleIQ}.
 * @param content The {@link JingleIQ} that contains content that remotepeer wants to be modified
 */
public void processContentModify(JingleIQ content){
  ContentPacketExtension ext=content.getContentList().get(0);
  MediaType mediaType=getMediaType(ext);
  try {
    boolean modify=(ext.getFirstChildOfType(RtpDescriptionPacketExtension.class) != null);
    getMediaHandler().reinitContent(ext.getName(),ext,modify);
    setSenders(mediaType,ext.getSenders());
    if (MediaType.VIDEO.equals(mediaType))     getCall().modifyVideoContent();
  }
 catch (  Exception e) {
    logger.info("String_Node_Str",e);
    String reason="String_Node_Str" + e.getMessage();
    JingleIQ errResp=JinglePacketFactory.createSessionTerminate(getProtocolProvider().getOurJID(),peerJID,sessionInitIQ.getSID(),Reason.INCOMPATIBLE_PARAMETERS,reason);
    setState(CallPeerState.FAILED,reason);
    getProtocolProvider().getConnection().sendPacket(errResp);
    return;
  }
}
Program: 103097
Project: 103097
Buggy source:
public void incomingCallReceived(CallEvent event){
}

Fixed version (ground truth):
public void incomingCallReceived(CallEvent ev){
}
Program: 103098
Project: 103098
Buggy source:
/** 
 * Implements CallListener.callEnded. Disposes the frame related to the ended call.
 * @param event the <tt>CallEvent</tt> that notified us
 */
public void callEnded(CallEvent event){
  Call call=event.getSourceCall();
  JFrame desktopFrame=callDesktopFrames.get(call);
  if (desktopFrame != null) {
    desktopFrame.dispose();
    callDesktopFrames.remove(call);
  }
}

Fixed version (ground truth):
/** 
 * Implements   {@link CallListener#callEnded(CallEvent)}. Disposes of the frame related to the ended call.
 * @param ev a <tt>CallEvent</tt> which identifies theended call 
 */
public void callEnded(CallEvent ev){
  Call call=ev.getSourceCall();
  JFrame desktopFrame=callDesktopFrames.get(call);
  if (desktopFrame != null) {
    desktopFrame.dispose();
    callDesktopFrames.remove(call);
  }
}
Program: 103099
Project: 103099
Buggy source:
/** 
 * Adds the desktop sharing listener.
 * @param call the call, for which we're registering a listener
 * @param frame the frame to be closed on call ended
 */
private static void addDesktopSharingListener(final Call call,JFrame frame){
  OperationSetVideoTelephony videoOpSet=call.getProtocolProvider().getOperationSet(OperationSetVideoTelephony.class);
  videoOpSet.addPropertyChangeListener(call,new PropertyChangeListener(){
    public void propertyChange(    PropertyChangeEvent evt){
      if (OperationSetVideoTelephony.LOCAL_VIDEO_STREAMING.equals(evt.getPropertyName()) && evt.getNewValue().equals(MediaDirection.RECVONLY)) {
        JFrame desktopFrame=callDesktopFrames.get(call);
        if (desktopFrame != null) {
          desktopFrame.dispose();
          callDesktopFrames.remove(call);
        }
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Adds the desktop sharing listener.
 * @param call the call, for which we're registering a listener
 * @param frame the frame to be closed on call ended
 */
private static void addDesktopSharingListener(final Call call,JFrame frame){
  OperationSetVideoTelephony videoTelephony=call.getProtocolProvider().getOperationSet(OperationSetVideoTelephony.class);
  videoTelephony.addPropertyChangeListener(call,new PropertyChangeListener(){
    public void propertyChange(    PropertyChangeEvent ev){
      if (OperationSetVideoTelephony.LOCAL_VIDEO_STREAMING.equals(ev.getPropertyName()) && MediaDirection.RECVONLY.equals(ev.getNewValue())) {
        JFrame desktopFrame=callDesktopFrames.get(call);
        if (desktopFrame != null) {
          desktopFrame.dispose();
          callDesktopFrames.remove(call);
        }
      }
    }
  }
);
}
Program: 103100
Project: 103100
Buggy source:
/** 
 * Get the frame for a <tt>Call</tt>.
 * @param call the <tt>Call</tt>
 * @return JFrame for the call or null if not found
 */
public static JFrame getFrameForCall(Call call){
  if (callDesktopFrames.containsKey(call)) {
    return callDesktopFrames.get(call);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Get the frame for a <tt>Call</tt>.
 * @param call the <tt>Call</tt>
 * @return JFrame for the call or null if not found
 */
public static JFrame getFrameForCall(Call call){
  return callDesktopFrames.get(call);
}
Program: 103101
Project: 103101
Buggy source:
public void outgoingCallCreated(CallEvent event){
}

Fixed version (ground truth):
public void outgoingCallCreated(CallEvent ev){
}
Program: 103102
Project: 103102
Buggy source:
public void propertyChange(PropertyChangeEvent evt){
  if (OperationSetVideoTelephony.LOCAL_VIDEO_STREAMING.equals(evt.getPropertyName()) && evt.getNewValue().equals(MediaDirection.RECVONLY)) {
    JFrame desktopFrame=callDesktopFrames.get(call);
    if (desktopFrame != null) {
      desktopFrame.dispose();
      callDesktopFrames.remove(call);
    }
  }
}

Fixed version (ground truth):
public void propertyChange(PropertyChangeEvent ev){
  if (OperationSetVideoTelephony.LOCAL_VIDEO_STREAMING.equals(ev.getPropertyName()) && MediaDirection.RECVONLY.equals(ev.getNewValue())) {
    JFrame desktopFrame=callDesktopFrames.get(call);
    if (desktopFrame != null) {
      desktopFrame.dispose();
      callDesktopFrames.remove(call);
    }
  }
}
Program: 103103
Project: 103103
Buggy source:
/** 
 * Adds a call listener, which listens for call ended events and would close any related desktop sharing frames when a call is ended.
 * @param call the call, for which we're registering a listener
 * @param frame the frame to be closed on call ended
 */
private static void addCallListener(Call call,JFrame frame){
  OperationSetBasicTelephony<?> telOpSet=call.getProtocolProvider().getOperationSet(OperationSetBasicTelephony.class);
  if (telOpSet != null) {
    telOpSet.addCallListener(new CallListener(){
      /** 
 * Implements CallListener.callEnded. Disposes the frame related to the ended call.
 * @param event the <tt>CallEvent</tt> that notified us
 */
      public void callEnded(      CallEvent event){
        Call call=event.getSourceCall();
        JFrame desktopFrame=callDesktopFrames.get(call);
        if (desktopFrame != null) {
          desktopFrame.dispose();
          callDesktopFrames.remove(call);
        }
      }
      public void incomingCallReceived(      CallEvent event){
      }
      public void outgoingCallCreated(      CallEvent event){
      }
    }
);
  }
}

Fixed version (ground truth):
/** 
 * Adds a call listener, which listens for call ended events and would close any related desktop sharing frames when a call is ended.
 * @param call the call, for which we're registering a listener
 * @param frame the frame to be closed on call ended
 */
private static void addCallListener(Call call,JFrame frame){
  OperationSetBasicTelephony<?> basicTelephony=call.getProtocolProvider().getOperationSet(OperationSetBasicTelephony.class);
  if (basicTelephony != null) {
    basicTelephony.addCallListener(new CallListener(){
      /** 
 * Implements   {@link CallListener#callEnded(CallEvent)}. Disposes of the frame related to the ended call.
 * @param ev a <tt>CallEvent</tt> which identifies theended call 
 */
      public void callEnded(      CallEvent ev){
        Call call=ev.getSourceCall();
        JFrame desktopFrame=callDesktopFrames.get(call);
        if (desktopFrame != null) {
          desktopFrame.dispose();
          callDesktopFrames.remove(call);
        }
      }
      public void incomingCallReceived(      CallEvent ev){
      }
      public void outgoingCallCreated(      CallEvent ev){
      }
    }
);
  }
}
Program: 103105
Project: 103105
Buggy source:
/** 
 * Check if the remote part supports Jingle video.
 * @param calleeAddress Contact address
 * @param videoDevice <tt>MediaDevice</tt> used
 * @return true if contact support Jingle video, false otherwise
 * @throws OperationFailedException with the corresponding code if we failto create the video call.
 */
protected Call createOutgoingVideoCall(String calleeAddress,MediaDevice videoDevice) throws OperationFailedException {
  if (parentProvider.getConnection() == null) {
    throw new OperationFailedException("String_Node_Str" + "String_Node_Str",OperationFailedException.INTERNAL_ERROR);
  }
  CallJabberImpl call=new CallJabberImpl(basicTelephony);
  if (videoDevice != null)   call.setVideoDevice(videoDevice);
  call.setLocalVideoAllowed(true,getMediaUseCase());
  basicTelephony.createOutgoingCall(call,calleeAddress);
  origin=getOriginForMediaDevice(videoDevice);
  return call;
}

Fixed version (ground truth):
/** 
 * Check if the remote part supports Jingle video.
 * @param calleeAddress Contact address
 * @param videoDevice <tt>MediaDevice</tt> used
 * @return true if contact support Jingle video, false otherwise
 * @throws OperationFailedException with the corresponding code if we failto create the video call.
 */
protected Call createOutgoingVideoCall(String calleeAddress,MediaDevice videoDevice) throws OperationFailedException {
  if (parentProvider.getConnection() == null) {
    throw new OperationFailedException("String_Node_Str" + "String_Node_Str",OperationFailedException.INTERNAL_ERROR);
  }
  CallJabberImpl call=new CallJabberImpl(basicTelephony);
  MediaUseCase useCase=getMediaUseCase();
  if (videoDevice != null)   call.setVideoDevice(videoDevice,useCase);
  call.setLocalVideoAllowed(true,useCase);
  basicTelephony.createOutgoingCall(call,calleeAddress);
  origin=getOriginForMediaDevice(videoDevice);
  return call;
}
Program: 103106
Project: 103106
Buggy source:
/** 
 * Sets the indicator which determines whether the streaming of local video in a specific <tt>Call</tt> is allowed. The setting does not reflect the availability of actual video capture devices, it just expresses the desire of the user to have the local video streamed in the case the system is actually able to do so.
 * @param call the <tt>Call</tt> to allow/disallow the streaming of localvideo for
 * @param mediaDevice the media device to use for the desktop streaming.If the device is null, the default device is used.
 * @param allowed <tt>true</tt> to allow the streaming of local video forthe specified <tt>Call</tt>; <tt>false</tt> to disallow it
 * @throws OperationFailedException if initializing local video fails.
 */
public void setLocalVideoAllowed(Call call,MediaDevice mediaDevice,boolean allowed) throws OperationFailedException {
  AbstractCallJabberGTalkImpl<?> callImpl=(AbstractCallJabberGTalkImpl<?>)call;
  if (mediaDevice == null) {
    MediaService mediaService=ProtocolMediaActivator.getMediaService();
    mediaDevice=mediaService.getDefaultDevice(MediaType.VIDEO,getMediaUseCase());
  }
  callImpl.setVideoDevice(mediaDevice);
  callImpl.setLocalVideoAllowed(allowed,getMediaUseCase());
  MediaFormat mediaDeviceFormat=mediaDevice.getFormat();
  size=(mediaDeviceFormat == null) ? null : ((VideoMediaFormat)mediaDeviceFormat).getSize();
  callImpl.modifyVideoContent();
  origin=getOriginForMediaDevice(mediaDevice);
}

Fixed version (ground truth):
/** 
 * Sets the indicator which determines whether the streaming of local video in a specific <tt>Call</tt> is allowed. The setting does not reflect the availability of actual video capture devices, it just expresses the desire of the user to have the local video streamed in the case the system is actually able to do so.
 * @param call the <tt>Call</tt> to allow/disallow the streaming of localvideo for
 * @param mediaDevice the media device to use for the desktop streaming.If the device is null, the default device is used.
 * @param allowed <tt>true</tt> to allow the streaming of local video forthe specified <tt>Call</tt>; <tt>false</tt> to disallow it
 * @throws OperationFailedException if initializing local video fails.
 */
public void setLocalVideoAllowed(Call call,MediaDevice mediaDevice,boolean allowed) throws OperationFailedException {
  AbstractCallJabberGTalkImpl<?> callImpl=(AbstractCallJabberGTalkImpl<?>)call;
  MediaUseCase useCase=getMediaUseCase();
  if (mediaDevice == null) {
    MediaService mediaService=ProtocolMediaActivator.getMediaService();
    mediaDevice=mediaService.getDefaultDevice(MediaType.VIDEO,useCase);
  }
  callImpl.setVideoDevice(mediaDevice,useCase);
  callImpl.setLocalVideoAllowed(allowed,useCase);
  MediaFormat mediaDeviceFormat=mediaDevice.getFormat();
  size=(mediaDeviceFormat == null) ? null : ((VideoMediaFormat)mediaDeviceFormat).getSize();
  callImpl.modifyVideoContent();
  origin=getOriginForMediaDevice(mediaDevice);
}
Program: 103107
Project: 103107
Buggy source:
/** 
 * Sets the indicator which determines whether the streaming of local video in a specific <tt>Call</tt> is allowed. The setting does not reflect the availability of actual video capture devices, it just expresses the desire of the user to have the local video streamed in the case the system is actually able to do so.
 * @param call the <tt>Call</tt> to allow/disallow the streaming of localvideo for
 * @param mediaDevice the media device to use for the desktop streaming
 * @param allowed <tt>true</tt> to allow the streaming of local video forthe specified <tt>Call</tt>; <tt>false</tt> to disallow it
 * @throws OperationFailedException if initializing local video fails.
 */
public void setLocalVideoAllowed(Call call,MediaDevice mediaDevice,boolean allowed) throws OperationFailedException {
  CallSipImpl sipCall=(CallSipImpl)call;
  sipCall.setVideoDevice(mediaDevice);
  sipCall.setLocalVideoAllowed(allowed,MediaUseCase.DESKTOP);
  size=(((VideoMediaFormat)sipCall.getDefaultDevice(MediaType.VIDEO).getFormat()).getSize());
  origin=getOriginForMediaDevice(mediaDevice);
  sipCall.reInvite();
}

Fixed version (ground truth):
/** 
 * Sets the indicator which determines whether the streaming of local video in a specific <tt>Call</tt> is allowed. The setting does not reflect the availability of actual video capture devices, it just expresses the desire of the user to have the local video streamed in the case the system is actually able to do so.
 * @param call the <tt>Call</tt> to allow/disallow the streaming of localvideo for
 * @param mediaDevice the media device to use for the desktop streaming
 * @param allowed <tt>true</tt> to allow the streaming of local video forthe specified <tt>Call</tt>; <tt>false</tt> to disallow it
 * @throws OperationFailedException if initializing local video fails.
 */
public void setLocalVideoAllowed(Call call,MediaDevice mediaDevice,boolean allowed) throws OperationFailedException {
  CallSipImpl sipCall=(CallSipImpl)call;
  MediaUseCase useCase=MediaUseCase.DESKTOP;
  sipCall.setVideoDevice(mediaDevice,useCase);
  sipCall.setLocalVideoAllowed(allowed,useCase);
  size=(((VideoMediaFormat)sipCall.getDefaultDevice(MediaType.VIDEO).getFormat()).getSize());
  origin=getOriginForMediaDevice(mediaDevice);
  sipCall.reInvite();
}
Program: 103108
Project: 103108
Buggy source:
/** 
 * Implements OperationSetVideoTelephony#setLocalVideoAllowed(Call, boolean). Modifies the local media setup to reflect the requested setting for the streaming of the local video and then re-invites all CallPeers to re-negotiate the modified media setup.
 * @param call    the call where we'd like to allow sending local video.
 * @param allowed <tt>true</tt> if local video transmission is allowed and<tt>false</tt> otherwise.
 * @throws OperationFailedException if video initialization fails.
 */
public void setLocalVideoAllowed(Call call,boolean allowed) throws OperationFailedException {
  MediaAwareCall<?,?,?> mediaAwareCall=(MediaAwareCall<?,?,?>)call;
  mediaAwareCall.setVideoDevice(null);
  mediaAwareCall.setLocalVideoAllowed(allowed,MediaUseCase.CALL);
}

Fixed version (ground truth):
/** 
 * Implements OperationSetVideoTelephony#setLocalVideoAllowed(Call, boolean). Modifies the local media setup to reflect the requested setting for the streaming of the local video and then re-invites all CallPeers to re-negotiate the modified media setup.
 * @param call    the call where we'd like to allow sending local video.
 * @param allowed <tt>true</tt> if local video transmission is allowed and<tt>false</tt> otherwise.
 * @throws OperationFailedException if video initialization fails.
 */
public void setLocalVideoAllowed(Call call,boolean allowed) throws OperationFailedException {
  MediaAwareCall<?,?,?> mediaAwareCall=(MediaAwareCall<?,?,?>)call;
  MediaUseCase useCase=MediaUseCase.CALL;
  mediaAwareCall.setVideoDevice(null,useCase);
  mediaAwareCall.setLocalVideoAllowed(allowed,useCase);
}
Program: 103109
Project: 103109
Buggy source:
/** 
 * Notifies this instance that a value of a specific property of the <tt>Call</tt> of   {@link #peer} has changed from a specific old value to aspecific new value.
 * @param event a <tt>PropertyChangeEvent</tt> which specified the propertywhich had its value changed and the old and new values of that property
 */
private void callPropertyChange(PropertyChangeEvent event){
  String propertyName=event.getPropertyName();
  if (MediaAwareCall.CONFERENCE.equals(propertyName) || MediaAwareCall.DEFAULT_DEVICE.equals(propertyName)) {
    MediaAwareCall<?,?,?> call=getPeer().getCall();
    if (call == null)     return;
    for (    MediaType mediaType : MediaType.values()) {
      MediaStream stream=getStream(mediaType);
      if (stream == null)       continue;
      MediaDevice oldDevice=stream.getDevice();
      if (oldDevice != null) {
        if (oldDevice instanceof MediaDeviceWrapper)         oldDevice=((MediaDeviceWrapper)oldDevice).getWrappedDevice();
        MediaDevice newDevice=getDefaultDevice(mediaType);
        MediaDevice wrappedNewDevice=newDevice;
        if (newDevice instanceof MediaDeviceWrapper)         wrappedNewDevice=((MediaDeviceWrapper)newDevice).getWrappedDevice();
        if (oldDevice != wrappedNewDevice)         stream.setDevice(newDevice);
      }
      stream.setRTPTranslator(call.getRTPTranslator(mediaType));
    }
  }
}

Fixed version (ground truth):
/** 
 * Notifies this instance that a value of a specific property of the <tt>Call</tt> of   {@link #peer} has changed from a specific old value to aspecific new value.
 * @param event a <tt>PropertyChangeEvent</tt> which specified the propertywhich had its value changed and the old and new values of that property
 */
private void callPropertyChange(PropertyChangeEvent event){
  String propertyName=event.getPropertyName();
  if (MediaAwareCall.CONFERENCE.equals(propertyName) || MediaAwareCall.DEFAULT_DEVICE.equals(propertyName)) {
    MediaAwareCall<?,?,?> call=getPeer().getCall();
    if (call == null)     return;
    for (    MediaType mediaType : MediaType.values()) {
      MediaStream stream=getStream(mediaType);
      if (stream == null)       continue;
      MediaDevice oldDevice=stream.getDevice();
      if (oldDevice != null) {
        if (oldDevice instanceof MediaDeviceWrapper) {
          oldDevice=((MediaDeviceWrapper)oldDevice).getWrappedDevice();
        }
        MediaDevice newDevice=getDefaultDevice(mediaType);
        MediaDevice newWrappedDevice=newDevice;
        if (newDevice instanceof MediaDeviceWrapper) {
          newWrappedDevice=((MediaDeviceWrapper)newDevice).getWrappedDevice();
        }
        if (MediaAwareCall.DEFAULT_DEVICE.equals(propertyName))         System.err.println(CallPeerMediaHandler.class.getName() + "String_Node_Str" + oldDevice+ "String_Node_Str"+ newDevice+ "String_Node_Str"+ newWrappedDevice);
        if (oldDevice != newWrappedDevice)         stream.setDevice(newDevice);
      }
      stream.setRTPTranslator(call.getRTPTranslator(mediaType));
    }
  }
}
Program: 103111
Project: 103111
Buggy source:
/** 
 * Saves the password for the specified account after scrambling it a bit so that it is not visible from first sight (Method remains highly insecure). <p> TODO Delegate the implementation to   {@link AccountManager} because itknows the format in which the password (among the other account properties) is to be saved. </p>
 * @param bundleContext a currently valid bundle context.
 * @param accountID the <tt>AccountID</tt> of the account whose password isto be stored
 * @param password the password to be stored
 * @throws IllegalArgumentException if no account corresponding to<tt>accountID</tt> has been previously stored.
 * @throws OperationFailedException if anything goes wrong while storing thespecified <tt>password</tt>
 */
protected void storePassword(BundleContext bundleContext,AccountID accountID,String password) throws IllegalArgumentException, OperationFailedException {
  String accountPrefix=findAccountPrefix(bundleContext,accountID,getFactoryImplPackageName());
  if (accountPrefix == null) {
    throw new IllegalArgumentException("String_Node_Str" + accountID.getAccountUniqueID() + "String_Node_Str"+ getFactoryImplPackageName());
  }
  CredentialsStorageService credentialsStorage=ServiceUtils.getService(bundleContext,CredentialsStorageService.class);
  if (!credentialsStorage.storePassword(accountPrefix,password)) {
    throw new OperationFailedException("String_Node_Str",OperationFailedException.GENERAL_ERROR);
  }
}

Fixed version (ground truth):
/** 
 * Saves the password for the specified account after scrambling it a bit so that it is not visible from first sight (Method remains highly insecure). <p> TODO Delegate the implementation to   {@link AccountManager} because itknows the format in which the password (among the other account properties) is to be saved. </p>
 * @param bundleContext a currently valid bundle context.
 * @param accountID the <tt>AccountID</tt> of the account whose password isto be stored
 * @param password the password to be stored
 * @throws IllegalArgumentException if no account corresponding to<tt>accountID</tt> has been previously stored.
 * @throws OperationFailedException if anything goes wrong while storing thespecified <tt>password</tt>
 */
protected void storePassword(BundleContext bundleContext,AccountID accountID,String password) throws IllegalArgumentException, OperationFailedException {
  String accountPrefix=findAccountPrefix(bundleContext,accountID,getFactoryImplPackageName());
  if (accountPrefix == null) {
    throw new IllegalArgumentException("String_Node_Str" + accountID.getAccountUniqueID() + "String_Node_Str"+ getFactoryImplPackageName());
  }
  CredentialsStorageService credentialsStorage=ServiceUtils.getService(bundleContext,CredentialsStorageService.class);
  if (!credentialsStorage.storePassword(accountPrefix,password)) {
    throw new OperationFailedException("String_Node_Str",OperationFailedException.GENERAL_ERROR);
  }
  accountID.setPassword(password);
}