storm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ptgo...@apache.org
Subject [1/3] git commit: clean up fd after reading config
Date Fri, 11 Apr 2014 15:20:55 GMT
Repository: incubator-storm
Updated Branches:
  refs/heads/master 6c1af3e5b -> 1be3d0f65


clean up fd after reading config


Project: http://git-wip-us.apache.org/repos/asf/incubator-storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-storm/commit/9da324e1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-storm/tree/9da324e1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-storm/diff/9da324e1

Branch: refs/heads/master
Commit: 9da324e12ff12dec97490197063ff35f6935ca93
Parents: 2cd8f99
Author: Derek Dagit <derekd@yahoo-inc.com>
Authored: Thu Apr 10 21:38:45 2014 +0000
Committer: Derek Dagit <derekd@yahoo-inc.com>
Committed: Thu Apr 10 21:38:45 2014 +0000

----------------------------------------------------------------------
 storm-core/src/jvm/backtype/storm/utils/Utils.java | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/9da324e1/storm-core/src/jvm/backtype/storm/utils/Utils.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/backtype/storm/utils/Utils.java b/storm-core/src/jvm/backtype/storm/utils/Utils.java
index 0e04728..7979e4b 100644
--- a/storm-core/src/jvm/backtype/storm/utils/Utils.java
+++ b/storm-core/src/jvm/backtype/storm/utils/Utils.java
@@ -29,6 +29,7 @@ import com.netflix.curator.retry.ExponentialBackoffRetry;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.FileOutputStream;
+import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.IOException;
 import java.io.ObjectInputStream;
@@ -135,7 +136,13 @@ public class Utils {
             }
             URL resource = resources.iterator().next();
             Yaml yaml = new Yaml();
-            Map ret = (Map) yaml.load(new InputStreamReader(resource.openStream()));
+            Map ret = null;
+            InputStream input = resource.openStream();
+            try {
+                ret = (Map) yaml.load(new InputStreamReader(input));
+            } finally {
+                input.close();
+            }
             if(ret==null) ret = new HashMap();
             
 


Mime
View raw message