summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/library/scala/util/Properties.scala15
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
}