throw (IOException) new IOException("Cannot connect to "+location).initCause(e);
}
if (http.getResponseCode() == 401) { // need to authenticate
if (username == null || username.equals("")) {
throw new FailedLoginException("Server returned 401 " + http.getResponseMessage());
}
//TODO is it necessary to keep getting new http's ?
http = (HttpURLConnection) location.openConnection();
http.setRequestProperty("Authorization",
"Basic " + new String(Base64.encode((username + ":" + password).getBytes())));
http.connect();
if (http.getResponseCode() == 401) {
throw new FailedLoginException("Server returned 401 " + http.getResponseMessage());
} else if (http.getResponseCode() == 404) {
return null; // Not found at this repository
}
} else if (http.getResponseCode() == 404) {
return null; // Not found at this repository