cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [01/13] git commit: updated refs/heads/master to d32d6a2
Date Mon, 03 Aug 2015 21:45:00 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 118e954d0 -> d32d6a24a


CLOUDSTACK-8656: handle template properties loading

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/65dc1d5d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/65dc1d5d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/65dc1d5d

Branch: refs/heads/master
Commit: 65dc1d5dbae779939eb45e7aad70110acf260d85
Parents: 2ae2aac
Author: Daan Hoogland <daan@onecht.net>
Authored: Sun Aug 2 12:48:34 2015 +0200
Committer: Daan Hoogland <daan@onecht.net>
Committed: Sun Aug 2 12:48:34 2015 +0200

----------------------------------------------------------------------
 .../storage/template/TemplateLocation.java      | 24 ++++----------------
 1 file changed, 4 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/65dc1d5d/core/src/com/cloud/storage/template/TemplateLocation.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/template/TemplateLocation.java b/core/src/com/cloud/storage/template/TemplateLocation.java
index 87f56b8..ea785b2 100644
--- a/core/src/com/cloud/storage/template/TemplateLocation.java
+++ b/core/src/com/cloud/storage/template/TemplateLocation.java
@@ -94,17 +94,10 @@ public class TemplateLocation {
     }
 
     public boolean load() throws IOException {
-        FileInputStream strm = null;
-        try {
-            strm = new FileInputStream(_file);
+        try (FileInputStream strm = new FileInputStream(_file);) {
             _props.load(strm);
-        } finally {
-            if (strm != null) {
-                try {
-                    strm.close();
-                } catch (IOException e) {
-                }
-            }
+        } catch (IOException e) {
+            s_logger.warn("Unable to load the template properties", e);
         }
 
         for (ImageFormat format : ImageFormat.values()) {
@@ -142,20 +135,11 @@ public class TemplateLocation {
             _props.setProperty(info.format.getFileExtension() + ".size", Long.toString(info.size));
             _props.setProperty(info.format.getFileExtension() + ".virtualsize", Long.toString(info.virtualSize));
         }
-        FileOutputStream strm = null;
-        try {
-            strm = new FileOutputStream(_file);
+        try (FileOutputStream strm =  new FileOutputStream(_file);) {
             _props.store(strm, "");
         } catch (IOException e) {
             s_logger.warn("Unable to save the template properties ", e);
             return false;
-        } finally {
-            if (strm != null) {
-                try {
-                    strm.close();
-                } catch (IOException e) {
-                }
-            }
         }
         return true;
     }


Mime
View raw message