Updated Branches: refs/heads/master 3364e2964 -> 6cbcd9777
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 Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6cbcd977 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6cbcd977 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6cbcd977 Branch: refs/heads/master Commit: 6cbcd9777deabd75dbe4694cc492276d2d8ad01b Parents: 3364e29 Author: Likitha Shetty <[email protected]> Authored: Tue Jul 30 16:54:09 2013 +0530 Committer: Likitha Shetty <[email protected]> Committed: Tue Jul 30 19:35:26 2013 +0530 ---------------------------------------------------------------------- utils/src/com/cloud/utils/UriUtils.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6cbcd977/utils/src/com/cloud/utils/UriUtils.java ---------------------------------------------------------------------- diff --git a/utils/src/com/cloud/utils/UriUtils.java b/utils/src/com/cloud/utils/UriUtils.java index b9d54d5..6618e44 100644 --- a/utils/src/com/cloud/utils/UriUtils.java +++ b/utils/src/com/cloud/utils/UriUtils.java @@ -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; }
