From 17caf79d158ca13776dff6d7461bba362b7a2f2f Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Mon, 2 Mar 2015 23:09:47 -0800 Subject: SI-7775 Exclude nulls when iterating sys props The previous fix to deal with concurrent modification of system properties doesn't handle null results introduced when a property is removed. This commit filters nulls for safety, and also adds a `names` method to `sys.SystemProperties`. The test is upgraded. --- src/compiler/scala/tools/cmd/Property.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/compiler/scala/tools/cmd') diff --git a/src/compiler/scala/tools/cmd/Property.scala b/src/compiler/scala/tools/cmd/Property.scala index b1d951a5c4..e6262a7e40 100644 --- a/src/compiler/scala/tools/cmd/Property.scala +++ b/src/compiler/scala/tools/cmd/Property.scala @@ -9,6 +9,7 @@ package cmd import nsc.io._ import java.util.Properties import java.io.FileInputStream +import scala.sys.SystemProperties /** Contains logic for translating a property key/value pair into * equivalent command line arguments. The default settings will @@ -58,7 +59,7 @@ trait Property extends Reference { returning(new Properties)(_ load new FileInputStream(file.path)) def systemPropertiesToOptions: List[String] = - propertiesToOptions(System.getProperties) + propertiesToOptions(new SystemProperties().toList) def propertiesToOptions(file: File): List[String] = propertiesToOptions(loadProperties(file)) -- cgit v1.2.3