Program: 3144
Project: 3144
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);
synchronized (wait) {
    try {
      fireMessageSent(command);
      sendCommand(command);
      if (withoutTimeout) {
        wait.wait();
      }
 else {
        long start=System.currentTimeMillis();
        long commandResponseTime=getCommandTimeout();
        wait.wait(commandResponseTime);
        if (commandResponseTime != 0 && 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.
 * @return the response.
 * @throws ConnectorException thrown when the connection to the Skype client has gone bad.
 */
public String execute(final String command,final String[] responseHeaders,final boolean checkAttached) throws ConnectorException {
  ConnectorUtils.checkNotNull("String_Node_Str",command);
  ConnectorUtils.checkNotNull("String_Node_Str",responseHeaders);
  if (checkAttached) {
    assureAttached();
  }
  final BlockingQueue<String> responses=new LinkedBlockingQueue<String>();
  ConnectorListener listener=new AbstractConnectorListener(){
    public void messageReceived(    ConnectorMessageEvent event){
      String message=event.getMessage();
      for (      String responseHeader : responseHeaders) {
        if (message.startsWith(responseHeader) || message.startsWith("String_Node_Str")) {
          responses.add(message);
          return;
        }
      }
    }
  }
;
  addConnectorListener(listener,false);
  fireMessageSent(command);
  sendCommand(command);
  try {
    boolean pinged=false;
    while (true) {
      String response;
      try {
        response=responses.poll(getCommandTimeout(),TimeUnit.MILLISECONDS);
      }
 catch (      InterruptedException e) {
        Thread.currentThread().interrupt();
        throw new ConnectorException("String_Node_Str" + command + "String_Node_Str");
      }
      if (response == null) {
        if (pinged) {
          setStatus(Status.NOT_RUNNING);
          throw new NotAttachedException(Status.NOT_RUNNING);
        }
 else {
          fireMessageSent("String_Node_Str");
          sendCommand("String_Node_Str");
          pinged=true;
          continue;
        }
      }
      if (response.startsWith("String_Node_Str")) {
        pinged=false;
        continue;
      }
 else {
        return response;
      }
    }
  }
  finally {
    removeConnectorListener(listener);
  }
}