summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-08-29 07:18:08 -0700
committerJason Zaugg <jzaugg@gmail.com>2013-08-29 07:18:08 -0700
commit7a0d983aedd8ad8f3f41a22ffa0ce4b6ab2f1523 (patch)
treee435303c2e36b38edd7cfb913306a9161a894bd2 /src/compiler
parentc9ef7f5a7e76887fdab775802bc7a81994bac362 (diff)
parent9d5ed33ef9b503f20506dbe3e410960069a99d0a (diff)
downloadscala-7a0d983aedd8ad8f3f41a22ffa0ce4b6ab2f1523.tar.gz
scala-7a0d983aedd8ad8f3f41a22ffa0ce4b6ab2f1523.tar.bz2
scala-7a0d983aedd8ad8f3f41a22ffa0ce4b6ab2f1523.zip
Merge pull request #2868 from retronym/ticket/7775
SI-7775 Harden against the shifting sands of System.getProperties
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/reflect/WrappedProperties.scala8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/reflect/WrappedProperties.scala b/src/compiler/scala/tools/reflect/WrappedProperties.scala
index c34edb8ba0..7ce0171c0b 100644
--- a/src/compiler/scala/tools/reflect/WrappedProperties.scala
+++ b/src/compiler/scala/tools/reflect/WrappedProperties.scala
@@ -26,9 +26,13 @@ trait WrappedProperties extends PropertiesTrait {
override def envOrElse(name: String, alt: String) = wrap(super.envOrElse(name, alt)) getOrElse alt
override def envOrNone(name: String) = wrap(super.envOrNone(name)).flatten
- def systemProperties: Iterator[(String, String)] = {
+ def systemProperties: List[(String, String)] = {
import scala.collection.JavaConverters._
- wrap(System.getProperties.asScala.iterator) getOrElse Iterator.empty
+ wrap {
+ val props = System.getProperties
+ // SI-7269 Be careful to avoid `ConcurrentModificationException` if another thread modifies the properties map
+ props.stringPropertyNames().asScala.toList.map(k => (k, props.get(k).asInstanceOf[String]))
+ } getOrElse Nil
}
}