nus-yam/ex-repair huggingface dataset:
Program: 103199
Project: 103199
Buggy source:
/** 
 * Creates an instance of <tt>LockServerConnectionProcessor</tt> that would handle parameters received through the <tt>connectionSocket</tt>.
 * @param connectionSocket the socket that we will be using to read arguments from the remote SIP Communicator instance.
 */
public LockServerConnectionProcessor(Socket connectionSocket){
  this.connectionSocket=connectionSocket;
}

Fixed version (ground truth):
/** 
 * Creates an instance of <tt>LockServerConnectionProcessor</tt> that would handle parameters received through the <tt>connectionSocket</tt>.
 * @param connectionSocket the socket that we will be using to read arguments from the remote Jitsi instance.
 */
public LockServerConnectionProcessor(Socket connectionSocket){
  this.connectionSocket=connectionSocket;
}
Program: 103200
Project: 103200
Buggy source:
/** 
 * Locks the configuration directory by binding our lock socket and recording the lock file into the configuration directory. Returns SUCCESS if everything goes well and ERROR if something fails. This method does not return the ALREADY_RUNNING code as it is assumed that this has already been checked before calling this method.
 * @param lockFile the file that we should use to lock the configuration directory.
 * @return the SUCCESS or ERROR codes defined by this class.
 */
private int lock(File lockFile){
  InetAddress lockAddress=getRandomBindAddress();
  if (lockAddress == null) {
    return LOCK_ERROR;
  }
  int port=getRandomPortNumber();
  InetSocketAddress serverSocketAddress=new InetSocketAddress(lockAddress,port);
  writeLockFile(lockFile,serverSocketAddress);
  startLockServer(serverSocketAddress);
  return SUCCESS;
}

Fixed version (ground truth):
/** 
 * Locks the configuration directory by binding our lock socket and recording the lock file into the configuration directory. Returns SUCCESS if everything goes well and ERROR if something fails. This method does not return the ALREADY_RUNNING code as it is assumed that this has already been checked before calling this method.
 * @param lockFile the file that we should use to lock the configuration directory.
 * @return the SUCCESS or ERROR codes defined by this class.
 */
private int lock(File lockFile){
  InetAddress lockAddress=getRandomBindAddress();
  if (lockAddress == null) {
    return LOCK_ERROR;
  }
  int retries=7;
  int port=getRandomPortNumber();
  InetSocketAddress serverSocketAddress;
  while (startLockServer(serverSocketAddress=new InetSocketAddress(lockAddress,port)) != SUCCESS && retries > 0) {
    port=getRandomPortNumber();
    retries--;
  }
  try {
    lockFile.getParentFile().mkdirs();
    lockFile.createNewFile();
  }
 catch (  IOException e) {
    logger.error("String_Node_Str" + lockFile,e);
  }
  lockFile.deleteOnExit();
  writeLockFile(lockFile,serverSocketAddress);
  return SUCCESS;
}
Program: 103201
Project: 103201
Buggy source:
/** 
 * Parses the <tt>lockFile</tt> into a standard Properties Object and verifies it for completeness. The method also tries to validate the contents of <tt>lockFile</tt> and asserts presence of all properties mandated by this version.
 * @param lockFile the file that we are to parse.
 * @return the <tt>SocketAddress</tt> that we should use to communicate witha possibly already running version of SIP Communicator.
 */
private InetSocketAddress readLockFile(File lockFile){
  Properties lockProperties=new Properties();
  try {
    lockProperties.load(new FileInputStream(lockFile));
  }
 catch (  Exception exc) {
    logger.error("String_Node_Str",exc);
    return null;
  }
  String lockAddressStr=lockProperties.getProperty(PNAME_LOCK_ADDRESS);
  if (lockAddressStr == null) {
    logger.error("String_Node_Str");
    return null;
  }
  String lockPort=lockProperties.getProperty(PNAME_LOCK_PORT);
  if (lockPort == null) {
    logger.error("String_Node_Str");
    return null;
  }
  InetAddress lockAddress=findLocalAddress(lockAddressStr);
  if (lockAddress == null) {
    logger.error(lockAddressStr + "String_Node_Str");
    return null;
  }
  int port;
  try {
    port=Integer.parseInt(lockPort);
  }
 catch (  NumberFormatException exc) {
    logger.error(lockPort + "String_Node_Str",exc);
    return null;
  }
  InetSocketAddress lockSocketAddress=new InetSocketAddress(lockAddress,port);
  return lockSocketAddress;
}

Fixed version (ground truth):
/** 
 * Parses the <tt>lockFile</tt> into a standard Properties Object and verifies it for completeness. The method also tries to validate the contents of <tt>lockFile</tt> and asserts presence of all properties mandated by this version.
 * @param lockFile the file that we are to parse.
 * @return the <tt>SocketAddress</tt> that we should use to communicate witha possibly already running version of Jitsi.
 */
private InetSocketAddress readLockFile(File lockFile){
  Properties lockProperties=new Properties();
  try {
    lockProperties.load(new FileInputStream(lockFile));
  }
 catch (  Exception exc) {
    logger.error("String_Node_Str",exc);
    return null;
  }
  String lockAddressStr=lockProperties.getProperty(PNAME_LOCK_ADDRESS);
  if (lockAddressStr == null) {
    logger.error("String_Node_Str");
    return null;
  }
  String lockPort=lockProperties.getProperty(PNAME_LOCK_PORT);
  if (lockPort == null) {
    logger.error("String_Node_Str");
    return null;
  }
  InetAddress lockAddress=findLocalAddress(lockAddressStr);
  if (lockAddress == null) {
    logger.error(lockAddressStr + "String_Node_Str");
    return null;
  }
  int port;
  try {
    port=Integer.parseInt(lockPort);
  }
 catch (  NumberFormatException exc) {
    logger.error(lockPort + "String_Node_Str",exc);
    return null;
  }
  InetSocketAddress lockSocketAddress=new InetSocketAddress(lockAddress,port);
  return lockSocketAddress;
}
Program: 103202
Project: 103202
Buggy source:
/** 
 * Returns a reference to the file that we should be using to lock SIP Communicator's home directory, whether it exists or not.
 * @return a reference to the file that we should be using to lock SIPCommunicator's home directory.
 */
private File getLockFile(){
  String homeDirLocation=System.getProperty(SIPCommunicator.PNAME_SC_HOME_DIR_LOCATION);
  String homeDirName=System.getProperty(SIPCommunicator.PNAME_SC_HOME_DIR_NAME);
  String fileSeparator=System.getProperty("String_Node_Str");
  String fullLockFileName=homeDirLocation + fileSeparator + homeDirName+ fileSeparator+ LOCK_FILE_NAME;
  return new File(fullLockFileName);
}

Fixed version (ground truth):
/** 
 * Returns a reference to the file that we should be using to lock Jitsi's home directory, whether it exists or not.
 * @return a reference to the file that we should be using to lock Jitsi'shome directory.
 */
private File getLockFile(){
  String homeDirLocation=System.getProperty(SIPCommunicator.PNAME_SC_HOME_DIR_LOCATION);
  String homeDirName=System.getProperty(SIPCommunicator.PNAME_SC_HOME_DIR_NAME);
  String fileSeparator=System.getProperty("String_Node_Str");
  String fullLockFileName=homeDirLocation + fileSeparator + homeDirName+ fileSeparator+ LOCK_FILE_NAME;
  return new File(fullLockFileName);
}
Program: 103204
Project: 103204
Buggy source:
/** 
 * {@inheritDoc}
 */
public void videoAdded(VideoEvent event){
  setVideoSecurityOn(isAudioSecurityOn);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void videoAdded(VideoEvent event){
  setVideoSecurityOn(isVideoSecurityOn);
}
Program: 103205
Project: 103205
Buggy source:
/** 
 * {@inheritDoc}
 */
public void videoRemoved(VideoEvent event){
  setVideoSecurityOn(isAudioSecurityOn);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void videoRemoved(VideoEvent event){
  setVideoSecurityOn(isVideoSecurityOn);
}
Program: 103206
Project: 103206
Buggy source:
/** 
 * {@inheritDoc}
 */
public void videoUpdate(VideoEvent event){
  setVideoSecurityOn(isAudioSecurityOn);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void videoUpdate(VideoEvent event){
  setVideoSecurityOn(isVideoSecurityOn);
}
Program: 103207
Project: 103207
Buggy source:
/** 
 * {@inheritDoc}
 */
public void propertyChange(final PropertyChangeEvent event){
  if (OperationSetVideoTelephony.LOCAL_VIDEO_STREAMING.equals(event.getPropertyName())) {
    setVideoSecurityOn(isAudioSecurityOn);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void propertyChange(final PropertyChangeEvent event){
  if (OperationSetVideoTelephony.LOCAL_VIDEO_STREAMING.equals(event.getPropertyName())) {
    setVideoSecurityOn(isVideoSecurityOn);
  }
}
Program: 103208
Project: 103208
Buggy source:
/** 
 * Handles the <tt>ActionEvent</tt>. In order to rename the contact invokes the <code>renameMetaContact</code> method of the current <tt>MetaContactListService</tt>.
 */
public void actionPerformed(ActionEvent e){
  JButton button=(JButton)e.getSource();
  String name=button.getName();
  if (name.equals("String_Node_Str")) {
    if (metaContact != null) {
      new Thread(){
        public void run(){
          clist.renameMetaContact(metaContact,renameContactPanel.getNewName());
        }
      }
.start();
    }
  }
 else   if (name.equals("String_Node_Str")) {
    clist.clearDisplayNameUserDefined(metaContact);
  }
  this.dispose();
}

Fixed version (ground truth):
/** 
 * Handles the <tt>ActionEvent</tt>. In order to rename the contact invokes the <code>renameMetaContact</code> method of the current <tt>MetaContactListService</tt>.
 */
public void actionPerformed(ActionEvent e){
  JButton button=(JButton)e.getSource();
  String name=button.getName();
  if (name.equals("String_Node_Str")) {
    if (metaContact != null) {
      new Thread(){
        public void run(){
          clist.renameMetaContact(metaContact,renameContactPanel.getNewName());
        }
      }
.start();
    }
  }
 else   if (name.equals("String_Node_Str")) {
    clist.clearUserDefinedDisplayName(metaContact);
  }
  this.dispose();
}
Program: 103210
Project: 103210
Buggy source:
/** 
 * Puts this peer into a   {@link CallPeerState#DISCONNECTED}, indicating a reason to the user, if there is one.
 * @param jingleIQ the {@link JingleIQ} that's terminating our session.
 */
public void processSessionTerminate(JingleIQ jingleIQ){
  String reasonStr="String_Node_Str";
  ReasonPacketExtension reasonExt=jingleIQ.getReason();
  if (reasonStr != null) {
    Reason reason=reasonExt.getReason();
    if (reason != null)     reasonStr+="String_Node_Str" + reason.toString() + "String_Node_Str";
    String text=reasonExt.getText();
    if (text != null)     reasonStr+="String_Node_Str" + text;
  }
  getMediaHandler().getTransportManager().close();
  setState(CallPeerState.DISCONNECTED,reasonStr);
}

Fixed version (ground truth):
/** 
 * Puts this peer into a   {@link CallPeerState#DISCONNECTED}, indicating a reason to the user, if there is one.
 * @param jingleIQ the {@link JingleIQ} that's terminating our session.
 */
public void processSessionTerminate(JingleIQ jingleIQ){
  String reasonStr="String_Node_Str";
  ReasonPacketExtension reasonExt=jingleIQ.getReason();
  if (reasonStr != null) {
    Reason reason=reasonExt.getReason();
    if (reason != null)     reasonStr+="String_Node_Str" + reason.toString() + "String_Node_Str";
    String text=reasonExt.getText();
    if (text != null)     reasonStr+="String_Node_Str" + text;
  }
  setState(CallPeerState.DISCONNECTED,reasonStr);
}
Program: 103212
Project: 103212
Buggy source:
/** 
 * Processes the session initiation   {@link JingleIQ} that we were createdwith, passing its content to the media handler and then sends either a "session-info/ringing" or a "session-terminate" response.
 * @param sessionInitIQ The {@link JingleIQ} that created the session thatwe are handling here.
 */
public void processSessionAccept(JingleIQ sessionInitIQ){
  this.sessionInitIQ=sessionInitIQ;
  CallPeerMediaHandlerJabberImpl mediaHandler=getMediaHandler();
  List<ContentPacketExtension> answer=sessionInitIQ.getContentList();
  try {
    mediaHandler.getTransportManager().wrapupConnectivityEstablishment();
    mediaHandler.processAnswer(answer);
  }
 catch (  Exception exc) {
    if (logger.isInfoEnabled())     logger.info("String_Node_Str",exc);
    JingleIQ errResp=JinglePacketFactory.createSessionTerminate(sessionInitIQ.getTo(),sessionInitIQ.getFrom(),sessionInitIQ.getSID(),Reason.INCOMPATIBLE_PARAMETERS,exc.getClass().getName() + "String_Node_Str" + exc.getMessage());
    getMediaHandler().getTransportManager().close();
    setState(CallPeerState.FAILED,"String_Node_Str" + exc.getMessage());
    getProtocolProvider().getConnection().sendPacket(errResp);
    return;
  }
  setState(CallPeerState.CONNECTED);
  mediaHandler.start();
}

Fixed version (ground truth):
/** 
 * Processes the session initiation   {@link JingleIQ} that we were createdwith, passing its content to the media handler and then sends either a "session-info/ringing" or a "session-terminate" response.
 * @param sessionInitIQ The {@link JingleIQ} that created the session thatwe are handling here.
 */
public void processSessionAccept(JingleIQ sessionInitIQ){
  this.sessionInitIQ=sessionInitIQ;
  CallPeerMediaHandlerJabberImpl mediaHandler=getMediaHandler();
  List<ContentPacketExtension> answer=sessionInitIQ.getContentList();
  try {
    mediaHandler.getTransportManager().wrapupConnectivityEstablishment();
    mediaHandler.processAnswer(answer);
  }
 catch (  Exception exc) {
    if (logger.isInfoEnabled())     logger.info("String_Node_Str",exc);
    JingleIQ errResp=JinglePacketFactory.createSessionTerminate(sessionInitIQ.getTo(),sessionInitIQ.getFrom(),sessionInitIQ.getSID(),Reason.INCOMPATIBLE_PARAMETERS,exc.getClass().getName() + "String_Node_Str" + exc.getMessage());
    setState(CallPeerState.FAILED,"String_Node_Str" + exc.getMessage());
    getProtocolProvider().getConnection().sendPacket(errResp);
    return;
  }
  setState(CallPeerState.CONNECTED);
  mediaHandler.start();
}
Program: 103213
Project: 103213
Buggy source:
/** 
 * Processes the <tt>transport-info</tt>   {@link JingleIQ}.
 * @param jingleIQ the <tt>transport-info</tt> {@link JingleIQ} to process
 */
public void processTransportInfo(JingleIQ jingleIQ){
  try {
    if (isInitiator) {
synchronized (sessionInitiateSyncRoot) {
        if (!sessionInitiateProcessed) {
          try {
            sessionInitiateSyncRoot.wait();
          }
 catch (          InterruptedException e) {
          }
        }
      }
    }
    getMediaHandler().processTransportInfo(jingleIQ.getContentList());
  }
 catch (  OperationFailedException ofe) {
    logger.warn("String_Node_Str",ofe);
    String reasonText="String_Node_Str" + ofe.getMessage();
    JingleIQ errResp=JinglePacketFactory.createSessionTerminate(sessionInitIQ.getTo(),sessionInitIQ.getFrom(),sessionInitIQ.getSID(),Reason.GENERAL_ERROR,reasonText);
    getMediaHandler().getTransportManager().close();
    setState(CallPeerState.FAILED,reasonText);
    getProtocolProvider().getConnection().sendPacket(errResp);
    return;
  }
synchronized (candSyncRoot) {
    candSyncRoot.notify();
  }
}

Fixed version (ground truth):
/** 
 * Processes the <tt>transport-info</tt>   {@link JingleIQ}.
 * @param jingleIQ the <tt>transport-info</tt> {@link JingleIQ} to process
 */
public void processTransportInfo(JingleIQ jingleIQ){
  try {
    if (isInitiator) {
synchronized (sessionInitiateSyncRoot) {
        if (!sessionInitiateProcessed) {
          try {
            sessionInitiateSyncRoot.wait();
          }
 catch (          InterruptedException e) {
          }
        }
      }
    }
    getMediaHandler().processTransportInfo(jingleIQ.getContentList());
  }
 catch (  OperationFailedException ofe) {
    logger.warn("String_Node_Str",ofe);
    String reasonText="String_Node_Str" + ofe.getMessage();
    JingleIQ errResp=JinglePacketFactory.createSessionTerminate(sessionInitIQ.getTo(),sessionInitIQ.getFrom(),sessionInitIQ.getSID(),Reason.GENERAL_ERROR,reasonText);
    setState(CallPeerState.FAILED,reasonText);
    getProtocolProvider().getConnection().sendPacket(errResp);
    return;
  }
synchronized (candSyncRoot) {
    candSyncRoot.notify();
  }
}
Program: 103214
Project: 103214
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);
  try {
    boolean modify=false;
    if (ext.getFirstChildOfType(RtpDescriptionPacketExtension.class) != null) {
      modify=true;
    }
    getMediaHandler().reinitContent(ext.getName(),ext,modify);
  }
 catch (  Exception exc) {
    logger.info("String_Node_Str",exc);
    JingleIQ errResp=JinglePacketFactory.createSessionTerminate(sessionInitIQ.getTo(),sessionInitIQ.getFrom(),sessionInitIQ.getSID(),Reason.INCOMPATIBLE_PARAMETERS,"String_Node_Str" + exc.getMessage());
    getMediaHandler().getTransportManager().close();
    setState(CallPeerState.FAILED,"String_Node_Str" + exc.getMessage());
    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);
  try {
    boolean modify=false;
    if (ext.getFirstChildOfType(RtpDescriptionPacketExtension.class) != null) {
      modify=true;
    }
    getMediaHandler().reinitContent(ext.getName(),ext,modify);
  }
 catch (  Exception exc) {
    logger.info("String_Node_Str",exc);
    JingleIQ errResp=JinglePacketFactory.createSessionTerminate(sessionInitIQ.getTo(),sessionInitIQ.getFrom(),sessionInitIQ.getSID(),Reason.INCOMPATIBLE_PARAMETERS,"String_Node_Str" + exc.getMessage());
    setState(CallPeerState.FAILED,"String_Node_Str" + exc.getMessage());
    getProtocolProvider().getConnection().sendPacket(errResp);
    return;
  }
}
Program: 103215
Project: 103215
Buggy source:
/** 
 * Processes the content-accept   {@link JingleIQ}.
 * @param content The {@link JingleIQ} that contains content that remotepeer has accepted
 */
public void processContentAccept(JingleIQ content){
  List<ContentPacketExtension> contents=content.getContentList();
  try {
    getMediaHandler().getTransportManager().wrapupConnectivityEstablishment();
    getMediaHandler().processAnswer(contents);
  }
 catch (  Exception exc) {
    logger.warn("String_Node_Str",exc);
    JingleIQ errResp=JinglePacketFactory.createSessionTerminate(sessionInitIQ.getTo(),sessionInitIQ.getFrom(),sessionInitIQ.getSID(),Reason.INCOMPATIBLE_PARAMETERS,"String_Node_Str" + exc.getMessage());
    getMediaHandler().getTransportManager().close();
    setState(CallPeerState.FAILED,"String_Node_Str" + exc.getMessage());
    getProtocolProvider().getConnection().sendPacket(errResp);
    return;
  }
  getMediaHandler().start();
}

Fixed version (ground truth):
/** 
 * Processes the content-accept   {@link JingleIQ}.
 * @param content The {@link JingleIQ} that contains content that remotepeer has accepted
 */
public void processContentAccept(JingleIQ content){
  List<ContentPacketExtension> contents=content.getContentList();
  try {
    getMediaHandler().getTransportManager().wrapupConnectivityEstablishment();
    getMediaHandler().processAnswer(contents);
  }
 catch (  Exception exc) {
    logger.warn("String_Node_Str",exc);
    JingleIQ errResp=JinglePacketFactory.createSessionTerminate(sessionInitIQ.getTo(),sessionInitIQ.getFrom(),sessionInitIQ.getSID(),Reason.INCOMPATIBLE_PARAMETERS,"String_Node_Str" + exc.getMessage());
    setState(CallPeerState.FAILED,"String_Node_Str" + exc.getMessage());
    getProtocolProvider().getConnection().sendPacket(errResp);
    return;
  }
  getMediaHandler().start();
}
Program: 103217
Project: 103217
Buggy source:
/** 
 * Processes the content-reject   {@link JingleIQ}.
 * @param content The {@link JingleIQ}
 */
public void processContentReject(JingleIQ content){
  if (content.getContentList().isEmpty()) {
    JingleIQ errResp=JinglePacketFactory.createSessionTerminate(sessionInitIQ.getTo(),sessionInitIQ.getFrom(),sessionInitIQ.getSID(),Reason.INCOMPATIBLE_PARAMETERS,"String_Node_Str");
    getMediaHandler().getTransportManager().close();
    setState(CallPeerState.FAILED,"String_Node_Str");
    getProtocolProvider().getConnection().sendPacket(errResp);
    return;
  }
}

Fixed version (ground truth):
/** 
 * Processes the content-reject   {@link JingleIQ}.
 * @param content The {@link JingleIQ}
 */
public void processContentReject(JingleIQ content){
  if (content.getContentList().isEmpty()) {
    JingleIQ errResp=JinglePacketFactory.createSessionTerminate(sessionInitIQ.getTo(),sessionInitIQ.getFrom(),sessionInitIQ.getSID(),Reason.INCOMPATIBLE_PARAMETERS,"String_Node_Str");
    setState(CallPeerState.FAILED,"String_Node_Str");
    getProtocolProvider().getConnection().sendPacket(errResp);
    return;
  }
}
Program: 103218
Project: 103218
Buggy source:
/** 
 * Notified when a call are added to a <tt>CallGroup</tt>.
 * @param evt event
 */
public void callAdded(CallGroupEvent evt){
  Iterator<CallPeerJabberImpl> peers=getCallPeers();
  while (peers.hasNext()) {
    setConferenceFocus(true);
    CallPeerJabberImpl callPeer=peers.next();
    callPeer.sendCoinSessionInfo(true);
  }
  super.callAdded(evt);
}

Fixed version (ground truth):
/** 
 * Notified when a call are added to a <tt>CallGroup</tt>.
 * @param evt event
 */
public void callAdded(CallGroupEvent evt){
  Iterator<CallPeerJabberImpl> peers=getCallPeers();
  while (peers.hasNext()) {
    setConferenceFocus(true);
    CallPeerJabberImpl callPeer=peers.next();
    if (callPeer.getState() == CallPeerState.CONNECTED)     callPeer.sendCoinSessionInfo(true);
  }
  super.callAdded(evt);
}
Program: 103219
Project: 103219
Buggy source:
/** 
 * Notified when a call are added to a <tt>CallGroup</tt>.
 * @param evt event
 */
public void callAdded(CallGroupEvent evt){
  Iterator<CallPeerSipImpl> peers=getCallPeers();
  while (peers.hasNext()) {
    setConferenceFocus(true);
    CallPeerSipImpl callPeer=peers.next();
    try {
      if (callPeer.getDialog() != null && callPeer.getDialog().getState() == DialogState.CONFIRMED)       callPeer.sendReInvite();
    }
 catch (    OperationFailedException e) {
      logger.info("String_Node_Str" + callPeer.getAddress());
    }
  }
  super.callAdded(evt);
}

Fixed version (ground truth):
/** 
 * Notified when a call are added to a <tt>CallGroup</tt>.
 * @param evt event
 */
public void callAdded(CallGroupEvent evt){
  Iterator<CallPeerSipImpl> peers=getCallPeers();
  setConferenceFocus(true);
  while (peers.hasNext()) {
    CallPeerSipImpl callPeer=peers.next();
    try {
      if (callPeer.getState() == CallPeerState.CONNECTED)       callPeer.sendReInvite();
    }
 catch (    OperationFailedException e) {
      logger.info("String_Node_Str" + callPeer.getAddress());
    }
  }
  super.callAdded(evt);
}
Program: 103221
Project: 103221
Buggy source:
/** 
 * Notified when a call is removed from a <tt>CallGroup</tt>.
 * @param evt event
 */
public void callRemoved(CallGroupEvent evt){
  Call c=evt.getSourceCall();
  c.removeCallChangeListener(this);
  Iterator<? extends CallPeer> peers=c.getCallPeers();
  while (peers.hasNext()) {
    CallPeer p=peers.next();
    getCrossProtocolCallPeersVector().remove(p);
    fireCallPeerEvent(p,CallPeerEvent.CALL_PEER_REMOVED);
  }
}

Fixed version (ground truth):
/** 
 * Notified when a call is removed from a <tt>CallGroup</tt>.
 * @param evt event
 */
public void callRemoved(CallGroupEvent evt){
  Call c=evt.getSourceCall();
  c.removeCallChangeListener(this);
  Iterator<? extends CallPeer> peers=c.getCallPeers();
  while (peers.hasNext()) {
    CallPeer p=peers.next();
    getCrossProtocolCallPeersVector().remove(p);
    fireCallPeerEvent(p,CallPeerEvent.CALL_PEER_REMOVED);
  }
  if ((getCallPeerCount() + getCallGroup().getCalls().size()) < 2)   setConferenceFocus(false);
}
Program: 103222
Project: 103222
Buggy source:
/** 
 * Sets the indicator which determines whether the local peer represented by this <tt>Call</tt> is acting as a conference focus and thus may need to send the corresponding parameters in its outgoing signaling.
 * @param conferenceFocus <tt>true</tt> if the local peer represented bythis <tt>Call</tt> is to act as a conference focus; otherwise, <tt>false</tt>
 */
public void setConferenceFocus(boolean conferenceFocus){
  if (this.conferenceFocus != conferenceFocus) {
    this.conferenceFocus=conferenceFocus;
    if (!this.conferenceFocus) {
      conferenceAudioMixer=null;
      conferenceVideoMixer=null;
      if (videoRTPTranslator != null) {
        videoRTPTranslator.dispose();
        videoRTPTranslator=null;
      }
    }
    fireCallChangeEvent(CallChangeEvent.CALL_FOCUS_CHANGE,!this.conferenceFocus,this.conferenceFocus);
  }
}

Fixed version (ground truth):
/** 
 * Sets the indicator which determines whether the local peer represented by this <tt>Call</tt> is acting as a conference focus and thus may need to send the corresponding parameters in its outgoing signaling.
 * @param conferenceFocus <tt>true</tt> if the local peer represented bythis <tt>Call</tt> is to act as a conference focus; otherwise, <tt>false</tt>
 */
public synchronized void setConferenceFocus(boolean conferenceFocus){
  if (this.conferenceFocus != conferenceFocus) {
    this.conferenceFocus=conferenceFocus;
    if (!this.conferenceFocus) {
      conferenceAudioMixer=null;
      conferenceVideoMixer=null;
      if (videoRTPTranslator != null) {
        videoRTPTranslator.dispose();
        videoRTPTranslator=null;
      }
    }
    fireCallChangeEvent(CallChangeEvent.CALL_FOCUS_CHANGE,!this.conferenceFocus,this.conferenceFocus);
  }
}
Program: 103223
Project: 103223
Buggy source:
/** 
 * Sets the view of this JViewport.
 * @param view the view to set.
 */
public void setViewportView(JComponent view){
  view.setBorder(BorderFactory.createEmptyBorder(3,3,3,3));
  view.setOpaque(false);
  super.setViewportView(view);
}

Fixed version (ground truth):
/** 
 * Sets the view of this JViewport.
 * @param view the view to set.
 */
@Override public void setViewportView(Component view){
  if (view instanceof JComponent) {
    JComponent viewAsJComponent=(JComponent)view;
    viewAsJComponent.setBorder(BorderFactory.createEmptyBorder(3,3,3,3));
    viewAsJComponent.setOpaque(false);
  }
  super.setViewportView(view);
}
Program: 103224
Project: 103224
Buggy source:
/** 
 * Paints this viewport.
 * @param g the <tt>Graphics</tt> object used for painting
 */
public void paintComponent(Graphics g){
  super.paintComponent(g);
  g=g.create();
  try {
    AntialiasingManager.activateAntialiasing(g);
    Graphics2D g2=(Graphics2D)g;
    int width=getWidth();
    int height=getHeight();
    if (bgImage != null) {
      if (texture != null) {
        g2.setPaint(texture);
        g2.fillRect(0,0,width,height);
      }
 else {
        g.setColor(color);
        g.fillRect(0,0,width,height);
        g2.drawImage(bgImage,width - bgImage.getWidth(),height - bgImage.getHeight(),this);
      }
    }
  }
  finally {
    g.dispose();
  }
}

Fixed version (ground truth):
/** 
 * Paints this viewport.
 * @param g the <tt>Graphics</tt> object used for painting
 */
@Override public void paintComponent(Graphics g){
  super.paintComponent(g);
  g=g.create();
  try {
    AntialiasingManager.activateAntialiasing(g);
    Graphics2D g2=(Graphics2D)g;
    int width=getWidth();
    int height=getHeight();
    if (bgImage != null) {
      if (texture != null) {
        g2.setPaint(texture);
        g2.fillRect(0,0,width,height);
      }
 else {
        g.setColor(color);
        g.fillRect(0,0,width,height);
        g2.drawImage(bgImage,width - bgImage.getWidth(),height - bgImage.getHeight(),this);
      }
    }
  }
  finally {
    g.dispose();
  }
}
Program: 103225
Project: 103225
Buggy source:
/** 
 * Returns the boolean value of the property given by <tt>key</tt>.
 * @param key the key of the property we look for
 * @return the boolean value of the searched property
 */
private boolean getSettingsBoolean(String key){
  return new Boolean(GuiActivator.getResources().getSettingsString(key)).booleanValue();
}

Fixed version (ground truth):
/** 
 * Returns the boolean value of the property given by <tt>key</tt>.
 * @param key the key of the property we look for
 * @return the boolean value of the searched property
 */
private boolean getSettingsBoolean(String key){
  return Boolean.parseBoolean(GuiActivator.getResources().getSettingsString(key));
}
Program: 103226
Project: 103226
Buggy source:
/** 
 * Update the sound level indicator component to fit the given values.
 * @param soundLevel the sound level to show
 */
public void updateSoundLevel(int soundLevel){
  int range=1;
  if ((minSoundLevel > -1) && (maxSoundLevel > -1) && (minSoundLevel < maxSoundLevel)) {
    range=maxSoundLevel - minSoundLevel;
    if (soundLevel < 40)     soundLevel=minSoundLevel;
 else     if (soundLevel > 85)     soundLevel=maxSoundLevel;
 else {
      soundLevel=(int)(((soundLevel - 40.0) / 45.0) * range);
      if (soundLevel < minSoundLevel)       soundLevel=minSoundLevel;
 else       if (soundLevel > maxSoundLevel)       soundLevel=maxSoundLevel;
    }
  }
  this.soundLevel=(int)(this.soundLevel * 0.8 + soundLevel * 0.2);
  int activeBarNumber=Math.round(this.soundLevel * soundBarNumber / (float)range);
  for (int i=0, count=getComponentCount(); i < count; i++) {
    Component c=getComponent(i);
    if (c instanceof JLabel) {
      ((JLabel)c).setIcon((i < activeBarNumber) ? soundLevelActiveImage : soundLevelInactiveImage);
    }
  }
  this.repaint();
}

Fixed version (ground truth):
/** 
 * Update the sound level indicator component to fit the given values.
 * @param soundLevel the sound level to show
 */
public void updateSoundLevel(int soundLevel){
  int range=1;
  if ((minSoundLevel > -1) && (maxSoundLevel > -1) && (minSoundLevel < maxSoundLevel)) {
    range=maxSoundLevel - minSoundLevel;
    if (soundLevel < 40)     soundLevel=minSoundLevel;
 else     if (soundLevel > 85)     soundLevel=maxSoundLevel;
 else {
      soundLevel=(int)(((soundLevel - 40.0) / 45.0) * range);
      if (soundLevel < minSoundLevel)       soundLevel=minSoundLevel;
 else       if (soundLevel > maxSoundLevel)       soundLevel=maxSoundLevel;
    }
  }
  this.soundLevel=(int)(this.soundLevel * 0.8 + soundLevel * 0.2);
  int activeBarNumber=Math.round(this.soundLevel * soundBarNumber / (float)range);
  Component[] components=getComponents();
  for (int i=0; i < components.length; i++) {
    Component c=getComponent(i);
    if (c instanceof JLabel) {
      ((JLabel)c).setIcon((i < activeBarNumber) ? soundLevelActiveImage : soundLevelInactiveImage);
    }
  }
  this.repaint();
}
Program: 103227
Project: 103227
Buggy source:
/** 
 * Passes the message to the contained <code>ChatConversationPanel</code> for processing and appends it at the end of the conversationPanel document.
 * @param chatMessage the message to append
 */
private void appendChatMessage(ChatMessage chatMessage){
  String processedMessage=this.conversationPanel.processMessage(chatMessage);
  if (chatSession instanceof ConferenceChatSession) {
    if (chatMessage.getMessageType().equals(Chat.INCOMING_MESSAGE)) {
      String keyWord=((ChatRoomWrapper)chatSession.getDescriptor()).getChatRoom().getUserNickname();
      processedMessage=this.conversationPanel.processChatRoomHighlight(processedMessage,chatMessage.getContentType(),keyWord);
    }
    String meCommandMsg=this.conversationPanel.processMeCommand(chatMessage);
    if (meCommandMsg.length() > 0) {
      processedMessage=meCommandMsg;
    }
  }
  this.conversationPanel.appendMessageToEnd(processedMessage,chatMessage.getContentType());
}

Fixed version (ground truth):
/** 
 * Passes the message to the contained <code>ChatConversationPanel</code> for processing and appends it at the end of the conversationPanel document.
 * @param chatMessage the message to append
 */
private void appendChatMessage(ChatMessage chatMessage){
  String processedMessage=this.conversationPanel.processMessage(chatMessage);
  if (chatSession instanceof ConferenceChatSession) {
    if (chatMessage.getMessageType().equals(Chat.INCOMING_MESSAGE)) {
      String keyWord=((ChatRoomWrapper)chatSession.getDescriptor()).getChatRoom().getUserNickname();
      processedMessage=this.conversationPanel.processChatRoomHighlight(processedMessage,chatMessage.getContentType(),keyWord);
    }
    String meCommandMsg=this.conversationPanel.processMeCommand(chatMessage);
    if (meCommandMsg.length() > 0)     processedMessage=meCommandMsg;
  }
  this.conversationPanel.appendMessageToEnd(processedMessage,chatMessage.getContentType());
}
Program: 103228
Project: 103228
Buggy source:
/** 
 * Copies either the selected write area content or the selected conversation panel content to the clipboard.
 */
public void copy(){
  JTextComponent textPane=this.conversationPanel.getChatTextPane();
  if (textPane.getSelectedText() == null) {
    textPane=this.writeMessagePanel.getEditorPane();
  }
  textPane.copy();
}

Fixed version (ground truth):
/** 
 * Copies either the selected write area content or the selected conversation panel content to the clipboard.
 */
public void copy(){
  JTextComponent textPane=this.conversationPanel.getChatTextPane();
  if (textPane.getSelectedText() == null)   textPane=this.writeMessagePanel.getEditorPane();
  textPane.copy();
}
Program: 103229
Project: 103229
Buggy source:
/** 
 * Notifies the user if any member of the chatroom changes nickname
 */
public void chatRoomPropertyChanged(ChatRoomMemberPropertyChangeEvent event){
  this.conversationPanel.appendMessageToEnd("String_Node_Str" + event.getOldValue() + "String_Node_Str"+ event.getNewValue()+ "String_Node_Str",ChatConversationPanel.HTML_CONTENT_TYPE);
}

Fixed version (ground truth):
/** 
 * Notifies the user if any member of the chatroom changes nickname.
 * @param event a <tt>ChatRoomMemberPropertyChangeEvent</tt> which carriesthe specific of the change
 */
public void chatRoomPropertyChanged(ChatRoomMemberPropertyChangeEvent event){
  this.conversationPanel.appendMessageToEnd("String_Node_Str" + event.getOldValue() + "String_Node_Str"+ event.getNewValue()+ "String_Node_Str",ChatConversationPanel.HTML_CONTENT_TYPE);
}
Program: 103230
Project: 103230
Buggy source:
/** 
 * Passes the message to the contained <code>ChatConversationPanel</code> for processing.
 * @param contactName The name of the contact sending the message.
 * @param date The time at which the message is sent or received.
 * @param messageType The type of the message. One of OUTGOING_MESSAGEor INCOMING_MESSAGE.
 * @param message The message text.
 * @param contentType the content type of the message (html or plain text)
 * @return a string containing the processed message.
 */
private String processHistoryMessage(String contactName,String contactDisplayName,long date,String messageType,String message,String contentType){
  ChatMessage chatMessage=new ChatMessage(contactName,contactDisplayName,date,messageType,null,message,contentType);
  String processedMessage=this.conversationPanel.processMessage(chatMessage);
  if (chatSession instanceof ConferenceChatSession) {
    String tempMessage=conversationPanel.processMeCommand(chatMessage);
    if (tempMessage.length() > 0) {
      processedMessage=tempMessage;
    }
  }
  return processedMessage;
}

Fixed version (ground truth):
/** 
 * Passes the message to the contained <code>ChatConversationPanel</code> for processing.
 * @param contactName The name of the contact sending the message.
 * @param contactDisplayName the display name of the contact sending themessage
 * @param date The time at which the message is sent or received.
 * @param messageType The type of the message. One of OUTGOING_MESSAGEor INCOMING_MESSAGE.
 * @param message The message text.
 * @param contentType the content type of the message (html or plain text)
 * @return a string containing the processed message.
 */
private String processHistoryMessage(String contactName,String contactDisplayName,long date,String messageType,String message,String contentType){
  ChatMessage chatMessage=new ChatMessage(contactName,contactDisplayName,date,messageType,null,message,contentType);
  String processedMessage=this.conversationPanel.processMessage(chatMessage);
  if (chatSession instanceof ConferenceChatSession) {
    String tempMessage=conversationPanel.processMeCommand(chatMessage);
    if (tempMessage.length() > 0)     processedMessage=tempMessage;
  }
  return processedMessage;
}
Program: 103231
Project: 103231
Buggy source:
/** 
 * @param chatTransport Currently unused
 */
public SmsMessageListener(ChatTransport chatTransport){
}

Fixed version (ground truth):
/** 
 * Initializes a new <tt>SmsMessageListener</tt> instance.
 * @param chatTransport Currently unused
 */
public SmsMessageListener(ChatTransport chatTransport){
}
Program: 103232
Project: 103232
Buggy source:
/** 
 * Interrupts transmission of a <tt>DTMFTone</tt> started with the <tt>startSendingDTMF()</tt> method. Has no effect if no tone is currently being sent.
 * @param dtmfMethod The kind of DTMF used (RTP, SIP-INOF or INBAND).
 * @see AudioMediaStream#stopSendingDTMF(DTMFEnum)
 */
public void stopSendingDTMF(DTMFEnum dtmfMethod){
switch (dtmfMethod) {
case RTP_DTMF:
    if (dtmfTransfrmEngine != null) {
      dtmfTransfrmEngine.stopSendingDTMF();
    }
  break;
case SIP_INFO_DTMF:
break;
case INBAND_DTMF:
break;
}
}

Fixed version (ground truth):
/** 
 * Interrupts transmission of a <tt>DTMFTone</tt> started with the <tt>startSendingDTMF()</tt> method. Has no effect if no tone is currently being sent.
 * @param dtmfMethod The kind of DTMF used (RTP, SIP-INOF or INBAND).
 * @see AudioMediaStream#stopSendingDTMF(DTMFMethod)
 */
public void stopSendingDTMF(DTMFMethod dtmfMethod){
switch (dtmfMethod) {
case RTP_DTMF:
    if (dtmfTransfrmEngine != null) {
      dtmfTransfrmEngine.stopSendingDTMF();
    }
  break;
case SIP_INFO_DTMF:
break;
case INBAND_DTMF:
break;
}
}
Program: 103233
Project: 103233
Buggy source:
/** 
 * Starts sending the specified <tt>DTMFTone</tt> until the <tt>stopSendingDTMF()</tt> method is called (Excepts for INBAND DTMF, which stops by itself this is why where there is no need to call the stopSendingDTMF). Callers should keep in mind the fact that calling this method would most likely interrupt all audio transmission until the corresponding stop method is called. Also, calling this method successively without invoking the corresponding stop method between the calls will simply replace the <tt>DTMFTone</tt> from the first call with that from the second.
 * @param tone the <tt>DTMFTone</tt> to start sending.
 * @param dtmfMethod The kind of DTMF used (RTP, SIP-INOF or INBAND).
 * @see AudioMediaStream#startSendingDTMF(DTMFTone,DTMFEnum)
 */
public void startSendingDTMF(DTMFTone tone,DTMFEnum dtmfMethod){
switch (dtmfMethod) {
case RTP_DTMF:
    if (dtmfTransfrmEngine != null) {
      DTMFRtpTone t=DTMFRtpTone.mapTone(tone);
      if (t != null) {
        dtmfTransfrmEngine.startSending(t);
      }
    }
  break;
case SIP_INFO_DTMF:
break;
case INBAND_DTMF:
MediaDeviceSession deviceSession=getDeviceSession();
if (deviceSession != null) {
deviceSession.addDTMF(DTMFInbandTone.mapTone(tone));
}
break;
}
}

Fixed version (ground truth):
/** 
 * Starts sending the specified <tt>DTMFTone</tt> until the <tt>stopSendingDTMF()</tt> method is called (Excepts for INBAND DTMF, which stops by itself this is why where there is no need to call the stopSendingDTMF). Callers should keep in mind the fact that calling this method would most likely interrupt all audio transmission until the corresponding stop method is called. Also, calling this method successively without invoking the corresponding stop method between the calls will simply replace the <tt>DTMFTone</tt> from the first call with that from the second.
 * @param tone the <tt>DTMFTone</tt> to start sending.
 * @param dtmfMethod The kind of DTMF used (RTP, SIP-INOF or INBAND).
 * @see AudioMediaStream#startSendingDTMF(DTMFTone,DTMFMethod)
 */
public void startSendingDTMF(DTMFTone tone,DTMFMethod dtmfMethod){
switch (dtmfMethod) {
case RTP_DTMF:
    if (dtmfTransfrmEngine != null) {
      DTMFRtpTone t=DTMFRtpTone.mapTone(tone);
      if (t != null) {
        dtmfTransfrmEngine.startSending(t);
      }
    }
  break;
case SIP_INFO_DTMF:
break;
case INBAND_DTMF:
MediaDeviceSession deviceSession=getDeviceSession();
if (deviceSession != null) {
deviceSession.addDTMF(DTMFInbandTone.mapTone(tone));
}
break;
}
}
Program: 103235
Project: 103235
Buggy source:
/** 
 * Stops this <tt>MediaService</tt> implementation and thus signals that its utilization should cease.
 */
void stop(){
  PortAudio.removeDeviceChangedCallback(this);
}

Fixed version (ground truth):
/** 
 * Stops this <tt>MediaService</tt> implementation and thus signals that its utilization should cease.
 */
void stop(){
  deviceConfiguration.removePropertyChangeListener(deviceConfigurationPropertyChangeListener);
  PortAudio.removeDeviceChangedCallback(this);
}
Program: 103236
Project: 103236
Buggy source:
public void run(){
  JScrollBar verticalScrollBar=getVerticalScrollBar();
  if (verticalScrollBar != null)   verticalScrollBar.setValue(verticalScrollBar.getMaximum());
}

Fixed version (ground truth):
public void run(){
  JScrollBar verticalScrollBar=getVerticalScrollBar();
  if (verticalScrollBar != null) {
    verticalScrollBar.setValue(verticalScrollBar.getMaximum());
    chatTextPane.setCaretPosition(document.getLength());
  }
}
Program: 103237
Project: 103237
Buggy source:
/** 
 * When a right button click is performed in the editor pane, a popup menu is opened.
 * @param e The MouseEvent.
 */
public void mouseClicked(MouseEvent e){
  Point p=e.getPoint();
  SwingUtilities.convertPointToScreen(p,e.getComponent());
  if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0 || (e.isControlDown() && !e.isMetaDown())) {
    openContextMenu(p);
  }
 else   if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0 && currentHref != null && currentHref.length() != 0) {
    GuiActivator.getBrowserLauncher().openURL(currentHref);
  }
}

Fixed version (ground truth):
/** 
 * When a right button click is performed in the editor pane, a popup menu is opened.
 * @param e The MouseEvent.
 */
public void mouseClicked(MouseEvent e){
  Point p=e.getPoint();
  SwingUtilities.convertPointToScreen(p,e.getComponent());
  if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0 || (e.isControlDown() && !e.isMetaDown())) {
    openContextMenu(p);
  }
 else   if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0 && currentHref != null && currentHref.length() != 0) {
    GuiActivator.getBrowserLauncher().openURL(currentHref);
    this.currentHref="String_Node_Str";
  }
}
Program: 103238
Project: 103238
Buggy source:
public void removeUpdate(DocumentEvent event){
  if (!this.isEnabled)   return;
  try {
    Document doc=event.getDocument();
    String text=doc.getText(0,doc.getLength());
    if (text.length() != 0) {
      Word changed;
      if (event.getOffset() == 0 || !Character.isLetter(text.charAt(event.getOffset() - 1))) {
        changed=Word.getWord(text,event.getOffset(),false);
      }
 else {
        changed=Word.getWord(text,event.getOffset() - 1,true);
      }
      format(changed);
    }
    promptRepaint();
  }
 catch (  BadLocationException exc) {
    String msg="String_Node_Str";
    logger.error(msg,exc);
  }
}

Fixed version (ground truth):
public void removeUpdate(DocumentEvent event){
  if (!this.isEnabled)   return;
  try {
    Document doc=event.getDocument();
    String text=doc.getText(0,doc.getLength());
    if (text.length() != 0) {
      Word changed;
      if (event.getOffset() == 0 || !Character.isLetter(text.charAt(event.getOffset() - 1))) {
        changed=Word.getWord(text,event.getOffset(),false);
      }
 else {
        changed=Word.getWord(text,event.getOffset() - 1,true);
      }
      format(changed);
    }
    promptRepaint();
  }
 catch (  BadLocationException exc) {
    String msg="String_Node_Str";
    logger.error(msg,exc);
  }
catch (  Throwable exc) {
    logger.error("String_Node_Str",exc);
  }
}
Program: 103240
Project: 103240
Buggy source:
/** 
 * Handles changes in the state of a <code>Call</code> this policy applies to in order to detect when new calls become in-progress and when the other calls should be put on hold.
 * @param callChangeEvent a <code>CallChangeEvent</code> value which describes the <code>Call</code> and the change in its state
 */
private void callStateChanged(CallChangeEvent callChangeEvent){
  Call call=callChangeEvent.getSourceCall();
  if (CallState.CALL_INITIALIZATION.equals(callChangeEvent.getOldValue()) && CallState.CALL_IN_PROGRESS.equals(call.getCallState()) && ProtocolProviderActivator.getConfigurationService().getBoolean(PNAME_SINGLE_CALL_IN_PROGRESS_POLICY_ENABLED,true)) {
synchronized (calls) {
      for (      Call otherCall : calls) {
        if (!call.equals(otherCall) && CallState.CALL_IN_PROGRESS.equals(otherCall.getCallState())) {
          if ((call.getCallGroup() != null || otherCall.getCallGroup() != null) && call.getCallGroup() != otherCall.getCallGroup())           putOnHold(otherCall);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Handles changes in the state of a <code>Call</code> this policy applies to in order to detect when new calls become in-progress and when the other calls should be put on hold.
 * @param callChangeEvent a <code>CallChangeEvent</code> value which describes the <code>Call</code> and the change in its state
 */
private void callStateChanged(CallChangeEvent callChangeEvent){
  Call call=callChangeEvent.getSourceCall();
  if (CallState.CALL_INITIALIZATION.equals(callChangeEvent.getOldValue()) && CallState.CALL_IN_PROGRESS.equals(call.getCallState()) && ProtocolProviderActivator.getConfigurationService().getBoolean(PNAME_SINGLE_CALL_IN_PROGRESS_POLICY_ENABLED,true)) {
synchronized (calls) {
      for (      Call otherCall : calls) {
        if (!call.equals(otherCall) && CallState.CALL_IN_PROGRESS.equals(otherCall.getCallState())) {
          if ((call.getCallGroup() == null && otherCall.getCallGroup() == null) || (call.getCallGroup() != null || otherCall.getCallGroup() != null) && call.getCallGroup() != otherCall.getCallGroup())           putOnHold(otherCall);
        }
      }
    }
  }
}