From 9c0ac8b712db643f83c73b0bfbb1543a5a61f984 Mon Sep 17 00:00:00 2001 From: stepancheg Date: Sun, 22 Feb 2009 20:23:39 +0000 Subject: scala.util.Properties: release InputStream afte... scala.util.Properties: release InputStream after properties loading --- src/library/scala/util/Properties.scala | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/library/scala/util/Properties.scala b/src/library/scala/util/Properties.scala index 5bbb898651..8e8e1d8d9c 100644 --- a/src/library/scala/util/Properties.scala +++ b/src/library/scala/util/Properties.scala @@ -25,8 +25,19 @@ object Properties { private val props = { val props = new java.util.Properties val stream = classOf[Application].getResourceAsStream(propFilename) - if (stream != null) - props.load(stream) + try { + if (stream != null) + props.load(stream) + } finally { + if (stream != null) { + // close quietly + try { + stream.close() + } catch { + case _ => + } + } + } props } -- cgit v1.2.3