Program: 94330
Project: 94330
Buggy source:
public synchronized Object connect(ID remote,Object data,int timeout) throws ECFException {
  if (connection != null)   throw new ECFException("String_Node_Str");
  if (timeout > 0)   SmackConfiguration.setPacketReplyTimeout(timeout);
  Roster.setDefaultSubscriptionMode(Roster.SubscriptionMode.manual);
  final XMPPID jabberURI=getXMPPID(remote);
  String username=jabberURI.getNodename();
  String hostname=jabberURI.getHostname();
  String hostnameOverride=null;
  int semiColonIdx=hostname.lastIndexOf(';');
  if (semiColonIdx != -1) {
    hostnameOverride=hostname.substring(semiColonIdx + 1);
    hostname=hostname.substring(0,semiColonIdx);
  }
  if (google && hostnameOverride == null) {
    hostnameOverride=GOOGLE_TALK_HOST;
  }
  final String serviceName=hostname;
  serverPort=jabberURI.getPort();
  serverResource=jabberURI.getResourceName();
  if (serverResource == null || serverResource.equals(XMPPID.PATH_DELIMITER)) {
    serverResource=getClientIdentifier();
    jabberURI.setResourceName(serverResource);
  }
  try {
    ConnectionConfiguration config;
    if (hostnameOverride != null) {
      config=new ConnectionConfiguration(hostnameOverride,XMPP_DEFAULT_PORT,serviceName);
    }
 else     if (serverPort == -1) {
      config=new ConnectionConfiguration(serviceName);
    }
 else {
      config=new ConnectionConfiguration(serviceName,serverPort);
    }
    config.setSendPresence(true);
    connection=new XMPPConnection(config);
    connection.connect();
    SASLAuthentication.supportSASLMechanism("String_Node_Str",0);
    if (google || GOOGLE_TALK_HOST.equals(hostnameOverride)) {
      username=username + "String_Node_Str" + serviceName;
    }
    connection.addPacketListener(packetListener,null);
    connection.addConnectionListener(connectionListener);
    connection.login(username,(String)data,serverResource);
    isConnected=true;
  }
 catch (  final XMPPException e) {
    throw new ContainerConnectException("String_Node_Str",e);
  }
  return null;
}

Fixed version (ground truth):
public synchronized Object connect(ID remote,Object data,int timeout) throws ECFException {
  if (connection != null)   throw new ECFException("String_Node_Str");
  if (timeout > 0)   SmackConfiguration.setPacketReplyTimeout(timeout);
  Roster.setDefaultSubscriptionMode(Roster.SubscriptionMode.manual);
  final XMPPID jabberURI=getXMPPID(remote);
  String username=jabberURI.getNodename();
  String hostname=jabberURI.getHostname();
  String hostnameOverride=null;
  int semiColonIdx=hostname.lastIndexOf(';');
  if (semiColonIdx != -1) {
    hostnameOverride=hostname.substring(semiColonIdx + 1);
    hostname=hostname.substring(0,semiColonIdx);
  }
  if (google && hostnameOverride == null) {
    hostnameOverride=GOOGLE_TALK_HOST;
  }
  final String serviceName=hostname;
  serverPort=jabberURI.getPort();
  serverResource=jabberURI.getResourceName();
  if (serverResource == null || serverResource.equals(XMPPID.PATH_DELIMITER)) {
    serverResource=getClientIdentifier();
    jabberURI.setResourceName(serverResource);
  }
  try {
    ConnectionConfiguration config;
    if (hostnameOverride != null) {
      config=new ConnectionConfiguration(hostnameOverride,XMPP_DEFAULT_PORT,serviceName);
    }
 else     if (serverPort == -1) {
      config=new ConnectionConfiguration(serviceName);
    }
 else {
      config=new ConnectionConfiguration(serviceName,serverPort);
    }
    config.setSendPresence(true);
    connection=new XMPPConnection(config);
    connection.connect();
    SASLAuthentication.supportSASLMechanism("String_Node_Str",0);
    if (google || GOOGLE_TALK_HOST.equals(hostnameOverride)) {
      username=username + "String_Node_Str" + serviceName;
    }
    connection.addPacketListener(packetListener,null);
    connection.addConnectionListener(connectionListener);
    connection.login(username,(String)data,serverResource);
    waitForBindResult();
  }
 catch (  final XMPPException e) {
    throw new ContainerConnectException("String_Node_Str",e);
  }
  return jid;
}