Program: 3157
Project: 3157
Buggy source:
/** 
 * Send a Skype command to Skype (actual implementation method) and wait for response.
 * @param command the command to send.
 * @param responseHeaders The expected response headers.
 * @param checkAttached if true the connector will first check if it is connected.
 * @param withoutTimeout if true the command has no timeout
 * @return the response.
 * @throws ConnectorException thrown when the connection to the Skype client has gone bad.
 */
private String execute(final String command,final String[] responseHeaders,final boolean checkAttached,boolean withoutTimeout) throws ConnectorException {
  ConnectorUtils.checkNotNull("String_Node_Str",command);
  ConnectorUtils.checkNotNull("String_Node_Str",responseHeaders);
  if (checkAttached) {
    assureAttached();
  }
  final Object wait=new Object();
  final String[] response=new String[1];
  ConnectorListener listener=new AbstractConnectorListener(){
    public void messageReceived(    ConnectorMessageEvent event){
      String message=event.getMessage();
      for (      String responseHeader : responseHeaders) {
        if (message.startsWith(responseHeader)) {
          response[0]=message;
synchronized (wait) {
            wait.notify();
          }
          return;
        }
      }
    }
  }
;
  addConnectorListener(listener,false);
  fireMessageSent(command);
synchronized (wait) {
    try {
      sendCommand(command);
      if (withoutTimeout) {
        wait.wait();
      }
 else {
        long start=System.currentTimeMillis();
        long commandResponseTime=getCommandTimeout();
        wait.wait(commandResponseTime);
        if (commandResponseTime <= System.currentTimeMillis() - start) {
          setStatus(Status.NOT_RUNNING);
          throw new NotAttachedException(Status.NOT_RUNNING);
        }
      }
    }
 catch (    InterruptedException e) {
      throw new ConnectorException("String_Node_Str" + command + "String_Node_Str");
    }
 finally {
      removeConnectorListener(listener);
    }
  }
  return response[0];
}

Fixed version (ground truth):
/** 
 * Send a Skype command to Skype (actual implementation method) and wait for response.
 * @param command the command to send.
 * @param responseHeaders The expected response headers.
 * @param checkAttached if true the connector will first check if it is connected.
 * @param withoutTimeout if true the command has no timeout
 * @return the response.
 * @throws ConnectorException thrown when the connection to the Skype client has gone bad.
 */
private String execute(final String command,final String[] responseHeaders,final boolean checkAttached,boolean withoutTimeout) throws ConnectorException {
  ConnectorUtils.checkNotNull("String_Node_Str",command);
  ConnectorUtils.checkNotNull("String_Node_Str",responseHeaders);
  if (checkAttached) {
    assureAttached();
  }
  final Object wait=new Object();
  final String[] response=new String[1];
  ConnectorListener listener=new AbstractConnectorListener(){
    public void messageReceived(    ConnectorMessageEvent event){
      String message=event.getMessage();
      for (      String responseHeader : responseHeaders) {
        if (message.startsWith(responseHeader)) {
          response[0]=message;
synchronized (wait) {
            wait.notify();
          }
          return;
        }
      }
    }
  }
;
  addConnectorListener(listener,false);
synchronized (wait) {
    try {
      fireMessageSent(command);
      sendCommand(command);
      if (withoutTimeout) {
        wait.wait();
      }
 else {
        long start=System.currentTimeMillis();
        long commandResponseTime=getCommandTimeout();
        wait.wait(commandResponseTime);
        if (commandResponseTime <= System.currentTimeMillis() - start) {
          setStatus(Status.NOT_RUNNING);
          throw new NotAttachedException(Status.NOT_RUNNING);
        }
      }
    }
 catch (    InterruptedException e) {
      throw new ConnectorException("String_Node_Str" + command + "String_Node_Str");
    }
 finally {
      removeConnectorListener(listener);
    }
  }
  return response[0];
}