Updated Branches:
  refs/heads/4.2 03cbf51e1 -> 8392a6eec

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/8392a6ee
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8392a6ee
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8392a6ee

Branch: refs/heads/4.2
Commit: 8392a6eec1f47100abb8340a61ab01fbc9f72b36
Parents: 03cbf51
Author: Likitha Shetty <[email protected]>
Authored: Tue Jul 30 16:54:09 2013 +0530
Committer: Likitha Shetty <[email protected]>
Committed: Tue Jul 30 19:33:19 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/8392a6ee/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;
     }

Reply via email to