openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rab...@apache.org
Subject [incubator-openwhisk] branch master updated: Fix potential resource leak in Wsk.scala (#2610)
Date Thu, 17 Aug 2017 02:18:42 GMT
This is an automated email from the ASF dual-hosted git repository.

rabbah pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new 45d4325  Fix potential resource leak in Wsk.scala (#2610)
45d4325 is described below

commit 45d4325072c5bc261f5cd375980476ca0d5d85cb
Author: Sayat <sayatez@gmail.com>
AuthorDate: Thu Aug 17 04:18:40 2017 +0200

    Fix potential resource leak in Wsk.scala (#2610)
---
 tests/src/test/scala/common/Wsk.scala | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/src/test/scala/common/Wsk.scala b/tests/src/test/scala/common/Wsk.scala
index 8b1ad6c..c648d9f 100644
--- a/tests/src/test/scala/common/Wsk.scala
+++ b/tests/src/test/scala/common/Wsk.scala
@@ -79,10 +79,13 @@ case class WskProps(
     token: String = "") {
     def overrides = Seq("-i", "--apihost", apihost, "--apiversion", apiversion)
     def writeFile(propsfile: File) = {
-        val propsStr = s"NAMESPACE=${namespace}\nAPIVERSION=${apiversion}\nAUTH=${authKey}\nAPIHOST=${apihost}\nAPIGW_ACCESS_TOKEN=${token}\n"
+        val propsStr = s"NAMESPACE=$namespace\nAPIVERSION=$apiversion\nAUTH=$authKey\nAPIHOST=$apihost\nAPIGW_ACCESS_TOKEN=$token\n"
         val bw = new BufferedWriter(new FileWriter(propsfile))
-        bw.write(propsStr)
-        bw.close()
+        try {
+            bw.write(propsStr)
+        } finally {
+            bw.close()
+        }
     }
 }
 

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <commits@openwhisk.apache.org>'].

Mime
View raw message