Program: 105905
Project: 105905
Buggy source:
@Override public void send(Request req,Listener listener) throws AgentUnavailableException {
  if (_link != null) {
    super.send(req,listener);
    return;
  }
  long seq=req.getSequence();
  if (listener != null) {
    registerListener(req.getSequence(),listener);
  }
  if (_transferMode) {
    if (s_logger.isDebugEnabled()) {
      s_logger.debug(log(seq,"String_Node_Str"));
    }
synchronized (this) {
      addRequestToTransfer(req);
      return;
    }
  }
  if (s_clusteredAgentMgr == null) {
    throw new AgentUnavailableException("String_Node_Str",_id);
  }
  int i=0;
  SocketChannel ch=null;
  boolean error=true;
  try {
    while (i++ < 5) {
      String peerName=s_clusteredAgentMgr.findPeer(_id);
      if (peerName == null) {
        throw new AgentUnavailableException("String_Node_Str",_id);
      }
      ch=s_clusteredAgentMgr.connectToPeer(peerName,ch);
      if (ch == null) {
        if (s_logger.isDebugEnabled()) {
          s_logger.debug(log(seq,"String_Node_Str" + req.toString()));
        }
        continue;
      }
      SSLEngine sslEngine=s_clusteredAgentMgr.getSSLEngine(peerName);
      if (sslEngine == null) {
        throw new AgentUnavailableException("String_Node_Str" + peerName,_id);
      }
      try {
        if (s_logger.isDebugEnabled()) {
          s_logger.debug(log(seq,"String_Node_Str" + req.toString() + "String_Node_Str"+ peerName));
        }
        if (req.executeInSequence() && listener != null && listener instanceof SynchronousListener) {
          SynchronousListener synchronous=(SynchronousListener)listener;
          synchronous.setPeer(peerName);
        }
        Link.write(ch,req.toBytes(),sslEngine);
        error=false;
        return;
      }
 catch (      IOException e) {
        if (s_logger.isDebugEnabled()) {
          s_logger.debug(log(seq,"String_Node_Str" + req.toString() + "String_Node_Str"+ i));
        }
        if (s_logger.isInfoEnabled()) {
          s_logger.info("String_Node_Str" + e.getMessage() + "String_Node_Str"+ peerName+ "String_Node_Str");
        }
      }
    }
  }
  finally {
    if (error) {
      unregisterListener(seq);
    }
  }
  throw new AgentUnavailableException("String_Node_Str",_id);
}

Fixed version (ground truth):
@Override public void send(final Request req,final Listener listener) throws AgentUnavailableException {
  if (_link != null) {
    super.send(req,listener);
    return;
  }
  long seq=req.getSequence();
  if (listener != null) {
    registerListener(req.getSequence(),listener);
  }
  if (_transferMode) {
    if (s_logger.isDebugEnabled()) {
      s_logger.debug(log(seq,"String_Node_Str"));
    }
synchronized (this) {
      addRequestToTransfer(req);
      return;
    }
  }
  if (s_clusteredAgentMgr == null) {
    throw new AgentUnavailableException("String_Node_Str",_id);
  }
  int i=0;
  SocketChannel ch=null;
  boolean error=true;
  try {
    while (i++ < 5) {
      String peerName=s_clusteredAgentMgr.findPeer(_id);
      if (peerName == null) {
        throw new AgentUnavailableException("String_Node_Str",_id);
      }
      ch=s_clusteredAgentMgr.connectToPeer(peerName,ch);
      if (ch == null) {
        if (s_logger.isDebugEnabled()) {
          s_logger.debug(log(seq,"String_Node_Str" + req.toString()));
        }
        continue;
      }
      SSLEngine sslEngine=s_clusteredAgentMgr.getSSLEngine(peerName);
      if (sslEngine == null) {
        throw new AgentUnavailableException("String_Node_Str" + peerName,_id);
      }
      try {
        if (s_logger.isDebugEnabled()) {
          s_logger.debug(log(seq,"String_Node_Str" + req.toString() + "String_Node_Str"+ peerName));
        }
        if (req.executeInSequence() && listener != null && listener instanceof SynchronousListener) {
          SynchronousListener synchronous=(SynchronousListener)listener;
          synchronous.setPeer(peerName);
        }
        Link.write(ch,req.toBytes(),sslEngine);
        error=false;
        return;
      }
 catch (      IOException e) {
        if (s_logger.isDebugEnabled()) {
          s_logger.debug(log(seq,"String_Node_Str" + req.toString() + "String_Node_Str"+ i));
        }
        if (s_logger.isInfoEnabled()) {
          s_logger.info("String_Node_Str" + e.getMessage() + "String_Node_Str"+ peerName+ "String_Node_Str");
        }
      }
    }
  }
  finally {
    if (error) {
      unregisterListener(seq);
    }
  }
  throw new AgentUnavailableException("String_Node_Str",_id);
}