CLOUDSTACK-3139 - If management server doesn't have internet connection RegisterTemplate and UploadVolume will fail when CS tries to verify if the account has exceeded its secondary storage limit.

No change in behavior if management server has internet connection.
Now if management server doesn't have internet connection download process will not fail. But CS will noly check if the account has already reached or maxed its limits instead of checking if the limit will be breached with the addition of the new storage
This commit is contained in:
Likitha Shetty 2013-07-30 16:54:09 +05:30
parent 3364e29640
commit 6cbcd9777d
1 changed files with 8 additions and 8 deletions

View File

@ -110,22 +110,22 @@ public class UriUtils {
URI uri = new URI(url);
if(uri.getScheme().equalsIgnoreCase("http")) {
httpConn = (HttpURLConnection) uri.toURL().openConnection();
remoteSize = Long.parseLong(httpConn.getHeaderField("content-length"));
if (httpConn != null) {
remoteSize = Long.parseLong(httpConn.getHeaderField("content-length"));
httpConn.disconnect();
}
}
else if(uri.getScheme().equalsIgnoreCase("https")) {
httpsConn = (HttpsURLConnection) uri.toURL().openConnection();
remoteSize = Long.parseLong(httpsConn.getHeaderField("content-length"));
if (httpsConn != null) {
remoteSize = Long.parseLong(httpsConn.getHeaderField("content-length"));
httpsConn.disconnect();
}
}
} catch (URISyntaxException e) {
throw new IllegalArgumentException("Invalid URL " + url);
} catch (IOException e) {
throw new IllegalArgumentException("Unable to establish connection with URL " + url);
} finally {
if (httpConn != null) {
httpConn.disconnect();
} else if (httpsConn != null) {
httpsConn.disconnect();
}
}
return remoteSize;
}