aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhang, Liye <liye.zhang@intel.com>2015-04-28 10:24:00 -0700
committerReynold Xin <rxin@databricks.com>2015-04-28 10:24:00 -0700
commit52ccf1d3739694826915cdf01642bab02958eb78 (patch)
tree404ad2a64e72471f6deb92536eac44e37383863c
parentb14cd2364932e504695bcc49486ffb4518fdf33d (diff)
downloadspark-52ccf1d3739694826915cdf01642bab02958eb78.tar.gz
spark-52ccf1d3739694826915cdf01642bab02958eb78.tar.bz2
spark-52ccf1d3739694826915cdf01642bab02958eb78.zip
[Core][test][minor] replace try finally block with tryWithSafeFinally
Author: Zhang, Liye <liye.zhang@intel.com> Closes #5739 from liyezhang556520/trySafeFinally and squashes the following commits: 55683e5 [Zhang, Liye] replace try finally block with tryWithSafeFinally
-rw-r--r--core/src/test/scala/org/apache/spark/deploy/history/FsHistoryProviderSuite.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/src/test/scala/org/apache/spark/deploy/history/FsHistoryProviderSuite.scala b/core/src/test/scala/org/apache/spark/deploy/history/FsHistoryProviderSuite.scala
index fcae603c7d..9e367a0d9a 100644
--- a/core/src/test/scala/org/apache/spark/deploy/history/FsHistoryProviderSuite.scala
+++ b/core/src/test/scala/org/apache/spark/deploy/history/FsHistoryProviderSuite.scala
@@ -224,9 +224,9 @@ class FsHistoryProviderSuite extends FunSuite with BeforeAndAfter with Matchers
EventLoggingListener.initEventLog(new FileOutputStream(file))
}
val writer = new OutputStreamWriter(bstream, "UTF-8")
- try {
+ Utils.tryWithSafeFinally {
events.foreach(e => writer.write(compact(render(JsonProtocol.sparkEventToJson(e))) + "\n"))
- } finally {
+ } {
writer.close()
}
}