You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ko...@apache.org on 2014/02/09 22:25:12 UTC

[03/10] git commit: updated refs/heads/master to 8ed9162

safely close resource with java 1.7 resource block

Signed-off-by: Laszlo Hornyak <la...@gmail.com>


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

Branch: refs/heads/master
Commit: 3e3ded75f48abf748ab37cfade4ebfe69fdeffd7
Parents: 5e4fec9
Author: Laszlo Hornyak <la...@gmail.com>
Authored: Sun Feb 9 18:27:54 2014 +0100
Committer: Laszlo Hornyak <la...@gmail.com>
Committed: Sun Feb 9 18:27:54 2014 +0100

----------------------------------------------------------------------
 .../hypervisor/kvm/resource/LibvirtComputingResource.java | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e3ded75/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index 053dbc0..62c129b 100755
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -3324,13 +3324,11 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
         }
 
         if (pubKeyFile.exists()) {
-            String pubKey = cmd.getPubKey();
-            try {
-                FileOutputStream pubkStream = new FileOutputStream(pubKeyFile);
-                pubkStream.write(pubKey.getBytes());
-                pubkStream.close();
+            try (FileOutputStream pubkStream = new FileOutputStream(pubKeyFile)) {
+                pubkStream.write(cmd.getPubKey().getBytes());
             } catch (FileNotFoundException e) {
-                result = "File" + SSHPUBKEYPATH + "is not found:" + e.toString();
+                result = "File" + SSHPUBKEYPATH + "is not found:"
+                        + e.toString();
                 s_logger.debug(result);
             } catch (IOException e) {
                 result = "Write file " + SSHPUBKEYPATH + ":" + e.toString();