Merge pull request #1893 from aerskine/0.13

Fixes #1881. Clone SystemProperties defending against ConcurrentModificationException
This commit is contained in:
eugene yokota 2015-03-02 10:30:34 -05:00
commit 0681649994
2 changed files with 14 additions and 1 deletions

View File

@ -0,0 +1,10 @@
[@aerskine]: https://github.com/aerskine
[1881]: https://github.com/sbt/sbt/issues/1881
### Fixes with compatibility implications
### Improvements
### Bug fixes
- Fixes sporadic ConcurrentModificationException from JUnitXmlTestsListener. [#1881][1881] by [@aerskine][@aerskine]

View File

@ -2,6 +2,7 @@ package sbt
import java.io.{ IOException, StringWriter, PrintWriter, File }
import java.net.InetAddress
import java.util.Hashtable
import scala.collection.mutable.ListBuffer
import scala.util.DynamicVariable
@ -27,7 +28,9 @@ class JUnitXmlTestsListener(val outputDir: String) extends TestsListener {
val properties =
<properties>
{
val iter = System.getProperties.entrySet.iterator
// create a clone, defending against [[ConcurrentModificationException]]
val clonedProperties = System.getProperties.clone.asInstanceOf[Hashtable[AnyRef, AnyRef]]
val iter = clonedProperties.entrySet.iterator
val props: ListBuffer[XNode] = new ListBuffer()
while (iter.hasNext) {
val next = iter.next