diff options
author | stepancheg <stepancheg@epfl.ch> | 2009-02-22 20:23:39 +0000 |
---|---|---|
committer | stepancheg <stepancheg@epfl.ch> | 2009-02-22 20:23:39 +0000 |
commit | 9c0ac8b712db643f83c73b0bfbb1543a5a61f984 (patch) | |
tree | c31b29f895691631c647ecf04cf67c2daf668a6a /src/library | |
parent | dad1f88d8ee9e106bd630afdc29684f6734379c6 (diff) | |
download | scala-9c0ac8b712db643f83c73b0bfbb1543a5a61f984.tar.gz scala-9c0ac8b712db643f83c73b0bfbb1543a5a61f984.tar.bz2 scala-9c0ac8b712db643f83c73b0bfbb1543a5a61f984.zip |
scala.util.Properties: release InputStream afte...
scala.util.Properties: release InputStream after properties loading
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/util/Properties.scala | 15 |
1 files changed, 13 insertions, 2 deletions
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 } |