private HttpClient login() throws Exception {
    HttpClient client = getHttpClient();
    GetMethod method = new GetMethod(getUrl() + "/projects.xml");
    configureHttpMethod(method);
    client.getParams().setContentCharset("UTF-8");
    client.executeMethod(method);
    if (method.getStatusCode() != 200) {
      throw new Exception("Cannot login: HTTP returned " + method.getStatusCode());
    }
    String response = method.getResponseBodyAsString();
    if (response == null) {
      throw new NullPointerException();
    }
    if (response.contains("<errors>")) {
      int pos = response.indexOf("</errors>");
      int length = "<errors>".length();
      if (pos > length) {
        response = response.substring(length, pos);
      }
      throw new Exception("Cannot login: " + response);
    }
    return client;
  }
private HttpClient login()