Program: 115683
Project: 115683
Buggy source:
/** 
 * Authenticate and login to stratos server.
 * @param serverURL     URL of the server
 * @param username      username
 * @param password      password
 * @param validateLogin validate login
 * @return boolean
 * @throws Exception
 */
public boolean login(String serverURL,String username,String password,boolean validateLogin) throws Exception {
  try {
    SSLContext sc=SSLContext.getInstance("String_Node_Str");
    HostnameVerifier hv=new HostnameVerifier(){
      public boolean verify(      String urlHostName,      SSLSession session){
        return true;
      }
    }
;
    TrustManager[] trustAllCerts=new TrustManager[]{new X509TrustManager(){
      public java.security.cert.X509Certificate[] getAcceptedIssuers(){
        return null;
      }
      public void checkClientTrusted(      java.security.cert.X509Certificate[] certs,      String authType){
      }
      public void checkServerTrusted(      java.security.cert.X509Certificate[] certs,      String authType){
      }
    }
};
    sc.init(null,trustAllCerts,new java.security.SecureRandom());
    SSLContext.setDefault(sc);
    HttpsURLConnection.setDefaultHostnameVerifier(hv);
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str",e);
  }
  try {
    initializeRestClient(serverURL,username,password);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str",username);
    }
  }
 catch (  AxisFault e) {
    String message="String_Node_Str";
    printError(message,e);
    throw new CommandException(e);
  }
  DefaultHttpClient httpClient=new DefaultHttpClient();
  try {
    if (validateLogin) {
      HttpResponse response=restClient.doGet(httpClient,restClient.getBaseURL() + ENDPOINT_INIT);
      if (response != null) {
        int responseCode=response.getStatusLine().getStatusCode();
        if (responseCode == 200) {
          return true;
        }
 else {
          System.out.println("String_Node_Str");
        }
      }
      return false;
    }
 else {
      return true;
    }
  }
 catch (  ConnectException e) {
    String message="String_Node_Str";
    printError(message,e);
    return false;
  }
catch (  java.lang.NoSuchMethodError e) {
    String message="String_Node_Str";
    printError(message,e);
    return false;
  }
catch (  Exception e) {
    String message="String_Node_Str" + e.getMessage();
    printError(message,e);
    return false;
  }
 finally {
    httpClient.getConnectionManager().shutdown();
  }
}

Fixed version (ground truth):
/** 
 * Authenticate and login to stratos server.
 * @param serverURL     URL of the server
 * @param username      username
 * @param password      password
 * @param validateLogin validate login
 * @return boolean
 * @throws Exception
 */
public boolean login(String serverURL,String username,String password,boolean validateLogin) throws Exception {
  try {
    SSLContext sc=SSLContext.getInstance("String_Node_Str");
    HostnameVerifier hv=new HostnameVerifier(){
      public boolean verify(      String urlHostName,      SSLSession session){
        return true;
      }
    }
;
    TrustManager[] trustAllCerts=new TrustManager[]{new X509TrustManager(){
      public java.security.cert.X509Certificate[] getAcceptedIssuers(){
        return null;
      }
      public void checkClientTrusted(      java.security.cert.X509Certificate[] certs,      String authType){
      }
      public void checkServerTrusted(      java.security.cert.X509Certificate[] certs,      String authType){
      }
    }
};
    sc.init(null,trustAllCerts,new java.security.SecureRandom());
    SSLContext.setDefault(sc);
    HttpsURLConnection.setDefaultHostnameVerifier(hv);
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str",e);
  }
  try {
    initializeRestClient(serverURL,username,password);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str",username);
    }
  }
 catch (  AxisFault e) {
    String message="String_Node_Str";
    printError(message,e);
    throw new CommandException(e);
  }
  DefaultHttpClient httpClient=new DefaultHttpClient();
  try {
    if (validateLogin) {
      HttpResponse response=restClient.doGet(httpClient,restClient.getBaseURL() + ENDPOINT_INIT);
      if (response != null) {
        int responseCode=response.getStatusLine().getStatusCode();
        if (responseCode == 200) {
          return true;
        }
 else {
          System.out.println("String_Node_Str");
        }
      }
      return false;
    }
 else {
      return true;
    }
  }
 catch (  ConnectException e) {
    String message="String_Node_Str";
    printError(message,e);
    return false;
  }
catch (  java.lang.NoSuchMethodError e) {
    String message="String_Node_Str";
    printError(message,e);
    return false;
  }
catch (  Exception e) {
    if (e.getCause() instanceof MalformedChallengeException) {
      String message="String_Node_Str";
      printError(message,e);
      return false;
    }
    String message="String_Node_Str" + e.getMessage();
    printError(message,e);
    return false;
  }
 finally {
    httpClient.getConnectionManager().shutdown();
  }
}