Program: 49165
Project: 49165
Buggy source:
/** 
 * connect to a Serengeti server
 * @param host host url with optional port
 * @param username serengeti login user name
 * @param password serengeti password
 */
public Connect.ConnectType connect(final String host,final String username,final String password){
  String oldHostUri=hostUri;
  hostUri=Constants.HTTP_CONNECTION_PREFIX + host + Constants.HTTP_CONNECTION_LOGIN_SUFFIX;
  try {
    ResponseEntity<String> response=login(Constants.REST_PATH_LOGIN,String.class,username,password);
    if (response.getStatusCode() == HttpStatus.OK) {
      updateHostproperty(host);
      String cookieValue=response.getHeaders().getFirst("String_Node_Str");
      if (cookieValue.contains("String_Node_Str")) {
        cookieValue=cookieValue.split("String_Node_Str")[0];
      }
      writeCookieInfo(cookieValue);
      System.out.println(Constants.CONNECT_SUCCESS);
    }
 else {
      System.out.println(Constants.CONNECT_FAILURE);
      hostUri=oldHostUri;
      return Connect.ConnectType.ERROR;
    }
  }
 catch (  CliRestException cliRestException) {
    if (cliRestException.getStatus() == HttpStatus.UNAUTHORIZED) {
      System.out.println(Constants.CONNECT_UNAUTHORIZATION);
      hostUri=oldHostUri;
      return Connect.ConnectType.UNAUTHORIZATION;
    }
  }
catch (  Exception e) {
    System.out.println(Constants.CONNECT_FAILURE + "String_Node_Str" + e.getCause().getMessage().toLowerCase());
    return Connect.ConnectType.ERROR;
  }
  return Connect.ConnectType.SUCCESS;
}

Fixed version (ground truth):
/** 
 * connect to a Serengeti server
 * @param host host url with optional port
 * @param username serengeti login user name
 * @param password serengeti password
 */
public Connect.ConnectType connect(final String host,final String username,final String password){
  String oldHostUri=hostUri;
  hostUri=Constants.HTTP_CONNECTION_PREFIX + host + Constants.HTTP_CONNECTION_LOGIN_SUFFIX;
  try {
    ResponseEntity<String> response=login(Constants.REST_PATH_LOGIN,String.class,username,password);
    if (response.getStatusCode() == HttpStatus.OK) {
      updateHostproperty(host);
      String cookieValue=response.getHeaders().getFirst("String_Node_Str");
      if (cookieValue.contains("String_Node_Str")) {
        cookieValue=cookieValue.split("String_Node_Str")[0];
      }
      writeCookieInfo(cookieValue);
      System.out.println(Constants.CONNECT_SUCCESS);
    }
 else {
      System.out.println(Constants.CONNECT_FAILURE);
      hostUri=oldHostUri;
      return Connect.ConnectType.ERROR;
    }
  }
 catch (  CliRestException cliRestException) {
    if (cliRestException.getStatus() == HttpStatus.UNAUTHORIZED) {
      System.out.println(Constants.CONNECT_UNAUTHORIZATION);
      hostUri=oldHostUri;
      return Connect.ConnectType.UNAUTHORIZATION;
    }
 else {
      System.out.println(Constants.CONNECT_FAILURE + "String_Node_Str" + cliRestException.getStatus()+ "String_Node_Str"+ cliRestException.getMessage().toLowerCase());
      return Connect.ConnectType.ERROR;
    }
  }
catch (  Exception e) {
    System.out.println(Constants.CONNECT_FAILURE + "String_Node_Str" + e.getCause().getMessage().toLowerCase());
    return Connect.ConnectType.ERROR;
  }
  return Connect.ConnectType.SUCCESS;
}