Program: 3121
Project: 3121
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.
 * @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 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);
  }
}

Fixed version (ground truth):
/** 
 * Send a Skype command to Skype (actual implementation method) and wait for response.
 * @param command the command to send.
 * @param responseChecker the response checker.
 * @param checkAttached if true the connector will first check if it is connected.
 * @return the response future.
 * @throws ConnectorException thrown when the connection to the Skype client has gone bad.
 */
private Future<String> execute(final String command,final NotificationChecker responseChecker,final boolean checkAttached,boolean withoutTimeout) throws ConnectorException {
  ConnectorUtils.checkNotNull("String_Node_Str",command);
  ConnectorUtils.checkNotNull("String_Node_Str",responseChecker);
  if (checkAttached) {
    assureAttached();
  }
  return _commandExecutor.submit(new Callable<String>(){
    public String call() throws Exception {
      final BlockingQueue<String> responses=new LinkedBlockingQueue<String>();
      ConnectorListener listener=new AbstractConnectorListener(){
        public void messageReceived(        ConnectorMessageEvent event){
          String message=event.getMessage();
          if (responseChecker.isTarget(message) || message.startsWith("String_Node_Str")) {
            responses.add(message);
          }
        }
      }
;
      addConnectorListener(listener,false);
      fireMessageSent(command);
      sendCommand(command);
      try {
        boolean pinged=false;
        while (true) {
          String response=responses.poll(getCommandTimeout(),TimeUnit.MILLISECONDS);
          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);
      }
    }
  }
);
}