Program: 95141
Project: 95141
Buggy source:
public void connect(ID remote,IConnectContext joinContext) throws ContainerConnectException {
  fireContainerEvent(new ContainerConnectingEvent(this.getID(),remote,joinContext));
  try {
    if (isClosing)     throw new IllegalStateException("String_Node_Str");
    debug("String_Node_Str" + remote + "String_Node_Str"+ joinContext);
    ISynchAsynchConnection aConnection=createConnection(remote,joinContext);
    Object response=null;
synchronized (connectLock) {
      if (isConnected()) {
        killConnection(aConnection);
        aConnection=null;
        throw new ConnectException("String_Node_Str" + getConnectedID());
      }
      if (isConnecting()) {
        killConnection(aConnection);
        aConnection=null;
        throw new ConnectException("String_Node_Str");
      }
      connectionState=CONNECTING;
      connection=aConnection;
    }
    Callback[] callbacks=createAuthorizationCallbacks();
    if (joinContext != null) {
      CallbackHandler handler=joinContext.getCallbackHandler();
      if (handler != null) {
        handler.handle(callbacks);
      }
    }
synchronized (aConnection) {
      try {
        Object connectData=createConnectData(remote,callbacks,null);
        response=aConnection.connect(remote,connectData,getConnectTimeout());
      }
 catch (      IOException e) {
synchronized (connectLock) {
          killConnection(aConnection);
          if (connection != aConnection) {
            aConnection=null;
            throw e;
          }
          connectionState=UNCONNECTED;
          connection=null;
          remoteServerID=null;
        }
        throw e;
      }
synchronized (connectLock) {
        if (connection != aConnection) {
          killConnection(aConnection);
          aConnection=null;
          throw new ConnectException("String_Node_Str");
        }
        ID serverID=null;
        try {
          serverID=handleConnectResponse(remote,response);
        }
 catch (        Exception e) {
          killConnection(aConnection);
          aConnection=null;
          connection=null;
          remoteServerID=null;
          connectionState=UNCONNECTED;
          throw new ConnectException("String_Node_Str");
        }
        aConnection.start();
        remoteServerID=serverID;
        connectionState=CONNECTED;
      }
    }
  }
 catch (  Exception e) {
    dumpStack("String_Node_Str",e);
    ContainerConnectException except=new ContainerConnectException("String_Node_Str" + remote.getName(),e);
    throw except;
  }
}

Fixed version (ground truth):
public void connect(ID remote,IConnectContext joinContext) throws ContainerConnectException {
  fireContainerEvent(new ContainerConnectingEvent(this.getID(),remote,joinContext));
  try {
    if (isClosing)     throw new IllegalStateException("String_Node_Str");
    debug("String_Node_Str" + remote + "String_Node_Str"+ joinContext+ "String_Node_Str");
    ISynchAsynchConnection aConnection=createConnection(remote,joinContext);
    Object response=null;
synchronized (getConnectLock()) {
      if (isConnected()) {
        killConnection(aConnection);
        throw new ConnectException("String_Node_Str" + getConnectedID());
      }
      if (isConnecting()) {
        killConnection(aConnection);
        throw new ConnectException("String_Node_Str");
      }
      setStateConnecting(aConnection);
    }
    Callback[] callbacks=createAuthorizationCallbacks();
    if (joinContext != null) {
      CallbackHandler handler=joinContext.getCallbackHandler();
      if (handler != null) {
        handler.handle(callbacks);
      }
    }
synchronized (connectLock) {
synchronized (aConnection) {
        try {
          Object connectData=createConnectData(remote,callbacks,null);
          response=aConnection.connect(remote,connectData,getConnectTimeout());
        }
 catch (        IOException e) {
          if (getConnection() != aConnection)           killConnection(aConnection);
 else           setStateUnconnected(aConnection);
          throw e;
        }
        if (getConnection() != aConnection) {
          killConnection(aConnection);
          throw new ConnectException("String_Node_Str");
        }
        ID serverID=null;
        try {
          serverID=handleConnectResponse(remote,response);
        }
 catch (        Exception e) {
          setStateUnconnected(aConnection);
          throw new ConnectException("String_Node_Str");
        }
        aConnection.start();
        setStateConnected(serverID,aConnection);
      }
    }
  }
 catch (  Exception e) {
    dumpStack("String_Node_Str",e);
    ContainerConnectException except=new ContainerConnectException("String_Node_Str" + remote.getName(),e);
    throw except;
  }
}