Program: 48501
Project: 48501
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.HTTPS_CONNECTION_PREFIX + host + Constants.HTTPS_CONNECTION_LOGIN_SUFFIX;
  Connect.ConnectType connectType=null;
  try {
    LoginResponse response=loginClient.login(hostUri,username,password);
    if (response.getResponseCode() == HttpStatus.OK.value()) {
      if (CommonUtil.isBlank(response.getSessionId())) {
        System.out.println(Constants.CONNECT_FAILURE_NO_SESSION_ID);
        connectType=Connect.ConnectType.ERROR;
      }
 else {
        updateHostProperty(host);
        writeCookieInfo(response.getSessionId());
        System.out.println(Constants.CONNECT_SUCCESS);
        connectType=Connect.ConnectType.SUCCESS;
      }
    }
 else     if (response.getResponseCode() == HttpStatus.UNAUTHORIZED.value()) {
      System.out.println(Constants.CONNECT_UNAUTHORIZATION_CONNECT);
      hostUri=oldHostUri;
      connectType=Connect.ConnectType.UNAUTHORIZATION;
    }
 else     if (response.getResponseCode() == HttpStatus.INTERNAL_SERVER_ERROR.value()) {
      System.out.println(HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase());
      connectType=Connect.ConnectType.ERROR;
    }
 else {
      System.out.println(String.format(Constants.UNSUPPORTED_HTTP_RESPONSE_CODE,response.getResponseCode()));
      hostUri=oldHostUri;
      connectType=Connect.ConnectType.ERROR;
    }
  }
 catch (  Exception e) {
    System.out.println(Constants.CONNECT_FAILURE + "String_Node_Str" + (CommandsUtils.getExceptionMessage(e)));
    connectType=Connect.ConnectType.ERROR;
  }
  return connectType;
}

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.HTTPS_CONNECTION_PREFIX + host + Constants.HTTPS_CONNECTION_LOGIN_SUFFIX;
  Connect.ConnectType connectType=null;
  try {
    LoginResponse response=loginClient.login(hostUri,username,password);
    if (response.getResponseCode() == HttpStatus.OK.value()) {
      if (CommonUtil.isBlank(response.getSessionId())) {
        if (isConnected()) {
          System.out.println(Constants.CONNECTION_ALREADY_ESTABLISHED);
          connectType=Connect.ConnectType.SUCCESS;
        }
 else {
          System.out.println(Constants.CONNECT_FAILURE_NO_SESSION_ID);
          connectType=Connect.ConnectType.ERROR;
        }
      }
 else {
        updateHostProperty(host);
        writeCookieInfo(response.getSessionId());
        System.out.println(Constants.CONNECT_SUCCESS);
        connectType=Connect.ConnectType.SUCCESS;
      }
    }
 else     if (response.getResponseCode() == HttpStatus.UNAUTHORIZED.value()) {
      System.out.println(Constants.CONNECT_UNAUTHORIZATION_CONNECT);
      hostUri=oldHostUri;
      connectType=Connect.ConnectType.UNAUTHORIZATION;
    }
 else     if (response.getResponseCode() == HttpStatus.INTERNAL_SERVER_ERROR.value()) {
      System.out.println(HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase());
      connectType=Connect.ConnectType.ERROR;
    }
 else {
      System.out.println(String.format(Constants.UNSUPPORTED_HTTP_RESPONSE_CODE,response.getResponseCode()));
      hostUri=oldHostUri;
      connectType=Connect.ConnectType.ERROR;
    }
  }
 catch (  Exception e) {
    System.out.println(Constants.CONNECT_FAILURE + "String_Node_Str" + (CommandsUtils.getExceptionMessage(e)));
    connectType=Connect.ConnectType.ERROR;
  }
  return connectType;
}