nus-yam/ex-repair huggingface dataset:
Program: 103495
Project: 103495
Buggy source:
/** 
 * Saves the last status for all accounts. This information is used on loging. Each time user logs in he's logged with the same status as he was the last time before closing the application.
 * @param protocolProvider the protocol provider to save status informationfor
 * @param statusName the name of the status to save
 */
protected void saveStatusInformation(ProtocolProviderService protocolProvider,String statusName){
  ConfigurationService configService=GuiActivator.getConfigurationService();
  String prefix="String_Node_Str";
  List<String> accounts=configService.getPropertyNamesByPrefix(prefix,true);
  boolean savedAccount=false;
  for (  String accountRootPropName : accounts) {
    String accountUID=configService.getString(accountRootPropName);
    if (accountUID.equals(protocolProvider.getAccountID().getAccountUniqueID())) {
      configService.setProperty(accountRootPropName + "String_Node_Str",statusName);
      savedAccount=true;
    }
  }
  if (!savedAccount) {
    String accNodeName="String_Node_Str" + Long.toString(System.currentTimeMillis());
    String accountPackage="String_Node_Str" + accNodeName;
    configService.setProperty(accountPackage,protocolProvider.getAccountID().getAccountUniqueID());
    configService.setProperty(accountPackage + "String_Node_Str",statusName);
  }
  this.setPreferredSize(new Dimension(28,24));
}

Fixed version (ground truth):
/** 
 * Saves the last status for all accounts. This information is used on loging. Each time user logs in he's logged with the same status as he was the last time before closing the application.
 * @param protocolProvider the protocol provider to save status informationfor
 * @param statusName the name of the status to save
 */
protected void saveStatusInformation(ProtocolProviderService protocolProvider,String statusName){
  ConfigurationService configService=GuiActivator.getConfigurationService();
  String prefix="String_Node_Str";
  List<String> accounts=configService.getPropertyNamesByPrefix(prefix,true);
  boolean savedAccount=false;
  for (  String accountRootPropName : accounts) {
    String accountUID=configService.getString(accountRootPropName);
    if (accountUID.equals(protocolProvider.getAccountID().getAccountUniqueID())) {
      configService.setProperty(accountRootPropName + "String_Node_Str",statusName);
      savedAccount=true;
    }
  }
  if (!savedAccount) {
    String accNodeName="String_Node_Str" + Long.toString(System.currentTimeMillis());
    String accountPackage="String_Node_Str" + accNodeName;
    configService.setProperty(accountPackage,protocolProvider.getAccountID().getAccountUniqueID());
    configService.setProperty(accountPackage + "String_Node_Str",statusName);
  }
}
Program: 103496
Project: 103496
Buggy source:
/** 
 * Paints this component. If the state of this menu is connecting, paints the connecting icon.
 */
public void paintComponent(Graphics g){
  AntialiasingManager.activateAntialiasing(g);
  super.paintComponent(g);
  if (isConnecting)   g.drawImage(connectingIcon,0,3,this);
}

Fixed version (ground truth):
/** 
 * Paints this component. If the state of this menu is connecting, paints the connecting icon.
 * @param g the <tt>Graphics</tt> object used for painting
 */
public void paintComponent(Graphics g){
  AntialiasingManager.activateAntialiasing(g);
  super.paintComponent(g);
  if (isConnecting)   g.drawImage(connectingIcon,0,3,this);
}
Program: 103497
Project: 103497
Buggy source:
/** 
 * Creates the ICE agent that we would be using in this transport manager for all negotiation.
 * @return the ICE agent to use for all the ICE negotiation that thistransport manager would be going through
 */
private Agent createIceAgent(){
  ProtocolProviderServiceJabberImpl provider=getCallPeer().getProtocolProvider();
  NetworkAddressManagerService namSer=getNetAddrMgr();
  Agent agent=namSer.createIceAgent();
  JabberAccountID accID=(JabberAccountID)provider.getAccountID();
  if (accID.isStunServerDiscoveryEnabled()) {
    String username=provider.getOurJID();
    String password=JabberActivator.getProtocolProviderFactory().loadPassword(accID);
    StunCandidateHarvester autoHarvester=null;
    try {
      autoHarvester=namSer.discoverStunServer(accID.getService(),username.getBytes("String_Node_Str"),password.getBytes("String_Node_Str"));
      logger.info("String_Node_Str" + autoHarvester);
    }
 catch (    UnsupportedEncodingException exc) {
    }
    if (autoHarvester != null)     agent.addCandidateHarvester(autoHarvester);
  }
  for (  StunServerDescriptor desc : accID.getStunServers()) {
    TransportAddress addr=new TransportAddress(desc.getAddress(),desc.getPort(),Transport.UDP);
    StunCandidateHarvester harvester;
    if (desc.isTurnSupported()) {
      harvester=new TurnCandidateHarvester(addr,new LongTermCredential(desc.getUsername(),desc.getPassword()));
    }
 else {
      harvester=new StunCandidateHarvester(addr);
    }
    logger.info("String_Node_Str" + harvester);
    agent.addCandidateHarvester(harvester);
  }
  return agent;
}

Fixed version (ground truth):
/** 
 * Creates the ICE agent that we would be using in this transport manager for all negotiation.
 * @return the ICE agent to use for all the ICE negotiation that thistransport manager would be going through
 */
private Agent createIceAgent(){
  ProtocolProviderServiceJabberImpl provider=getCallPeer().getProtocolProvider();
  NetworkAddressManagerService namSer=getNetAddrMgr();
  Agent agent=namSer.createIceAgent();
  JabberAccountID accID=(JabberAccountID)provider.getAccountID();
  if (accID.isStunServerDiscoveryEnabled()) {
    String username=provider.getOurJID();
    String password=JabberActivator.getProtocolProviderFactory().loadPassword(accID);
    StunCandidateHarvester autoHarvester=namSer.discoverStunServer(accID.getService(),StringUtils.getUTF8Bytes(username),StringUtils.getUTF8Bytes(password));
    logger.info("String_Node_Str" + autoHarvester);
    if (autoHarvester != null)     agent.addCandidateHarvester(autoHarvester);
  }
  for (  StunServerDescriptor desc : accID.getStunServers()) {
    TransportAddress addr=new TransportAddress(desc.getAddress(),desc.getPort(),Transport.UDP);
    StunCandidateHarvester harvester;
    if (desc.isTurnSupported()) {
      harvester=new TurnCandidateHarvester(addr,new LongTermCredential(desc.getUsername(),desc.getPassword()));
    }
 else {
      harvester=new StunCandidateHarvester(addr);
    }
    logger.info("String_Node_Str" + harvester);
    agent.addCandidateHarvester(harvester);
  }
  return agent;
}
Program: 103499
Project: 103499
Buggy source:
public void openURL(String url){
  new LaunchBrowser(url).start();
}

Fixed version (ground truth):
/** 
 * Creates a <tt>LaunchBrowser</tt> thread for the specified <tt>url</tt>.
 * @param url the url we'd like to launch a browser for.
 */
public void openURL(String url){
  new LaunchBrowser(url).start();
}
Program: 103500
Project: 103500
Buggy source:
public LaunchBrowser(String url){
  this.url=url;
}

Fixed version (ground truth):
/** 
 * Creates a new instance.
 * @param url the url we'd like to launch a browser for.
 */
public LaunchBrowser(String url){
  this.url=url;
}
Program: 103501
Project: 103501
Buggy source:
public void run(){
  try {
    if (OSUtils.IS_MAC) {
      FileManager.openURL(url);
    }
 else     if (OSUtils.IS_WINDOWS) {
      Runtime.getRuntime().exec("String_Node_Str" + url);
    }
 else {
      String[] browsers={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
      String browser=null;
      for (int i=0; i < browsers.length && browser == null; i++) {
        if (Runtime.getRuntime().exec(new String[]{"String_Node_Str",browsers[i]}).waitFor() == 0)         browser=browsers[i];
      }
      if (browser == null)       throw new Exception("String_Node_Str");
 else       Runtime.getRuntime().exec(new String[]{browser,url});
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * On mac, asks FileManager to open the the url, on Windows uses FileProtocolHandler to do so, on Linux, loops through a list of known browsers until we find one that seems to work.
 */
public void run(){
  try {
    if (OSUtils.IS_MAC) {
      FileManager.openURL(url);
    }
 else     if (OSUtils.IS_WINDOWS) {
      Runtime.getRuntime().exec("String_Node_Str" + url);
    }
 else {
      String[] browsers={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
      String browser=null;
      for (int i=0; i < browsers.length && browser == null; i++) {
        if (Runtime.getRuntime().exec(new String[]{"String_Node_Str",browsers[i]}).waitFor() == 0)         browser=browsers[i];
      }
      if (browser == null)       throw new Exception("String_Node_Str");
 else       Runtime.getRuntime().exec(new String[]{browser,url});
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 103504
Project: 103504
Buggy source:
/** 
 * Sets the password associated to this server username.
 * @param password the password to set
 */
public void setPassword(String password){
  this.password=getUTF8Bytes(password);
}

Fixed version (ground truth):
/** 
 * Sets the password associated to this server username.
 * @param password the password to set
 */
public void setPassword(String password){
  this.password=StringUtils.getUTF8Bytes(password);
}
Program: 103505
Project: 103505
Buggy source:
/** 
 * Sets the username associated to this server.
 * @param username the username to set
 */
public void setUsername(String username){
  this.username=getUTF8Bytes(username);
}

Fixed version (ground truth):
/** 
 * Sets the username associated to this server.
 * @param username the username to set
 */
public void setUsername(String username){
  this.username=StringUtils.getUTF8Bytes(username);
}
Program: 103506
Project: 103506
Buggy source:
/** 
 * Creates an instance of <tt>StunServer</tt> by specifying all parameters.
 * @param address the IP address or FQDN of the STUN server
 * @param port the port of the server
 * @param supportTurn indicates if this STUN server supports TURN
 * @param username the user name for authenticating
 * @param password the password
 */
public StunServerDescriptor(String address,int port,boolean supportTurn,String username,String password){
  this.address=address;
  this.port=port;
  this.isTurnSupported=supportTurn;
  this.username=getUTF8Bytes(username);
  this.password=getUTF8Bytes(password);
}

Fixed version (ground truth):
/** 
 * Creates an instance of <tt>StunServer</tt> by specifying all parameters.
 * @param address the IP address or FQDN of the STUN server
 * @param port the port of the server
 * @param supportTurn indicates if this STUN server supports TURN
 * @param username the user name for authenticating
 * @param password the password
 */
public StunServerDescriptor(String address,int port,boolean supportTurn,String username,String password){
  this.address=address;
  this.port=port;
  this.isTurnSupported=supportTurn;
  this.username=StringUtils.getUTF8Bytes(username);
  this.password=StringUtils.getUTF8Bytes(password);
}
Program: 103507
Project: 103507
Buggy source:
/** 
 * Stores this descriptor into the specified   {@link Map}.The method is meant for use with account property maps. It also allows prepending an account prefix to all property names so that multiple descriptors can be stored in a single   {@link Map}.
 * @param props the account properties {@link Map} that we'd like to storethis descriptor in.
 * @param namePrefix the prefix that we should prepend to every propertyname.
 */
public void storeDescriptor(Map<String,String> props,String namePrefix){
  if (namePrefix == null)   namePrefix="String_Node_Str";
  props.put(namePrefix + STUN_ADDRESS,getAddress());
  if (getPort() != -1)   props.put(namePrefix + STUN_PORT,Integer.toString(getPort()));
  if (getUsername() != null && getUsername().length > 0)   props.put(namePrefix + STUN_USERNAME,getUTF8String(getUsername()));
  if (getPassword() != null && getPassword().length > 0)   props.put(namePrefix + STUN_PASSWORD,new String(getPassword()));
  props.put(namePrefix + STUN_IS_TURN_SUPPORTED,Boolean.toString(isTurnSupported()));
}

Fixed version (ground truth):
/** 
 * Stores this descriptor into the specified   {@link Map}.The method is meant for use with account property maps. It also allows prepending an account prefix to all property names so that multiple descriptors can be stored in a single   {@link Map}.
 * @param props the account properties {@link Map} that we'd like to storethis descriptor in.
 * @param namePrefix the prefix that we should prepend to every propertyname.
 */
public void storeDescriptor(Map<String,String> props,String namePrefix){
  if (namePrefix == null)   namePrefix="String_Node_Str";
  props.put(namePrefix + STUN_ADDRESS,getAddress());
  if (getPort() != -1)   props.put(namePrefix + STUN_PORT,Integer.toString(getPort()));
  if (getUsername() != null && getUsername().length > 0)   props.put(namePrefix + STUN_USERNAME,StringUtils.getUTF8String(getUsername()));
  if (getPassword() != null && getPassword().length > 0)   props.put(namePrefix + STUN_PASSWORD,new String(getPassword()));
  props.put(namePrefix + STUN_IS_TURN_SUPPORTED,Boolean.toString(isTurnSupported()));
}
Program: 103508
Project: 103508
Buggy source:
/** 
 * Creates the directory in the pattern.
 * @param pattern
 */
private static void checkDestinationDirectory(String pattern){
  try {
    int ix=pattern.lastIndexOf('/');
    if (ix != -1) {
      String dirName=pattern.substring(0,ix);
      dirName=dirName.replaceAll("String_Node_Str",System.getProperty("String_Node_Str"));
      dirName=dirName.replaceAll("String_Node_Str",System.getProperty("String_Node_Str"));
      new File(dirName).mkdirs();
    }
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
/** 
 * Creates the directory in the pattern.
 * @param pattern the directory we'd like to check.
 */
private static void checkDestinationDirectory(String pattern){
  try {
    int ix=pattern.lastIndexOf('/');
    if (ix != -1) {
      String dirName=pattern.substring(0,ix);
      dirName=dirName.replaceAll("String_Node_Str",System.getProperty("String_Node_Str"));
      dirName=dirName.replaceAll("String_Node_Str",System.getProperty("String_Node_Str"));
      new File(dirName).mkdirs();
    }
  }
 catch (  Exception e) {
  }
}
Program: 103509
Project: 103509
Buggy source:
/** 
 * Stores XCAP_PASSWORD property.
 * @param accountID the account identifier.
 */
private void storeXCapPassword(AccountID accountID){
  CredentialsStorageService credentialsStorage=ServiceUtils.getService(getBundleContext(),CredentialsStorageService.class);
  String accountPrefix=accountID.getAccountUniqueID() + "String_Node_Str";
  String password=accountID.getAccountPropertyString(ProtocolProviderServiceSipImpl.XCAP_PASSWORD);
  if (password != null) {
    credentialsStorage.storePassword(accountPrefix,password);
    accountID.removeAccountProperty(ProtocolProviderServiceSipImpl.XCAP_PASSWORD);
  }
}

Fixed version (ground truth):
/** 
 * Stores XCAP_PASSWORD property.
 * @param accountID the account identifier.
 */
private void storeXCapPassword(AccountID accountID){
  Object password=accountID.getAccountProperty(ProtocolProviderServiceSipImpl.XCAP_PASSWORD);
  if (password != null) {
    CredentialsStorageService credentialsStorage=ServiceUtils.getService(getBundleContext(),CredentialsStorageService.class);
    String accountPrefix=accountID.getAccountUniqueID() + "String_Node_Str";
    credentialsStorage.storePassword(accountPrefix,(String)password);
    accountID.removeAccountProperty(ProtocolProviderServiceSipImpl.XCAP_PASSWORD);
  }
}
Program: 103510
Project: 103510
Buggy source:
/** 
 * Ovverides the original in order not to save the XCAP_PASSWORD field.
 * @param accountID the account identifier.
 */
protected void storeAccount(AccountID accountID){
  storeXCapPassword(accountID);
  super.storeAccount(accountID);
  loadXCapPassword(accountID);
}

Fixed version (ground truth):
/** 
 * Ovverides the original in order not to save the XCAP_PASSWORD field.
 * @param accountID the account identifier.
 */
protected void storeAccount(AccountID accountID){
  storeXCapPassword(accountID);
  super.storeAccount(accountID);
}
Program: 103511
Project: 103511
Buggy source:
/** 
 * Shutdowns operation sets that need it then calls the <tt>SipRegistrarConnection.unregister()</tt> method.
 */
public void run(){
  if (logger.isTraceEnabled())   logger.trace("String_Node_Str");
  OperationSetBasicTelephonySipImpl telephony=(OperationSetBasicTelephonySipImpl)getOperationSet(OperationSetBasicTelephony.class);
  telephony.shutdown();
  if (isRegistered()) {
    try {
      ShutdownUnregistrationBlockListener listener=new ShutdownUnregistrationBlockListener();
      addRegistrationStateChangeListener(listener);
      unregister();
      listener.waitForEvent(5000L);
    }
 catch (    OperationFailedException ex) {
      logger.error("String_Node_Str" + getAccountID(),ex);
    }
  }
  headerFactory=null;
  messageFactory=null;
  addressFactory=null;
  sipSecurityManager=null;
  methodProcessors.clear();
  isInitialized=false;
}

Fixed version (ground truth):
/** 
 * Shutdowns operation sets that need it then calls the <tt>SipRegistrarConnection.unregister()</tt> method.
 */
public void run(){
  if (logger.isTraceEnabled())   logger.trace("String_Node_Str");
  OperationSetBasicTelephonySipImpl telephony=(OperationSetBasicTelephonySipImpl)getOperationSet(OperationSetBasicTelephony.class);
  telephony.shutdown();
  if (isRegistered()) {
    try {
      ShutdownUnregistrationBlockListener listener=new ShutdownUnregistrationBlockListener();
      addRegistrationStateChangeListener(listener);
      unregister();
      listener.waitForEvent(3000L);
    }
 catch (    OperationFailedException ex) {
      logger.error("String_Node_Str" + getAccountID(),ex);
    }
  }
  headerFactory=null;
  messageFactory=null;
  addressFactory=null;
  sipSecurityManager=null;
  methodProcessors.clear();
  isInitialized=false;
}
Program: 103513
Project: 103513
Buggy source:
/** 
 * Makes the service implementation close all open sockets and release any resources that it might have taken and prepare for shutdown/garbage collection.
 */
public void shutdown(){
  if (!isInitialized) {
    return;
  }
  Thread t=new Thread(new ShutdownThread());
  t.setDaemon(false);
  t.start();
}

Fixed version (ground truth):
/** 
 * Makes the service implementation close all open sockets and release any resources that it might have taken and prepare for shutdown/garbage collection.
 */
public void shutdown(){
  if (!isInitialized) {
    return;
  }
  new ShutdownThread().run();
}
Program: 103515
Project: 103515
Buggy source:
/** 
 * Creates a full filename for the call by combining the directory, file prefix and extension. If the directory is <tt>null</tt> user's home directory is used.
 * @param savedCallsPath the path to the directory in which the generatedfile name is to be placed
 * @return a full filename for the call
 */
private String createDefaultFilename(String savedCallsPath){
  if (savedCallsPath == null) {
    try {
      savedCallsPath=GuiActivator.getFileAccessService().getDefaultDownloadDirectory().getAbsolutePath();
    }
 catch (    IOException ioex) {
    }
  }
  String ext=configuration.getString(Recorder.CALL_FORMAT);
  if ((ext == null) || (ext.length() == 0) || !isSupportedFormat(ext))   ext=SoundFileUtils.DEFAULT_CALL_RECORDING_FORMAT;
  return ((savedCallsPath == null) ? "String_Node_Str" : (savedCallsPath + File.separator)) + generateCallFilename(ext);
}

Fixed version (ground truth):
/** 
 * Creates a full filename for the call by combining the directory, file prefix and extension. If the directory is <tt>null</tt> user's home directory is used.
 * @param savedCallsPath the path to the directory in which the generatedfile name is to be placed
 * @return a full filename for the call
 */
private String createDefaultFilename(String savedCallsPath){
  if (savedCallsPath == null) {
    try {
      savedCallsPath=GuiActivator.getFileAccessService().getDefaultDownloadDirectory().getAbsolutePath();
    }
 catch (    IOException ioex) {
    }
  }
  String ext=configuration.getString(Recorder.FORMAT);
  if ((ext == null) || (ext.length() == 0) || !isSupportedFormat(ext))   ext=SoundFileUtils.DEFAULT_CALL_RECORDING_FORMAT;
  return ((savedCallsPath == null) ? "String_Node_Str" : (savedCallsPath + File.separator)) + generateCallFilename(ext);
}
Program: 103516
Project: 103516
Buggy source:
/** 
 * Starts/stops the recording of the call when this button is pressed.
 * @param evt the <tt>ActionEvent</tt> that notified us of the action
 */
public void actionPerformed(ActionEvent evt){
  if (call != null) {
    if (isSelected()) {
      boolean startedRecording=false;
      try {
        startedRecording=startRecording();
      }
  finally {
        if (!startedRecording && (recorder != null)) {
          try {
            recorder.stop();
          }
  finally {
            recorder=null;
          }
        }
        setSelected(startedRecording);
      }
    }
 else     if (recorder != null) {
      try {
        recorder.stop();
        NotificationManager.fireNotification(NotificationManager.CALL_SAVED,resources.getI18NString("String_Node_Str"),resources.getI18NString("String_Node_Str",new String[]{callFilename}));
      }
  finally {
        recorder=null;
        setSelected(false);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Starts/stops the recording of the call when this button is pressed.
 * @param evt the <tt>ActionEvent</tt> that notified us of the action
 */
public void actionPerformed(ActionEvent evt){
  if (call != null) {
    if (isSelected()) {
      boolean startedRecording=false;
      try {
        startedRecording=startRecording();
      }
  finally {
        if (!startedRecording && (recorder != null)) {
          try {
            recorder.stop();
          }
  finally {
            recorder=null;
          }
        }
        setSelected(startedRecording);
      }
      if (startedRecording && (recorder != null)) {
        recorder.addListener(new Recorder.Listener(){
          public void recorderStopped(          Recorder recorder){
            NotificationManager.fireNotification(NotificationManager.CALL_SAVED,resources.getI18NString("String_Node_Str"),resources.getI18NString("String_Node_Str",new String[]{callFilename}));
          }
        }
);
      }
    }
 else     if (recorder != null) {
      try {
        recorder.stop();
      }
  finally {
        recorder=null;
        setSelected(false);
      }
    }
  }
}
Program: 103518
Project: 103518
Buggy source:
/** 
 * Returns the string to be used as the tooltip for <i>event</i>. 
 * @param event the <tt>MouseEvent</tt> 
 * @return the string to be used as the tooltip for <i>event</i>.
 */
public String getToolTipText(MouseEvent event){
  if (currentHref != null && currentHref.length() != 0)   return currentHref;
 else   return null;
}

Fixed version (ground truth):
/** 
 * Returns the string to be used as the tooltip for <i>event</i>. 
 * @param event the <tt>MouseEvent</tt> 
 * @return the string to be used as the tooltip for <i>event</i>.
 */
@Override public String getToolTipText(MouseEvent event){
  return ((currentHref != null) && (currentHref.length() != 0)) ? currentHref : null;
}
Program: 103519
Project: 103519
Buggy source:
public void itemStateChanged(ItemEvent event){
  if (event.getStateChange() == ItemEvent.SELECTED) {
    NeomediaActivator.getConfigurationService().setProperty(Recorder.CALL_FORMAT,event.getItem());
  }
}

Fixed version (ground truth):
public void itemStateChanged(ItemEvent event){
  if (event.getStateChange() == ItemEvent.SELECTED) {
    NeomediaActivator.getConfigurationService().setProperty(Recorder.FORMAT,event.getItem());
  }
}
Program: 103520
Project: 103520
Buggy source:
/** 
 * Creates a combo box with supported audio formats.
 * @return a combo box with supported audio formats
 */
private Component createFormatsComboBox(){
  ComboBoxModel formatsComboBoxModel=new DefaultComboBoxModel(RecorderImpl.SUPPORTED_FORMATS);
  formatsComboBox=new JComboBox();
  formatsComboBox.setPreferredSize(new Dimension(200,30));
  formatsComboBox.setModel(formatsComboBoxModel);
  formatsComboBox.addItemListener(new ItemListener(){
    public void itemStateChanged(    ItemEvent event){
      if (event.getStateChange() == ItemEvent.SELECTED) {
        NeomediaActivator.getConfigurationService().setProperty(Recorder.CALL_FORMAT,event.getItem());
      }
    }
  }
);
  return formatsComboBox;
}

Fixed version (ground truth):
/** 
 * Creates a combo box with supported audio formats.
 * @return a combo box with supported audio formats
 */
private Component createFormatsComboBox(){
  ComboBoxModel formatsComboBoxModel=new DefaultComboBoxModel(RecorderImpl.SUPPORTED_FORMATS);
  formatsComboBox=new JComboBox();
  formatsComboBox.setPreferredSize(new Dimension(200,30));
  formatsComboBox.setModel(formatsComboBoxModel);
  formatsComboBox.addItemListener(new ItemListener(){
    public void itemStateChanged(    ItemEvent event){
      if (event.getStateChange() == ItemEvent.SELECTED) {
        NeomediaActivator.getConfigurationService().setProperty(Recorder.FORMAT,event.getItem());
      }
    }
  }
);
  return formatsComboBox;
}
Program: 103521
Project: 103521
Buggy source:
/** 
 * Loads values from the configuration and sets the UI components to these values.
 */
private void loadValues(){
  ConfigurationService configurationService=NeomediaActivator.getConfigurationService();
  String callFormat=configurationService.getString(Recorder.CALL_FORMAT);
  formatsComboBox.setSelectedItem((callFormat == null) ? SoundFileUtils.DEFAULT_CALL_RECORDING_FORMAT : callFormat);
  savedCallsDir=configurationService.getString(Recorder.SAVED_CALLS_PATH);
  saveCallsToCheckBox.setSelected(savedCallsDir != null);
  callDirTextField.setText(savedCallsDir);
  callDirTextField.setEnabled(saveCallsToCheckBox.isSelected());
  callDirChooseButton.setEnabled(saveCallsToCheckBox.isSelected());
}

Fixed version (ground truth):
/** 
 * Loads values from the configuration and sets the UI components to these values.
 */
private void loadValues(){
  ConfigurationService configuration=NeomediaActivator.getConfigurationService();
  String format=configuration.getString(Recorder.FORMAT);
  formatsComboBox.setSelectedItem((format == null) ? SoundFileUtils.DEFAULT_CALL_RECORDING_FORMAT : format);
  savedCallsDir=configuration.getString(Recorder.SAVED_CALLS_PATH);
  saveCallsToCheckBox.setSelected(savedCallsDir != null);
  callDirTextField.setText(savedCallsDir);
  callDirTextField.setEnabled(saveCallsToCheckBox.isSelected());
  callDirChooseButton.setEnabled(saveCallsToCheckBox.isSelected());
}
Program: 103522
Project: 103522
Buggy source:
public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int column){
  ProtocolProviderService pps=(ProtocolProviderService)value;
  OperationSetPresence presence=pps.getOperationSet(OperationSetPresence.class);
  this.setText(pps.getAccountID().getDisplayName());
  if (presence.getPresenceStatus() != null) {
    byte[] protocolStatusImage=presence.getPresenceStatus().getStatusIcon();
    if (protocolStatusImage != null) {
      this.setIcon(new ImageIcon(protocolStatusImage));
    }
 else {
      this.setIcon(null);
    }
  }
  if (isSelected)   this.setBackground(table.getSelectionBackground());
 else   this.setBackground(UIManager.getColor("String_Node_Str"));
  return this;
}

Fixed version (ground truth):
public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int column){
  ProtocolProviderService pps=(ProtocolProviderService)value;
  OperationSetPresence presence=pps.getOperationSet(OperationSetPresence.class);
  if (presence != null) {
    byte[] protocolStatusImage=presence.getPresenceStatus().getStatusIcon();
    if (protocolStatusImage != null) {
      this.setIcon(new ImageIcon(protocolStatusImage));
    }
 else {
      this.setIcon(null);
    }
  }
  this.setText(pps.getAccountID().getDisplayName());
  if (isSelected)   this.setBackground(table.getSelectionBackground());
 else   this.setBackground(UIManager.getColor("String_Node_Str"));
  return this;
}
Program: 103524
Project: 103524
Buggy source:
/** 
 * Whether portaudio is supported.
 * @return the supported
 */
public static boolean isSupported(){
  return supported;
}

Fixed version (ground truth):
/** 
 * Determines whether PortAudio is supported.
 * @return <tt>true</tt> if PortAudio is supported; otherwise,<tt>false</tt>
 */
public static boolean isSupported(){
  return supported;
}
Program: 103526
Project: 103526
Buggy source:
/** 
 * Puts the <tt>CallPeer</tt> represented by this instance on or off hold.
 * @param onHold <tt>true</tt> to have the <tt>CallPeer</tt> put on hold;<tt>false</tt>, otherwise
 * @throws OperationFailedException if we fail to construct or send theINVITE request putting the remote side on/off hold.
 */
public void putOnHold(boolean onHold) throws OperationFailedException {
  CallPeerMediaHandlerJabberImpl mediaHandler=getMediaHandler();
  mediaHandler.setLocallyOnHold(onHold);
  SessionInfoType type;
  if (onHold)   type=SessionInfoType.hold;
 else   type=SessionInfoType.unhold;
  reevalLocalHoldStatus();
  JingleIQ onHoldIQ=JinglePacketFactory.createSessionInfo(getProtocolProvider().getOurJID(),peerJID,getJingleSID(),type);
  getProtocolProvider().getConnection().sendPacket(onHoldIQ);
}

Fixed version (ground truth):
/** 
 * Puts the <tt>CallPeer</tt> represented by this instance on or off hold.
 * @param onHold <tt>true</tt> to have the <tt>CallPeer</tt> put on hold;<tt>false</tt>, otherwise
 * @throws OperationFailedException if we fail to construct or send theINVITE request putting the remote side on/off hold.
 */
public void putOnHold(boolean onHold) throws OperationFailedException {
  CallPeerMediaHandlerJabberImpl mediaHandler=getMediaHandler();
  mediaHandler.setLocallyOnHold(onHold);
  SessionInfoType type;
  if (onHold)   type=SessionInfoType.hold;
 else {
    type=SessionInfoType.unhold;
    getMediaHandler().reinitAllContents();
  }
  reevalLocalHoldStatus();
  JingleIQ onHoldIQ=JinglePacketFactory.createSessionInfo(getProtocolProvider().getOurJID(),peerJID,getJingleSID(),type);
  getProtocolProvider().getConnection().sendPacket(onHoldIQ);
}
Program: 103527
Project: 103527
Buggy source:
/** 
 * Sets our state to CONNECTED, sends an ACK and processes the SDP description in the <tt>ok</tt> <tt>Response</tt>.
 * @param clientTransaction the <tt>ClientTransaction</tt> that the responsearrived in.
 * @param ok the OK <tt>Response</tt> to process
 */
public void processInviteOK(ClientTransaction clientTransaction,Response ok){
  try {
    getProtocolProvider().sendAck(clientTransaction);
  }
 catch (  InvalidArgumentException ex) {
    logAndFail("String_Node_Str",ex);
    return;
  }
catch (  SipException ex) {
    logAndFail("String_Node_Str",ex);
    return;
  }
  try {
    if (!CallPeerState.CONNECTING_WITH_EARLY_MEDIA.equals(getState())) {
      getMediaHandler().processAnswer(SdpUtils.getContentAsString(ok));
    }
  }
 catch (  Exception exc) {
    logger.error("String_Node_Str" + getDisplayName() + "String_Node_Str"+ getAddress()+ "String_Node_Str",exc);
    try {
      setState(CallPeerState.CONNECTED);
      hangup();
    }
 catch (    Exception e) {
    }
 finally {
      logAndFail("String_Node_Str",exc);
    }
    return;
  }
  if (!CallPeerState.isOnHold(getState())) {
    setState(CallPeerState.CONNECTED);
    if (isMute() != this.getCall().isMute())     setMute(this.getCall().isMute());
  }
  fireResponseProcessed(ok,null);
}

Fixed version (ground truth):
/** 
 * Sets our state to CONNECTED, sends an ACK and processes the SDP description in the <tt>ok</tt> <tt>Response</tt>.
 * @param clientTransaction the <tt>ClientTransaction</tt> that the responsearrived in.
 * @param ok the OK <tt>Response</tt> to process
 */
public void processInviteOK(ClientTransaction clientTransaction,Response ok){
  try {
    getProtocolProvider().sendAck(clientTransaction);
  }
 catch (  InvalidArgumentException ex) {
    logAndFail("String_Node_Str",ex);
    return;
  }
catch (  SipException ex) {
    logAndFail("String_Node_Str",ex);
    return;
  }
  try {
    if (!CallPeerState.CONNECTING_WITH_EARLY_MEDIA.equals(getState())) {
      getMediaHandler().processAnswer(SdpUtils.getContentAsString(ok));
    }
  }
 catch (  Exception exc) {
    logger.error("String_Node_Str" + getDisplayName() + "String_Node_Str"+ getAddress()+ "String_Node_Str",exc);
    try {
      setState(CallPeerState.CONNECTED);
      hangup();
    }
 catch (    Exception e) {
    }
 finally {
      logAndFail("String_Node_Str",exc);
    }
    return;
  }
  if (!CallPeerState.isOnHold(getState())) {
    setState(CallPeerState.CONNECTED);
    getMediaHandler().start();
    if (isMute() != this.getCall().isMute())     setMute(this.getCall().isMute());
  }
  fireResponseProcessed(ok,null);
}
Program: 103528
Project: 103528
Buggy source:
/** 
 * Updates the session description and sends the state of the corresponding call peer to CONNECTED.
 * @param serverTransaction the transaction that the ACK was received in.
 * @param ack the ACK <tt>Request</tt> we need to process
 */
public void processAck(ServerTransaction serverTransaction,Request ack){
  ContentLengthHeader contentLength=ack.getContentLength();
  if ((contentLength != null) && (contentLength.getContentLength() > 0)) {
    try {
      getMediaHandler().processAnswer(SdpUtils.getContentAsString(ack));
    }
 catch (    Exception exc) {
      logAndFail("String_Node_Str" + getDisplayName() + "String_Node_Str"+ getAddress()+ "String_Node_Str",exc);
      return;
    }
  }
  CallPeerState peerState=getState();
  if (!CallPeerState.isOnHold(peerState)) {
    setState(CallPeerState.CONNECTED);
    if (isMute() != this.getCall().isMute())     setMute(this.getCall().isMute());
  }
}

Fixed version (ground truth):
/** 
 * Updates the session description and sends the state of the corresponding call peer to CONNECTED.
 * @param serverTransaction the transaction that the ACK was received in.
 * @param ack the ACK <tt>Request</tt> we need to process
 */
public void processAck(ServerTransaction serverTransaction,Request ack){
  ContentLengthHeader contentLength=ack.getContentLength();
  if ((contentLength != null) && (contentLength.getContentLength() > 0)) {
    try {
      getMediaHandler().processAnswer(SdpUtils.getContentAsString(ack));
    }
 catch (    Exception exc) {
      logAndFail("String_Node_Str" + getDisplayName() + "String_Node_Str"+ getAddress()+ "String_Node_Str",exc);
      return;
    }
  }
  CallPeerState peerState=getState();
  if (!CallPeerState.isOnHold(peerState)) {
    setState(CallPeerState.CONNECTED);
    getMediaHandler().start();
    if (isMute() != this.getCall().isMute())     setMute(this.getCall().isMute());
  }
}
Program: 103529
Project: 103529
Buggy source:
/** 
 * Starts/stops the recording of the call when this button is pressed.
 * @param evt the <tt>ActionEvent</tt> that notified us of the action
 */
public void actionPerformed(ActionEvent evt){
  if (call != null) {
    if (isSelected()) {
      startRecording();
    }
 else     if (recorder != null) {
      try {
        recorder.stop();
        NotificationManager.fireNotification(NotificationManager.CALL_SAVED,resources.getI18NString("String_Node_Str"),resources.getI18NString("String_Node_Str",new String[]{callFilename}));
      }
  finally {
        recorder=null;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Starts/stops the recording of the call when this button is pressed.
 * @param evt the <tt>ActionEvent</tt> that notified us of the action
 */
public void actionPerformed(ActionEvent evt){
  if (call != null) {
    if (isSelected()) {
      boolean startedRecording=false;
      try {
        startedRecording=startRecording();
      }
  finally {
        if (!startedRecording && (recorder != null)) {
          try {
            recorder.stop();
          }
  finally {
            recorder=null;
          }
        }
        setSelected(startedRecording);
      }
    }
 else     if (recorder != null) {
      try {
        recorder.stop();
        NotificationManager.fireNotification(NotificationManager.CALL_SAVED,resources.getI18NString("String_Node_Str"),resources.getI18NString("String_Node_Str",new String[]{callFilename}));
      }
  finally {
        recorder=null;
        setSelected(false);
      }
    }
  }
}
Program: 103530
Project: 103530
Buggy source:
/** 
 * Initializes a new <tt>RecordButton</tt> instance which is to record the audio stream.
 * @param call the <tt>Call</tt> to be associated with the new instance andto have its audio stream recorded
 * @param fullScreen <tt>true</tt> if the new instance is to be used infull-screen UI; otherwise, <tt>false</tt>
 * @param selected <tt>true</tt> if the new toggle button is to be initiallyselected; otherwise, <tt>false</tt>
 */
public RecordButton(Call call,boolean fullScreen,boolean selected){
  super(call,fullScreen,selected,ImageLoader.RECORD_BUTTON,null);
  callFileChooser=GenericFileDialog.create(null,resources.getI18NString("String_Node_Str"),SipCommFileChooser.SAVE_FILE_OPERATION);
  callFileChooser.addFilter(new SipCommFileFilter(){
    public boolean accept(    File f){
      return f.isDirectory() || isSupportedFormat(f);
    }
    public String getDescription(){
      StringBuilder description=new StringBuilder();
      description.append("String_Node_Str");
      Recorder recorder;
      try {
        recorder=getRecorder();
      }
 catch (      OperationFailedException ofex) {
        logger.error("String_Node_Str",ofex);
        recorder=null;
      }
      if (recorder != null) {
        List<String> supportedFormats=recorder.getSupportedFormats();
        if (supportedFormats != null) {
          description.append("String_Node_Str");
          boolean firstSupportedFormat=true;
          for (          String supportedFormat : supportedFormats) {
            if (firstSupportedFormat)             firstSupportedFormat=false;
 else             description.append("String_Node_Str");
            description.append("String_Node_Str");
            description.append(supportedFormat);
          }
          description.append(')');
        }
      }
      return description.toString();
    }
  }
);
  String toolTip=resources.getI18NString("String_Node_Str");
  String saveDir=configuration.getString(Recorder.SAVED_CALLS_PATH);
  if ((saveDir != null) && (saveDir.length() != 0))   toolTip+="String_Node_Str" + saveDir + "String_Node_Str";
  setToolTipText(toolTip);
}

Fixed version (ground truth):
/** 
 * Initializes a new <tt>RecordButton</tt> instance which is to record the audio stream.
 * @param call the <tt>Call</tt> to be associated with the new instance andto have its audio stream recorded
 * @param fullScreen <tt>true</tt> if the new instance is to be used infull-screen UI; otherwise, <tt>false</tt>
 * @param selected <tt>true</tt> if the new toggle button is to be initiallyselected; otherwise, <tt>false</tt>
 */
public RecordButton(Call call,boolean fullScreen,boolean selected){
  super(call,fullScreen,selected,ImageLoader.RECORD_BUTTON,null);
  String toolTip=resources.getI18NString("String_Node_Str");
  String saveDir=configuration.getString(Recorder.SAVED_CALLS_PATH);
  if ((saveDir != null) && (saveDir.length() != 0))   toolTip+="String_Node_Str" + saveDir + "String_Node_Str";
  setToolTipText(toolTip);
}
Program: 103532
Project: 103532
Buggy source:
/** 
 * @return
 * @see AbstractCodec#getOutputFormat()
 */
@Override public Format getOutputFormat(){
  Format outputFormat=super.getOutputFormat();
  if ((outputFormat != null) && (outputFormat.getClass() == AudioFormat.class)) {
    AudioFormat outputAudioFormat=(AudioFormat)outputFormat;
    setOutputFormat(new AudioFormat(outputAudioFormat.getEncoding(),outputAudioFormat.getSampleRate(),outputAudioFormat.getSampleSizeInBits(),outputAudioFormat.getChannels(),outputAudioFormat.getEndian(),outputAudioFormat.getSigned(),outputAudioFormat.getFrameSizeInBits(),outputAudioFormat.getFrameRate(),outputAudioFormat.getDataType()){
      @Override public long computeDuration(      long length){
        return JNIEncoder.this.duration;
      }
    }
);
  }
  return outputFormat;
}

Fixed version (ground truth):
/** 
 * @return
 * @see net.sf.fmj.media.AbstractCodec#getOutputFormat()
 */
@Override public Format getOutputFormat(){
  Format outputFormat=super.getOutputFormat();
  if ((outputFormat != null) && (outputFormat.getClass() == AudioFormat.class)) {
    AudioFormat outputAudioFormat=(AudioFormat)outputFormat;
    setOutputFormat(new AudioFormat(outputAudioFormat.getEncoding(),outputAudioFormat.getSampleRate(),outputAudioFormat.getSampleSizeInBits(),outputAudioFormat.getChannels(),outputAudioFormat.getEndian(),outputAudioFormat.getSigned(),outputAudioFormat.getFrameSizeInBits(),outputAudioFormat.getFrameRate(),outputAudioFormat.getDataType()){
      @Override public long computeDuration(      long length){
        return JNIEncoder.this.duration;
      }
    }
);
  }
  return outputFormat;
}
Program: 103533
Project: 103533
Buggy source:
/** 
 * Initializes a new <tt>AudioMixer</tt> instance. Because JMF's <tt>Manager.createMergingDataSource(DataSource[])</tt> requires the implementation of <tt>CaptureDevice</tt> for audio if it is implemented for video and it is indeed the cause for our use case of <tt>AudioMixingPushBufferDataSource</tt>, the new <tt>AudioMixer</tt> instance provides specified <tt>CaptureDevice</tt> capabilities to the <tt>AudioMixingPushBufferDataSource</tt>s it creates. The specified <tt>CaptureDevice</tt> is also added as the first input <tt>DataSource</tt> of the new instance.
 * @param captureDevice the <tt>CaptureDevice</tt> capabilities to beprovided to the <tt>AudioMixingPushBufferDataSource</tt>s created by the new instance and its first input <tt>DataSource</tt>
 */
public AudioMixer(CaptureDevice captureDevice){
  if (captureDevice instanceof PullBufferDataSource)   captureDevice=new PushBufferDataSourceAdapter((PullBufferDataSource)captureDevice);
  if (logger.isTraceEnabled())   captureDevice=MediaDeviceImpl.createTracingCaptureDevice(captureDevice,logger);
  this.captureDevice=captureDevice;
  this.localOutputDataSource=createOutputDataSource();
  addInputDataSource((DataSource)this.captureDevice,this.localOutputDataSource);
}

Fixed version (ground truth):
/** 
 * Initializes a new <tt>AudioMixer</tt> instance. Because JMF's <tt>Manager.createMergingDataSource(DataSource[])</tt> requires the implementation of <tt>CaptureDevice</tt> for audio if it is implemented for video and it is indeed the cause for our use case of <tt>AudioMixingPushBufferDataSource</tt>, the new <tt>AudioMixer</tt> instance provides specified <tt>CaptureDevice</tt> capabilities to the <tt>AudioMixingPushBufferDataSource</tt>s it creates. The specified <tt>CaptureDevice</tt> is also added as the first input <tt>DataSource</tt> of the new instance.
 * @param captureDevice the <tt>CaptureDevice</tt> capabilities to beprovided to the <tt>AudioMixingPushBufferDataSource</tt>s created by the new instance and its first input <tt>DataSource</tt>
 */
public AudioMixer(CaptureDevice captureDevice){
  if (captureDevice instanceof PullBufferDataSource) {
    captureDevice=new PushBufferDataSourceAdapter((PullBufferDataSource)captureDevice);
  }
  if (logger.isTraceEnabled()) {
    captureDevice=MediaDeviceImpl.createTracingCaptureDevice(captureDevice,logger);
  }
  this.captureDevice=captureDevice;
  this.localOutputDataSource=createOutputDataSource();
  addInputDataSource((DataSource)this.captureDevice,this.localOutputDataSource);
}
Program: 103536
Project: 103536
Buggy source:
/** 
 * Starts the input <tt>DataSource</tt>s of this <tt>AudioMixer</tt>.
 * @param outputStream the <tt>AudioMixerPushBufferStream</tt> whichrequests this <tt>AudioMixer</tt> to start. If <tt>outputStream</tt> is the current one and only <tt>AudioMixerPushBufferStream</tt> of this <tt>AudioMixer</tt>, this <tt>AudioMixer</tt> starts if it hasn't started yet. Otherwise, the request is ignored.
 * @throws IOException if any of the input <tt>DataSource</tt>s of this<tt>AudioMixer</tt> throws such an exception while attempting to start it
 */
void start(AudioMixerPushBufferStream outputStream) throws IOException {
synchronized (inputDataSources) {
    if (this.outputStream != outputStream)     return;
    if (started == 0)     for (    InputDataSourceDesc inputDataSourceDesc : inputDataSources)     inputDataSourceDesc.start();
    started++;
  }
}

Fixed version (ground truth):
/** 
 * Starts the input <tt>DataSource</tt>s of this <tt>AudioMixer</tt>.
 * @param outputStream the <tt>AudioMixerPushBufferStream</tt> whichrequests this <tt>AudioMixer</tt> to start. If <tt>outputStream</tt> is the current one and only <tt>AudioMixerPushBufferStream</tt> of this <tt>AudioMixer</tt>, this <tt>AudioMixer</tt> starts if it hasn't started yet. Otherwise, the request is ignored.
 * @throws IOException if any of the input <tt>DataSource</tt>s of this<tt>AudioMixer</tt> throws such an exception while attempting to start it
 */
void start(AudioMixerPushBufferStream outputStream) throws IOException {
synchronized (inputDataSources) {
    if (this.outputStream != outputStream)     return;
    if (started == 0) {
      for (      InputDataSourceDesc inputDataSourceDesc : inputDataSources)       inputDataSourceDesc.start();
    }
    started++;
  }
}
Program: 103537
Project: 103537
Buggy source:
/** 
 * Stops the input <tt>DataSource</tt>s of this <tt>AudioMixer</tt>.
 * @param outputStream the <tt>AudioMixerPushBufferStream</tt> whichrequests this <tt>AudioMixer</tt> to stop. If <tt>outputStream</tt> is the current one and only <tt>AudioMixerPushBufferStream</tt> of this <tt>AudioMixer</tt>, this <tt>AudioMixer</tt> stops. Otherwise, the request is ignored.
 * @throws IOException if any of the input <tt>DataSource</tt>s of this<tt>AudioMixer</tt> throws such an exception while attempting to stop it
 */
void stop(AudioMixerPushBufferStream outputStream) throws IOException {
synchronized (inputDataSources) {
    if (this.outputStream != outputStream)     return;
    if (started <= 0)     return;
    started--;
    if (started == 0)     for (    InputDataSourceDesc inputDataSourceDesc : inputDataSources)     inputDataSourceDesc.stop();
  }
}

Fixed version (ground truth):
/** 
 * Stops the input <tt>DataSource</tt>s of this <tt>AudioMixer</tt>.
 * @param outputStream the <tt>AudioMixerPushBufferStream</tt> whichrequests this <tt>AudioMixer</tt> to stop. If <tt>outputStream</tt> is the current one and only <tt>AudioMixerPushBufferStream</tt> of this <tt>AudioMixer</tt>, this <tt>AudioMixer</tt> stops. Otherwise, the request is ignored.
 * @throws IOException if any of the input <tt>DataSource</tt>s of this<tt>AudioMixer</tt> throws such an exception while attempting to stop it
 */
void stop(AudioMixerPushBufferStream outputStream) throws IOException {
synchronized (inputDataSources) {
    if (this.outputStream != outputStream)     return;
    if (started <= 0)     return;
    started--;
    if (started == 0) {
      for (      InputDataSourceDesc inputDataSourceDesc : inputDataSources)       inputDataSourceDesc.stop();
    }
  }
}