nus-yam/ex-repair huggingface dataset:
Program: 103154
Project: 103154
Buggy source:
/** 
 * Gets the   {@link net.java.sip.communicator.impl.protocol.jabber.extensions.colibri.ColibriConferenceIQ.Channel} which belongs to a contentassociated with a specific <tt>MediaType</tt> and is to be either locally or remotely used. <p> <b>Note</b>: Modifications to the <tt>ColibriConferenceIQ.Channel</tt> instance returned by the method propagate to (the state of) this instance. </p>
 * @param mediaType the <tt>MediaType</tt> associated with the content whichcontains the <tt>ColibriConferenceIQ.Channel</tt> to get
 * @param local <tt>true</tt> if the <tt>ColibriConferenceIQ.Channel</tt>which is to be used locally is to be returned or <tt>false</tt> for the one which is to be used remotely
 * @return the <tt>ColibriConferenceIQ.Channel</tt> which belongs to a contentassociated with the specified <tt>mediaType</tt> and which is to be used in accord with the specified <tt>local</tt> indicator if such a channel exists; otherwise, <tt>null</tt>
 */
ColibriConferenceIQ.Channel getColibriChannel(MediaType mediaType,boolean local){
  ColibriConferenceIQ.Channel channel=null;
  if (colibri != null) {
    ColibriConferenceIQ.Content content=colibri.getContent(mediaType.toString());
    if (content != null) {
      List<ColibriConferenceIQ.Channel> channels=content.getChannels();
      if (channels.size() == 2)       channel=channels.get(local ? 0 : 1);
    }
  }
  return channel;
}

Fixed version (ground truth):
/** 
 * Gets the   {@link ColibriConferenceIQ.Channel} which belongs to a contentassociated with a specific <tt>MediaType</tt> and is to be either locally or remotely used. <p> <b>Note</b>: Modifications to the <tt>ColibriConferenceIQ.Channel</tt> instance returned by the method propagate to (the state of) this instance. </p>
 * @param mediaType the <tt>MediaType</tt> associated with the content whichcontains the <tt>ColibriConferenceIQ.Channel</tt> to get
 * @param local <tt>true</tt> if the <tt>ColibriConferenceIQ.Channel</tt>which is to be used locally is to be returned or <tt>false</tt> for the one which is to be used remotely
 * @return the <tt>ColibriConferenceIQ.Channel</tt> which belongs to a contentassociated with the specified <tt>mediaType</tt> and which is to be used in accord with the specified <tt>local</tt> indicator if such a channel exists; otherwise, <tt>null</tt>
 */
ColibriConferenceIQ.Channel getColibriChannel(MediaType mediaType,boolean local){
  ColibriConferenceIQ.Channel channel=null;
  if (colibri != null) {
    ColibriConferenceIQ.Content content=colibri.getContent(mediaType.toString());
    if (content != null) {
      List<ColibriConferenceIQ.Channel> channels=content.getChannels();
      if (channels.size() == 2)       channel=channels.get(local ? 0 : 1);
    }
  }
  return channel;
}
Program: 103155
Project: 103155
Buggy source:
/** 
 * Implements   {@link TransportManagerJabberImpl#getStreamTarget(MediaType)}. Gets the <tt>MediaStreamTarget</tt> to be used as the <tt>target</tt> of the <tt>MediaStream</tt> with a specific <tt>MediaType</tt>.
 * @param mediaType the <tt>MediaType</tt> of the <tt>MediaStream</tt> whichis to have its <tt>target</tt> set to the returned <tt>MediaStreamTarget</tt>
 * @return the <tt>MediaStreamTarget</tt> to be used as the <tt>target</tt>of the <tt>MediaStream</tt> with the specified <tt>MediaType</tt>
 * @see TransportManagerJabberImpl#getStreamTarget(MediaType)
 */
public MediaStreamTarget getStreamTarget(MediaType mediaType){
  MediaStreamTarget streamTarget=null;
  for (  Iterable<ContentPacketExtension> remote : remotes) {
    for (    ContentPacketExtension content : remote) {
      RtpDescriptionPacketExtension rtpDescription=content.getFirstChildOfType(RtpDescriptionPacketExtension.class);
      MediaType contentMediaType=MediaType.parseString(rtpDescription.getMedia());
      if (mediaType.equals(contentMediaType)) {
        ColibriConferenceIQ.Channel channel=getColibriChannel(mediaType,true);
        if (channel == null) {
          streamTarget=JingleUtils.extractDefaultTarget(content);
        }
 else {
          streamTarget=new MediaStreamTarget(new InetSocketAddress(channel.getHost(),channel.getRTPPort()),new InetSocketAddress(channel.getHost(),channel.getRTPPort()));
        }
        break;
      }
    }
  }
  return streamTarget;
}

Fixed version (ground truth):
/** 
 * Implements   {@link TransportManagerJabberImpl#getStreamTarget(MediaType)}. Gets the <tt>MediaStreamTarget</tt> to be used as the <tt>target</tt> of the <tt>MediaStream</tt> with a specific <tt>MediaType</tt>.
 * @param mediaType the <tt>MediaType</tt> of the <tt>MediaStream</tt> whichis to have its <tt>target</tt> set to the returned <tt>MediaStreamTarget</tt>
 * @return the <tt>MediaStreamTarget</tt> to be used as the <tt>target</tt>of the <tt>MediaStream</tt> with the specified <tt>MediaType</tt>
 * @see TransportManagerJabberImpl#getStreamTarget(MediaType)
 */
public MediaStreamTarget getStreamTarget(MediaType mediaType){
  MediaStreamTarget streamTarget=null;
  for (  Iterable<ContentPacketExtension> remote : remotes) {
    for (    ContentPacketExtension content : remote) {
      RtpDescriptionPacketExtension rtpDescription=content.getFirstChildOfType(RtpDescriptionPacketExtension.class);
      MediaType contentMediaType=MediaType.parseString(rtpDescription.getMedia());
      if (mediaType.equals(contentMediaType)) {
        ColibriConferenceIQ.Channel channel=getColibriChannel(mediaType,true);
        if (channel == null) {
          streamTarget=JingleUtils.extractDefaultTarget(content);
        }
 else {
          streamTarget=new MediaStreamTarget(new InetSocketAddress(channel.getHost(),channel.getRTPPort()),new InetSocketAddress(channel.getHost(),channel.getRTCPPort()));
        }
        break;
      }
    }
  }
  return streamTarget;
}
Program: 103156
Project: 103156
Buggy source:
/** 
 * Implements <code>setVisible</code> in the UIService interface. Shows or hides the main application window depending on the parameter <code>visible</code>.
 * @param isVisible true if we are to show the main application frame andfalse otherwise.
 * @see UIService#setVisible(boolean)
 */
public void setFrameVisible(final boolean isVisible){
  ConfigurationUtils.setApplicationVisible(isVisible);
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      if (isVisible) {
        MainFrame.this.addNativePlugins();
        Window focusedWindow=keyManager.getFocusedWindow();
        if (focusedWindow != null)         setFocusableWindowState(false);
        MainFrame.super.setVisible(isVisible);
        if (focusedWindow != null)         setFocusableWindowState(true);
        MainFrame.super.setExtendedState(MainFrame.NORMAL);
        MainFrame.super.toFront();
      }
 else {
        MainFrame.super.setVisible(isVisible);
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Implements <code>setVisible</code> in the UIService interface. Shows or hides the main application window depending on the parameter <code>visible</code>.
 * @param isVisible true if we are to show the main application frame andfalse otherwise.
 * @see UIService#setVisible(boolean)
 */
public void setFrameVisible(final boolean isVisible){
  if (this.isVisible() != isVisible) {
    ConfigurationUtils.setApplicationVisible(isVisible);
    SwingUtilities.invokeLater(new Runnable(){
      public void run(){
        if (isVisible) {
          MainFrame.this.addNativePlugins();
          Window focusedWindow=keyManager.getFocusedWindow();
          if (focusedWindow != null)           setFocusableWindowState(false);
          MainFrame.super.setVisible(isVisible);
          if (focusedWindow != null)           setFocusableWindowState(true);
          MainFrame.super.setExtendedState(MainFrame.NORMAL);
          MainFrame.super.toFront();
        }
 else {
          MainFrame.super.setVisible(isVisible);
        }
      }
    }
);
  }
}
Program: 103157
Project: 103157
Buggy source:
/** 
 * Adds remote video specific components.
 * @param callPeer the <tt>CallPeer</tt>
 */
public void addRemoteVideoSpecificComponents(CallPeer callPeer){
  if (CallManager.isVideoQualityPresetSupported(callPeer)) {
    if (resizeVideoButton == null) {
      resizeVideoButton=new ResizeVideoButton(callPeer.getCall());
      resizeVideoButton.setIndex(9);
    }
    if (resizeVideoButton.countAvailableOptions() > 1)     settingsPanel.add(resizeVideoButton);
  }
  settingsPanel.revalidate();
  settingsPanel.repaint();
}

Fixed version (ground truth):
/** 
 * Adds remote video specific components.
 * @param callPeer the <tt>CallPeer</tt>
 */
public void addRemoteVideoSpecificComponents(CallPeer callPeer){
  if (CallManager.isVideoQualityPresetSupported(callPeer)) {
    if (resizeVideoButton == null) {
      resizeVideoButton=new ResizeVideoButton(callPeer.getCall());
      resizeVideoButton.setIndex(9);
    }
    if (resizeVideoButton.countAvailableOptions() > 1) {
      settingsPanel.add(resizeVideoButton);
      settingsPanel.revalidate();
      settingsPanel.repaint();
    }
  }
}
Program: 103159
Project: 103159
Buggy source:
/** 
 * Implements ShutdownService#beginShutdown(). Disposes of the mainFrame (if it exists) and then instructs Felix to start shutting down the bundles so that the application can gracefully quit.
 */
public void beginShutdown(){
  try {
    if (mainFrame != null)     mainFrame.dispose();
  }
  finally {
    try {
      GuiActivator.bundleContext.getBundle(0).stop();
    }
 catch (    BundleException ex) {
      logger.error("String_Node_Str",ex);
      System.exit(0);
    }
  }
}

Fixed version (ground truth):
/** 
 * Implements ShutdownService#beginShutdown(). Disposes of the mainFrame (if it exists) and then instructs Felix to start shutting down the bundles so that the application can gracefully quit.
 */
public void beginShutdown(){
  try {
    if (mainFrame != null)     mainFrame.dispose();
  }
  finally {
    System.exit(0);
  }
}
Program: 103161
Project: 103161
Buggy source:
public void run(){
synchronized (this) {
    try {
      long shutDownTimeout=SHUTDOWN_TIMEOUT_DEFAULT;
      try {
        String shutdownCustomValue=System.getProperty(SHUTDOWN_TIMEOUT_PROP);
        if (shutdownCustomValue != null && shutdownCustomValue.length() > 0) {
          long custom=Long.valueOf(shutdownCustomValue);
          if (custom > 0)           shutDownTimeout=custom;
        }
      }
 catch (      Throwable t) {
      }
      if (logger.isTraceEnabled())       logger.trace("String_Node_Str" + shutDownTimeout + "String_Node_Str");
      wait(shutDownTimeout);
      logger.error("String_Node_Str");
      System.exit(SYSTEM_EXIT_CODE);
    }
 catch (    InterruptedException ex) {
      if (logger.isDebugEnabled())       logger.debug("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public void run(){
synchronized (this) {
    try {
      long shutDownTimeout=SHUTDOWN_TIMEOUT_DEFAULT;
      try {
        String shutdownCustomValue=System.getProperty(SHUTDOWN_TIMEOUT_PROP);
        if (shutdownCustomValue != null && shutdownCustomValue.length() > 0) {
          long custom=Long.valueOf(shutdownCustomValue);
          if (custom > 0)           shutDownTimeout=custom;
        }
      }
 catch (      Throwable t) {
      }
      if (logger.isTraceEnabled())       logger.trace("String_Node_Str" + shutDownTimeout + "String_Node_Str");
      wait(shutDownTimeout);
      logger.error("String_Node_Str");
      Runtime.getRuntime().halt(SYSTEM_EXIT_CODE);
    }
 catch (    InterruptedException ex) {
      if (logger.isDebugEnabled())       logger.debug("String_Node_Str");
    }
  }
}
Program: 103162
Project: 103162
Buggy source:
/** 
 * Updates this view i.e. <tt>CallPanel</tt> so that it depicts the current state of its model i.e. <tt>callConference</tt>.
 */
private void updateViewFromModel(){
  if (SwingUtilities.isEventDispatchThread())   updateViewFromModelInEventDispatchThread();
 else {
    SwingUtilities.invokeLater(updateViewFromModelInEventDispatchThread);
  }
}

Fixed version (ground truth):
/** 
 * Updates this view i.e. <tt>CallPanel</tt> so that it depicts the current state of its model i.e. <tt>callConference</tt>.
 */
private void updateViewFromModel(){
  if (!disposed) {
    if (SwingUtilities.isEventDispatchThread())     updateViewFromModelInEventDispatchThread();
 else {
      SwingUtilities.invokeLater(updateViewFromModelInEventDispatchThread);
    }
  }
}
Program: 103163
Project: 103163
Buggy source:
/** 
 * Releases the resources acquired by this instance which require explicit disposal (e.g. any listeners added to the depicted <tt>CallConference</tt>, the participating <tt>Call</tt>s, and their associated <tt>CallPeer</tt>s). Invoked by <tt>CallManager</tt> when it determines that this <tt>CallPanel</tt> is no longer necessary.
 */
void dispose(){
  callConference.removeCallChangeListener(callConferenceListener);
  callConference.removeCallPeerConferenceListener(callConferenceListener);
  callConference.removePropertyChangeListener(callConferenceListener);
  uiVideoHandler.deleteObserver(uiVideoHandlerObserver);
  uiVideoHandler.dispose();
  if (callPanel != null)   ((CallRenderer)callPanel).dispose();
}

Fixed version (ground truth):
/** 
 * Releases the resources acquired by this instance which require explicit disposal (e.g. any listeners added to the depicted <tt>CallConference</tt>, the participating <tt>Call</tt>s, and their associated <tt>CallPeer</tt>s). Invoked by <tt>CallManager</tt> when it determines that this <tt>CallPanel</tt> is no longer necessary.
 */
void dispose(){
  disposed=true;
  callConference.removeCallChangeListener(callConferenceListener);
  callConference.removeCallPeerConferenceListener(callConferenceListener);
  callConference.removePropertyChangeListener(callConferenceListener);
  uiVideoHandler.deleteObserver(uiVideoHandlerObserver);
  uiVideoHandler.dispose();
  if (callPanel != null)   ((CallRenderer)callPanel).dispose();
}
Program: 103164
Project: 103164
Buggy source:
/** 
 * Updates this view i.e. <tt>CallPanel</tt> so that it depicts the current state of its model i.e. <tt>callConference</tt>. The update is performed in the AWT event dispatching thread.
 */
private void updateViewFromModelInEventDispatchThread(){
  Dimension oldPreferredSize=getPreferredSize();
  doUpdateViewFromModelInEventDispatchThread();
  Dimension newPreferredSize=getPreferredSize();
  if ((newPreferredSize != null) && ((newPreferredSize.height > getHeight()) || (newPreferredSize.width > getWidth()))) {
    int oldPreferredHeight, oldPreferredWidth;
    if (oldPreferredSize == null) {
      oldPreferredHeight=0;
      oldPreferredWidth=0;
    }
 else {
      oldPreferredHeight=oldPreferredSize.height;
      oldPreferredWidth=oldPreferredSize.width;
    }
    if ((newPreferredSize.height != oldPreferredHeight) || (newPreferredSize.width != oldPreferredWidth)) {
      ensureSize(this,newPreferredSize.width,newPreferredSize.height);
    }
  }
}

Fixed version (ground truth):
/** 
 * Updates this view i.e. <tt>CallPanel</tt> so that it depicts the current state of its model i.e. <tt>callConference</tt>. The update is performed in the AWT event dispatching thread.
 */
private void updateViewFromModelInEventDispatchThread(){
  if (disposed)   return;
  Dimension oldPreferredSize=getPreferredSize();
  doUpdateViewFromModelInEventDispatchThread();
  Dimension newPreferredSize=getPreferredSize();
  if ((newPreferredSize != null) && ((newPreferredSize.height > getHeight()) || (newPreferredSize.width > getWidth()))) {
    int oldPreferredHeight, oldPreferredWidth;
    if (oldPreferredSize == null) {
      oldPreferredHeight=0;
      oldPreferredWidth=0;
    }
 else {
      oldPreferredHeight=oldPreferredSize.height;
      oldPreferredWidth=oldPreferredSize.width;
    }
    if ((newPreferredSize.height != oldPreferredHeight) || (newPreferredSize.width != oldPreferredWidth)) {
      ensureSize(this,newPreferredSize.width,newPreferredSize.height);
    }
  }
}
Program: 103166
Project: 103166
Buggy source:
/** 
 * Updates this view i.e. <tt>OneToOneCallPeerPanel</tt> so that it depicts the current state of its model i.e. <tt>callPeer</tt>.
 */
private void updateViewFromModel(){
  if (SwingUtilities.isEventDispatchThread())   updateViewFromModelInEventDispatchThread();
 else {
    SwingUtilities.invokeLater(updateViewFromModelInEventDispatchThread);
  }
}

Fixed version (ground truth):
/** 
 * Updates this view i.e. <tt>OneToOneCallPeerPanel</tt> so that it depicts the current state of its model i.e. <tt>callPeer</tt>.
 */
private void updateViewFromModel(){
  if (!disposed) {
    if (SwingUtilities.isEventDispatchThread())     updateViewFromModelInEventDispatchThread();
 else {
      SwingUtilities.invokeLater(updateViewFromModelInEventDispatchThread);
    }
  }
}
Program: 103167
Project: 103167
Buggy source:
/** 
 * Releases the resources acquired by this instance which require explicit disposal (e.g. any listeners added to the depicted <tt>CallPeer</tt>. Invoked by <tt>OneToOneCallPanel</tt> when it determines that this <tt>OneToOneCallPeerPanel</tt> is no longer necessary. 
 */
public void dispose(){
  callPeerAdapter.dispose();
  uiVideoHandler.deleteObserver(uiVideoHandlerObserver);
}

Fixed version (ground truth):
/** 
 * Releases the resources acquired by this instance which require explicit disposal (e.g. any listeners added to the depicted <tt>CallPeer</tt>. Invoked by <tt>OneToOneCallPanel</tt> when it determines that this <tt>OneToOneCallPeerPanel</tt> is no longer necessary. 
 */
public void dispose(){
  disposed=true;
  callPeerAdapter.dispose();
  uiVideoHandler.deleteObserver(uiVideoHandlerObserver);
}
Program: 103168
Project: 103168
Buggy source:
public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
  MediaDevice mediaDevice=(MediaDevice)value;
  Dimension screenSize=null;
  if (mediaDevice != null)   screenSize=((VideoMediaFormat)mediaDevice.getFormat()).getSize();
  this.setText(screenSize.width + "String_Node_Str" + screenSize.height);
  return this;
}

Fixed version (ground truth):
@Override public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
  MediaDevice mediaDevice=(MediaDevice)value;
  Dimension screenSize=null;
  if (mediaDevice != null)   screenSize=((VideoMediaFormat)mediaDevice.getFormat()).getSize();
  this.setText(screenSize.width + "String_Node_Str" + screenSize.height);
  return this;
}
Program: 103170
Project: 103170
Buggy source:
public void paintComponent(Graphics g){
  g=g.create();
  try {
    AntialiasingManager.activateAntialiasing(g);
    g.setColor(new Color(1f,1f,1f,0.1f));
    g.fillRoundRect(0,0,this.getWidth(),this.getHeight(),10,10);
    g.setColor(Color.WHITE);
    g.drawRoundRect(0,0,this.getWidth() - 1,this.getHeight() - 1,10,10);
  }
  finally {
    g.dispose();
  }
}

Fixed version (ground truth):
@Override public void paintComponent(Graphics g){
  g=g.create();
  try {
    AntialiasingManager.activateAntialiasing(g);
    g.setColor(new Color(1f,1f,1f,0.1f));
    g.fillRoundRect(0,0,this.getWidth(),this.getHeight(),10,10);
    g.setColor(Color.WHITE);
    g.drawRoundRect(0,0,this.getWidth() - 1,this.getHeight() - 1,10,10);
  }
  finally {
    g.dispose();
  }
}
Program: 103171
Project: 103171
Buggy source:
public void securityTimeout(CallPeerSecurityTimeoutEvent evt){
}

Fixed version (ground truth):
public void securityTimeout(CallPeerSecurityTimeoutEvent ev){
}
Program: 103172
Project: 103172
Buggy source:
/** 
 * Plays this audio.
 */
public void play(){
  started=true;
  new Thread(){
    @Override public void run(){
      runInPlayThread();
    }
  }
.start();
}

Fixed version (ground truth):
/** 
 * Plays this audio.
 */
public void play(){
  started=true;
  new Thread("String_Node_Str" + this.getClass()){
    @Override public void run(){
      runInPlayThread();
    }
  }
.start();
}
Program: 103173
Project: 103173
Buggy source:
/** 
 * Returns a hashCode for this contact. The returned hashcode is actually that of the Contact's Address
 * @return the hashcode of this Contact
 */
@Override public int hashCode(){
  return getAddress().hashCode();
}

Fixed version (ground truth):
/** 
 * Returns a hashCode for this contact. The returned hashcode is actually that of the Contact's Address
 * @return the hashcode of this Contact
 */
@Override public int hashCode(){
  return getAddress().toLowerCase().hashCode();
}
Program: 103174
Project: 103174
Buggy source:
/** 
 * Schedules an update if necessary.
 */
private void updateContactListView(){
  String filterString=getText();
  FilterQuery filterQuery=null;
  boolean isDefaultFilter=false;
  searchFilter.setFilterString(filterString.trim());
  if (filterString != null && filterString.length() > 0) {
    filterQuery=contactList.applyFilter(searchFilter);
  }
 else {
    filterQuery=contactList.applyDefaultFilter();
    isDefaultFilter=true;
  }
  if (filterQuery != null && !filterQuery.isCanceled()) {
    if (isDefaultFilter || filterQuery.isSucceeded())     enableUnknownContactView(false);
 else     filterQuery.setQueryListener(this);
  }
 else {
    closeFilterQuery(filterQuery,!contactList.isEmpty());
  }
}

Fixed version (ground truth):
/** 
 * Schedules an update if necessary.
 */
private void updateContactListView(){
  String filterString=getText();
  boolean isDefaultFilter=false;
  searchFilter.setFilterString(filterString.trim());
  if (currentFilterQuery != null)   filterQueryFinished(currentFilterQuery,true);
  if (filterString != null && filterString.length() > 0) {
    currentFilterQuery=contactList.applyFilter(searchFilter);
  }
 else {
    currentFilterQuery=contactList.applyDefaultFilter();
    isDefaultFilter=true;
  }
  if (currentFilterQuery != null && !currentFilterQuery.isCanceled()) {
    if (isDefaultFilter || currentFilterQuery.isSucceeded())     enableUnknownContactView(false);
 else     currentFilterQuery.setQueryListener(this);
  }
 else {
    filterQueryFinished(currentFilterQuery,!contactList.isEmpty());
  }
}
Program: 103175
Project: 103175
Buggy source:
/** 
 * Indicates that the given <tt>query</tt> has finished with failure, i.e. no results for the filter were found.
 * @param query the <tt>FilterQuery</tt>, where this listener is registered
 */
public void filterQueryFailed(FilterQuery query){
  closeFilterQuery(query,!contactList.isEmpty());
}

Fixed version (ground truth):
/** 
 * Indicates that the given <tt>query</tt> has finished with failure, i.e. no results for the filter were found.
 * @param query the <tt>FilterQuery</tt>, where this listener is registered
 */
public void filterQueryFailed(FilterQuery query){
  if (currentFilterQuery.equals(query))   filterQueryFinished(query,false);
}
Program: 103176
Project: 103176
Buggy source:
/** 
 * Indicates that the given <tt>query</tt> has finished with success, i.e. the filter has returned results.
 * @param query the <tt>FilterQuery</tt>, where this listener is registered
 */
public void filterQuerySucceeded(FilterQuery query){
  closeFilterQuery(query,!contactList.isEmpty());
}

Fixed version (ground truth):
/** 
 * Indicates that the given <tt>query</tt> has finished with success, i.e. the filter has returned results.
 * @param query the <tt>FilterQuery</tt>, where this listener is registered
 */
public void filterQuerySucceeded(FilterQuery query){
  if (currentFilterQuery.equals(query))   filterQueryFinished(query,true);
}
Program: 103177
Project: 103177
Buggy source:
public void serviceChanged(ServiceEvent event){
  ServiceReference serviceRef=event.getServiceReference();
  if (serviceRef.getBundle().getState() == Bundle.STOPPING)   return;
  Object service=GuiActivator.bundleContext.getService(serviceRef);
  if (!(service instanceof ContactSourceService))   return;
  boolean changed=false;
switch (event.getType()) {
case ServiceEvent.REGISTERED:
    ExternalContactSource contactSource=new ExternalContactSource((ContactSourceService)service,TreeContactList.this);
  contactSources.add(contactSource);
changed=true;
break;
case ServiceEvent.UNREGISTERING:
UIContactSource cSource=getContactSource((ContactSourceService)service);
if (cSource != null) contactSources.remove(cSource);
changed=true;
break;
}
if (changed) {
if (currentFilter.equals(defaultFilter)) applyDefaultFilter();
 else applyFilter(currentFilter);
}
}

Fixed version (ground truth):
public void serviceChanged(ServiceEvent event){
  ServiceReference serviceRef=event.getServiceReference();
  if (serviceRef.getBundle().getState() == Bundle.STOPPING)   return;
  Object service=GuiActivator.bundleContext.getService(serviceRef);
  if (!(service instanceof ContactSourceService))   return;
  boolean changed=false;
switch (event.getType()) {
case ServiceEvent.REGISTERED:
    ExternalContactSource contactSource=new ExternalContactSource((ContactSourceService)service,TreeContactList.this);
  contactSources.add(contactSource);
changed=true;
break;
case ServiceEvent.UNREGISTERING:
UIContactSource cSource=getContactSource((ContactSourceService)service);
if (cSource != null) contactSources.remove(cSource);
changed=true;
break;
}
if (changed && !currentFilter.equals(presenceFilter)) {
if (currentFilter.equals(defaultFilter)) applyDefaultFilter();
 else applyFilter(currentFilter);
}
}
Program: 103178
Project: 103178
Buggy source:
public void metaGroupReceived(MetaGroupQueryEvent event){
}

Fixed version (ground truth):
public void metaGroupReceived(MetaGroupQueryEvent event){
  if (!isSucceeded() && event.getQuerySource().getResultCount() > 0)   setSucceeded(true);
  fireFilterQueryEvent();
}
Program: 103179
Project: 103179
Buggy source:
/** 
 * Indicates that a contact has been received as a result of a query.
 * @param event the <tt>ContactReceivedEvent</tt> that notified us
 */
public void contactReceived(ContactReceivedEvent event){
  contactReceived(event.getQuerySource(),event.getContact());
}

Fixed version (ground truth):
/** 
 * Indicates that a contact has been received as a result of a query.
 * @param event the <tt>ContactReceivedEvent</tt> that notified us
 */
public void contactReceived(ContactReceivedEvent event){
  ContactQuery query=event.getQuerySource();
  SourceContact contact=event.getContact();
  if (!isSucceeded() && !query.getQueryResults().isEmpty())   setSucceeded(true);
  fireFilterQueryEvent();
  List<SourceContact> queryResults=filterQueries.get(query);
  queryResults.add(contact);
  if (getMaxResultShown() > -1 && queryResults.size() == getMaxResultShown()) {
    query.removeContactQueryListener(contactList);
    ShowMoreContact moreInfoContact=new ShowMoreContact(query,queryResults,getMaxResultShown());
    showMoreContactMap.put(query,moreInfoContact);
    ContactSourceService contactSource=query.getContactSource();
    contactList.addContact(query,moreInfoContact,contactList.getContactSource(contactSource).getUIGroup(),false);
  }
}
Program: 103180
Project: 103180
Buggy source:
public void metaContactReceived(MetaContactQueryEvent event){
}

Fixed version (ground truth):
public void metaContactReceived(MetaContactQueryEvent event){
  if (!isSucceeded() && event.getQuerySource().getResultCount() > 0)   setSucceeded(true);
  fireFilterQueryEvent();
}
Program: 103181
Project: 103181
Buggy source:
protected void layoutLabel(int tabPlacement,FontMetrics metrics,int tabIndex,String title,Icon icon,Rectangle tabRect,Rectangle iconRect,Rectangle textRect,boolean isSelected){
  textRect.x=textRect.y=iconRect.x=iconRect.y=0;
  View v=getTextViewForTab(tabIndex);
  if (v != null) {
    tabPane.putClientProperty("String_Node_Str",v);
  }
  SwingUtilities.layoutCompoundLabel((JComponent)tabPane,metrics,title,icon,SwingUtilities.CENTER,SwingUtilities.LEFT,SwingUtilities.CENTER,SwingUtilities.CENTER,tabRect,iconRect,textRect,0);
  tabPane.putClientProperty("String_Node_Str",null);
  iconRect.y=iconRect.y + 2;
  iconRect.x=tabRect.x + 7;
  textRect.y=textRect.y + 2;
  textRect.x=iconRect.x + iconRect.width + 5;
}

Fixed version (ground truth):
protected void layoutLabel(int tabPlacement,FontMetrics metrics,int tabIndex,String title,Icon icon,Rectangle tabRect,Rectangle iconRect,Rectangle textRect,boolean isSelected){
  textRect.x=textRect.y=iconRect.x=iconRect.y=0;
  View v=getTextViewForTab(tabIndex);
  if (v != null) {
    tabPane.putClientProperty("String_Node_Str",v);
  }
  SwingUtilities.layoutCompoundLabel((JComponent)tabPane,metrics,title,icon,SwingUtilities.CENTER,SwingUtilities.LEFT,SwingUtilities.CENTER,SwingUtilities.CENTER,tabRect,iconRect,textRect,0);
  tabPane.putClientProperty("String_Node_Str",null);
  if (icon != null) {
    iconRect.y=iconRect.y + 2;
    iconRect.x=tabRect.x + 7;
  }
  textRect.y=textRect.y + 2;
  if (icon != null)   textRect.x=iconRect.x + iconRect.width + 5;
 else   textRect.x=textRect.x + 8;
}
Program: 103182
Project: 103182
Buggy source:
protected Rectangle newCloseRect(Rectangle rect){
  int dx=rect.x + rect.width;
  int dy=(rect.y + rect.height) / 2 - 6;
  return new Rectangle(dx - BUTTONSIZE - WIDTHDELTA,dy,BUTTONSIZE,BUTTONSIZE);
}

Fixed version (ground truth):
protected Rectangle newCloseRect(Rectangle rect){
  int dx=rect.x + rect.width - BUTTONSIZE - WIDTHDELTA;
  int dy=rect.y + (rect.height - BUTTONSIZE) / 2 + 2;
  return new Rectangle(dx,dy,BUTTONSIZE,BUTTONSIZE);
}
Program: 103184
Project: 103184
Buggy source:
protected Rectangle newMaxRect(Rectangle rect){
  int dx=rect.x + rect.width;
  int dy=(rect.y + rect.height) / 2 - 6;
  if (isCloseButtonEnabled)   dx-=BUTTONSIZE;
  return new Rectangle(dx - BUTTONSIZE - WIDTHDELTA,dy,BUTTONSIZE,BUTTONSIZE);
}

Fixed version (ground truth):
protected Rectangle newMaxRect(Rectangle rect){
  int dx=rect.x + rect.width - BUTTONSIZE - WIDTHDELTA;
  int dy=rect.y + (rect.height - BUTTONSIZE) / 2 + 2;
  if (isCloseButtonEnabled)   dx-=BUTTONSIZE;
  return new Rectangle(dx,dy,BUTTONSIZE,BUTTONSIZE);
}
Program: 103185
Project: 103185
Buggy source:
/** 
 * Constructor.
 * @param dialog the invite dialog
 * @param selected if the column is the selected ones
 */
public InviteContactTransferHandler(ContactList srcContactList,ContactList destContactList,boolean selected){
  this.srcContactList=srcContactList;
  this.destContactList=destContactList;
  this.selected=selected;
}

Fixed version (ground truth):
/** 
 * Constructor.
 * @param contactList the contact list, this transfer handler is about
 * @param type the type of this transfer handler. Indicates if it's used fordragging from the source contact list, or dropping in the destination contact list. One of SOURCE_TRANSFER_HANDLER or DEST_TRANSFER_HANDLER
 * @param selected if the column is the selected ones
 */
public InviteContactTransferHandler(ContactList contactList,int type,boolean selected){
  this.contactList=contactList;
  this.type=type;
  this.selected=selected;
}
Program: 103186
Project: 103186
Buggy source:
/** 
 * Indicates whether a component will accept an import of the given set of data flavors prior to actually attempting to import it. We return <tt>true</tt> to indicate that the transfer with at least one of the given flavors would work and <tt>false</tt> to reject the transfer. <p>
 * @param comp component
 * @param flavor the data formats available
 * @return  true if the data can be inserted into the component, falseotherwise
 * @throws NullPointerException if <code>support</code> is {@code null}
 */
public boolean canImport(JComponent comp,DataFlavor flavor[]){
  for (int i=0, n=flavor.length; i < n; i++) {
    if (flavor[i].equals(uiContactDataFlavor)) {
      if (comp instanceof ContactList) {
        return true;
      }
      return false;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Indicates whether a component will accept an import of the given set of data flavors prior to actually attempting to import it. We return <tt>true</tt> to indicate that the transfer with at least one of the given flavors would work and <tt>false</tt> to reject the transfer. <p>
 * @param comp component
 * @param flavor the data formats available
 * @return  true if the data can be inserted into the component, falseotherwise
 * @throws NullPointerException if <code>support</code> is {@code null}
 */
public boolean canImport(JComponent comp,DataFlavor flavor[]){
  if (type != DEST_TRANSFER_HANDLER)   return false;
  for (int i=0, n=flavor.length; i < n; i++) {
    if (flavor[i].equals(uiContactDataFlavor)) {
      if (comp instanceof ContactList) {
        return true;
      }
      return false;
    }
  }
  return false;
}
Program: 103187
Project: 103187
Buggy source:
/** 
 * Handles transfers to the invite dialog.
 * @param comp  the component to receive the transfer;
 * @param t the data to import
 * @return  true if the data was inserted into the component and falseotherwise
 */
public boolean importData(JComponent comp,Transferable t){
  if (t.isDataFlavorSupported(uiContactDataFlavor)) {
    if (!selected)     return false;
    Object o=null;
    try {
      o=t.getTransferData(uiContactDataFlavor);
    }
 catch (    UnsupportedFlavorException e) {
      if (logger.isDebugEnabled())       logger.debug("String_Node_Str",e);
    }
catch (    IOException e) {
      if (logger.isDebugEnabled())       logger.debug("String_Node_Str",e);
    }
    if (o instanceof Collection) {
      Iterator<?> c=((Collection<?>)o).iterator();
      while (c.hasNext()) {
        Object nextO=c.next();
        if (nextO instanceof UIContact) {
          destContactList.addContact(new InviteUIContact((UIContact)nextO,backupProvider),null,false,false);
        }
      }
      return true;
    }
 else     if (o instanceof UIContact) {
      destContactList.addContact(new InviteUIContact((UIContact)o,backupProvider),null,false,false);
      return true;
    }
 else     if (o instanceof ContactNode) {
      UIContact uiContact=((ContactNode)o).getContactDescriptor();
      if (uiContact != null) {
        destContactList.addContact(new InviteUIContact(uiContact,backupProvider),null,false,false);
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Handles transfers to the invite dialog.
 * @param comp  the component to receive the transfer;
 * @param t the data to import
 * @return  true if the data was inserted into the component and falseotherwise
 */
public boolean importData(JComponent comp,Transferable t){
  if (t.isDataFlavorSupported(uiContactDataFlavor)) {
    if (!selected)     return false;
    Object o=null;
    try {
      o=t.getTransferData(uiContactDataFlavor);
    }
 catch (    UnsupportedFlavorException e) {
      if (logger.isDebugEnabled())       logger.debug("String_Node_Str",e);
    }
catch (    IOException e) {
      if (logger.isDebugEnabled())       logger.debug("String_Node_Str",e);
    }
    if (o instanceof Collection) {
      Iterator<?> c=((Collection<?>)o).iterator();
      while (c.hasNext()) {
        Object nextO=c.next();
        if (nextO instanceof UIContact) {
          contactList.addContact(new InviteUIContact((UIContact)nextO,backupProvider),null,false,false);
        }
      }
      return true;
    }
 else     if (o instanceof UIContact) {
      contactList.addContact(new InviteUIContact((UIContact)o,backupProvider),null,false,false);
      return true;
    }
 else     if (o instanceof ContactNode) {
      UIContact uiContact=((ContactNode)o).getContactDescriptor();
      if (uiContact != null) {
        contactList.addContact(new InviteUIContact(uiContact,backupProvider),null,false,false);
        return true;
      }
    }
  }
  return false;
}
Program: 103188
Project: 103188
Buggy source:
/** 
 * Creates a transferable for text pane components in order to enable drag and drop of text.
 * @param component the component for which to create a<tt>Transferable</tt>
 * @return the created <tt>Transferable</tt>
 */
@Override protected Transferable createTransferable(JComponent component){
  if (component instanceof ContactList) {
    List<UIContact> c=((ContactList)component).getSelectedContacts();
    if (c != null)     return new UIContactTransferable(c);
  }
  return super.createTransferable(component);
}

Fixed version (ground truth):
/** 
 * Creates a transferable for text pane components in order to enable drag and drop of text.
 * @param component the component for which to create a<tt>Transferable</tt>
 * @return the created <tt>Transferable</tt>
 */
@Override protected Transferable createTransferable(JComponent component){
  if (type != SOURCE_TRANSFER_HANDLER)   return null;
  if (component instanceof ContactList) {
    List<UIContact> c=((ContactList)component).getSelectedContacts();
    if (c != null)     return new UIContactTransferable(c);
  }
  return super.createTransferable(component);
}
Program: 103189
Project: 103189
Buggy source:
/** 
 * Initializes the transfer handler.
 */
private void initTransferHandler(){
  inviteContactTransferHandler=new InviteContactTransferHandler(srcContactList,destContactList,true);
  if (srcContactList.getComponent() instanceof JComponent)   ((JComponent)srcContactList).setTransferHandler(inviteContactTransferHandler);
  if (destContactList.getComponent() instanceof JComponent)   ((JComponent)destContactList).setTransferHandler(inviteContactTransferHandler);
}

Fixed version (ground truth):
/** 
 * Initializes the transfer handler.
 */
private void initTransferHandler(){
  inviteContactTransferHandler=new InviteContactTransferHandler(destContactList,InviteContactTransferHandler.DEST_TRANSFER_HANDLER,true);
  InviteContactTransferHandler srcContactTransferHandler=new InviteContactTransferHandler(srcContactList,InviteContactTransferHandler.SOURCE_TRANSFER_HANDLER,true);
  if (srcContactList.getComponent() instanceof JComponent)   ((JComponent)srcContactList).setTransferHandler(srcContactTransferHandler);
  if (destContactList.getComponent() instanceof JComponent)   ((JComponent)destContactList).setTransferHandler(inviteContactTransferHandler);
}
Program: 103191
Project: 103191
Buggy source:
/** 
 * Creates AutoAway handler.
 * @param configurationService the config service.
 */
public AutoAwayWatcher(ConfigurationService configurationService){
  String enabledDefault=GeneralConfigPluginActivator.getResources().getSettingsString(Preferences.ENABLE);
  if (configurationService.getBoolean(Preferences.ENABLE,Boolean.parseBoolean(enabledDefault))) {
    start();
  }
  configurationService.addPropertyChangeListener(Preferences.ENABLE,new PropertyChangeListener(){
    public void propertyChange(    PropertyChangeEvent evt){
      if (Boolean.parseBoolean((String)evt.getNewValue()))       start();
 else       stopInner();
    }
  }
);
  configurationService.addPropertyChangeListener(Preferences.TIMER,new PropertyChangeListener(){
    public void propertyChange(    PropertyChangeEvent evt){
      stopInner();
      start();
    }
  }
);
  GeneralConfigPluginActivator.bundleContext.addServiceListener(this);
  ServiceReference[] protocolProviderRefs=null;
  try {
    protocolProviderRefs=GeneralConfigPluginActivator.bundleContext.getServiceReferences(ProtocolProviderService.class.getName(),null);
  }
 catch (  InvalidSyntaxException ex) {
    logger.error("String_Node_Str",ex);
    return;
  }
  if (protocolProviderRefs != null) {
    for (int i=0; i < protocolProviderRefs.length; i++) {
      ProtocolProviderService provider=(ProtocolProviderService)GeneralConfigPluginActivator.bundleContext.getService(protocolProviderRefs[i]);
      this.handleProviderAdded(provider);
    }
  }
}

Fixed version (ground truth):
/** 
 * Creates AutoAway handler.
 * @param configurationService the config service.
 */
public AutoAwayWatcher(ConfigurationService configurationService){
  String enabledDefault=GeneralConfigPluginActivator.getResources().getSettingsString(Preferences.ENABLE);
  if (configurationService.getBoolean(Preferences.ENABLE,Boolean.parseBoolean(enabledDefault))) {
    start();
  }
  configurationService.addPropertyChangeListener(Preferences.ENABLE,new PropertyChangeListener(){
    public void propertyChange(    PropertyChangeEvent evt){
      if (Boolean.parseBoolean((String)evt.getNewValue()))       start();
 else       stopInner();
    }
  }
);
  configurationService.addPropertyChangeListener(Preferences.TIMER,new PropertyChangeListener(){
    public void propertyChange(    PropertyChangeEvent evt){
      stopInner();
      start();
    }
  }
);
}
Program: 103192
Project: 103192
Buggy source:
/** 
 * Stops and removes the listeners, without the global service listener.
 */
private void stopInner(){
  if (idleListener != null) {
    SystemActivityNotificationsService systemActivityNotificationsService=getSystemActivityNotificationsService();
    systemActivityNotificationsService.removeIdleSystemChangeListener(idleListener);
    systemActivityNotificationsService.removeSystemActivityChangeListener(idleListener);
    idleListener=null;
  }
}

Fixed version (ground truth):
/** 
 * Stops and removes the listeners.
 */
private void stopInner(){
  if (idleListener != null) {
    SystemActivityNotificationsService systemActivityNotificationsService=getSystemActivityNotificationsService();
    systemActivityNotificationsService.removeIdleSystemChangeListener(idleListener);
    systemActivityNotificationsService.removeSystemActivityChangeListener(idleListener);
    stopListeningForNewProviders();
    idleListener=null;
  }
}
Program: 103193
Project: 103193
Buggy source:
/** 
 * Remove provider from list with last statuses. If this is the last provider stop listening for idle events.
 * @param provider
 */
private synchronized void removeProviderFromLastStates(ProtocolProviderService provider){
  lastStates.remove(provider);
  if (lastStates.size() == 0)   stopInner();
}

Fixed version (ground truth):
/** 
 * Remove provider from list with last statuses. If this is the last provider stop listening for idle events.
 * @param provider
 */
private synchronized void removeProviderFromLastStates(ProtocolProviderService provider){
  lastStates.remove(provider);
}
Program: 103194
Project: 103194
Buggy source:
/** 
 * Starts and add needed listeners.
 */
private void start(){
  if (idleListener == null) {
    idleListener=new IdleListener();
    SystemActivityNotificationsService systemActivityNotificationsService=getSystemActivityNotificationsService();
    systemActivityNotificationsService.addIdleSystemChangeListener(StatusUpdateThread.getTimer() * 60 * 1000,idleListener);
    systemActivityNotificationsService.addSystemActivityChangeListener(idleListener);
  }
}

Fixed version (ground truth):
/** 
 * Starts and add needed listeners.
 */
private void start(){
  if (idleListener == null) {
    idleListener=new IdleListener();
    SystemActivityNotificationsService systemActivityNotificationsService=getSystemActivityNotificationsService();
    systemActivityNotificationsService.addIdleSystemChangeListener(StatusUpdateThread.getTimer() * 60 * 1000,idleListener);
    systemActivityNotificationsService.addSystemActivityChangeListener(idleListener);
    startListeningForNewProviders();
  }
}
Program: 103196
Project: 103196
Buggy source:
/** 
 * Determines whether or not the <tt>iface</tt> interface is a loopback interface. We use this method as a replacement to the <tt>NetworkInterface.isLoopback()</tt> method that only comes with java 1.6.
 * @param iface the inteface that we'd like to determine as loopback or not.
 * @return true if <tt>iface</tt> contains at least one loopback addressand <tt>false</tt> otherwise.
 */
private boolean isLoopbackInterface(NetworkInterface iface){
  Enumeration<InetAddress> addresses=iface.getInetAddresses();
  return addresses.hasMoreElements() && addresses.nextElement().isLoopbackAddress();
}

Fixed version (ground truth):
/** 
 * Determines whether or not the <tt>iface</tt> interface is a loopback interface. We use this method as a replacement to the <tt>NetworkInterface.isLoopback()</tt> method that only comes with java 1.6.
 * @param iface the inteface that we'd like to determine as loopback or not.
 * @return true if <tt>iface</tt> contains at least one loopback addressand <tt>false</tt> otherwise.
 */
private boolean isLoopbackInterface(NetworkInterface iface){
  try {
    Method method=iface.getClass().getMethod("String_Node_Str");
    return ((Boolean)method.invoke(iface,new Object[]{})).booleanValue();
  }
 catch (  Throwable t) {
  }
  Enumeration<InetAddress> addresses=iface.getInetAddresses();
  if (addresses.hasMoreElements()) {
    InetAddress address=addresses.nextElement();
    if (address.isLoopbackAddress() || address.getHostAddress().startsWith(WEIRD_MACOSX_LOOPBACK_ADDRESS))     return true;
  }
  return false;
}
Program: 103197
Project: 103197
Buggy source:
/** 
 * Tries to lock the configuration directory. If lock-ing is not possible because a previous instance is already running, then it transmits the list of args to that running instance. <p> There are three possible outcomes of this method. 1. We lock successfully; 2. We fail to lock because another instance of SIP Communicator is already running; 3. We fail to lock for some unknown error. Each of these cases is represented by an error code returned as a result.
 * @param args the array of arguments that we are to submit in case an instance of SIP Communicator has already been started.
 * @return an error or success code indicating the outcome of the lockoperation.
 */
public int tryLock(String[] args){
  File lockFile=getLockFile();
  if (lockFile.exists()) {
    InetSocketAddress lockAddress=readLockFile(lockFile);
    if (lockAddress != null) {
      if (interInstanceConnect(lockAddress,args) == SUCCESS) {
        return ALREADY_STARTED;
      }
    }
    lockFile.delete();
  }
  try {
    lockFile.getParentFile().mkdirs();
    lockFile.createNewFile();
  }
 catch (  IOException e) {
    logger.error("String_Node_Str" + lockFile,e);
  }
  lockFile.deleteOnExit();
  return lock(lockFile);
}

Fixed version (ground truth):
/** 
 * Tries to lock the configuration directory. If lock-ing is not possible because a previous instance is already running, then it transmits the list of args to that running instance. <p> There are three possible outcomes of this method. 1. We lock successfully; 2. We fail to lock because another instance of Jitsi is already running; 3. We fail to lock for some unknown error. Each of these cases is represented by an error code returned as a result.
 * @param args the array of arguments that we are to submit in case an instance of Jitsi has already been started.
 * @return an error or success code indicating the outcome of the lockoperation.
 */
public int tryLock(String[] args){
  File lockFile=getLockFile();
  if (lockFile.exists()) {
    InetSocketAddress lockAddress=readLockFileRetrying(lockFile);
    if (lockAddress != null) {
      if (interInstanceConnect(lockAddress,args) == SUCCESS) {
        return ALREADY_STARTED;
      }
    }
    lockFile.delete();
  }
  return lock(lockFile);
}
Program: 103198
Project: 103198
Buggy source:
/** 
 * Creates and binds a socket on <tt>lockAddress</tt> and then starts a <tt>LockServer</tt> instance so that we would start interacting with other instances of SIP Communicator that are trying to start.
 * @return the <tt>ERROR</tt> code if something goes wrong and<tt>SUCCESS</tt> otherwise.
 */
private int startLockServer(InetSocketAddress localAddress){
  try {
    instanceServerSocket=new ServerSocket();
  }
 catch (  IOException exc) {
    logger.error("String_Node_Str",exc);
    return LOCK_ERROR;
  }
  try {
    instanceServerSocket.bind(localAddress,16);
  }
 catch (  IOException exc) {
    logger.error("String_Node_Str",exc);
    return LOCK_ERROR;
  }
  LockServer lockServ=new LockServer(instanceServerSocket);
  lockServ.start();
  return SUCCESS;
}

Fixed version (ground truth):
/** 
 * Creates and binds a socket on <tt>lockAddress</tt> and then starts a <tt>LockServer</tt> instance so that we would start interacting with other instances of Jitsi that are trying to start.
 * @return the <tt>ERROR</tt> code if something goes wrong and<tt>SUCCESS</tt> otherwise.
 */
private int startLockServer(InetSocketAddress localAddress){
  try {
    instanceServerSocket=new ServerSocket();
  }
 catch (  IOException exc) {
    logger.error("String_Node_Str",exc);
    return LOCK_ERROR;
  }
  try {
    instanceServerSocket.bind(localAddress,16);
  }
 catch (  IOException exc) {
    logger.error("String_Node_Str",exc);
    return LOCK_ERROR;
  }
  LockServer lockServ=new LockServer(instanceServerSocket);
  lockServ.start();
  return SUCCESS;
}