Skip to content

Commit

Permalink
SPARK-5425: Use SerializationUtils to save properties in ResetSystemP…
Browse files Browse the repository at this point in the history
…roperties trait
  • Loading branch information
jacek-lewandowski committed Jan 29, 2015
1 parent 71aa572 commit 8faf2ea
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package org.apache.spark.util

import java.util.Properties

import org.apache.commons.lang3.SerializationUtils
import org.scalatest.{BeforeAndAfterEach, Suite}

/**
Expand All @@ -42,7 +43,11 @@ private[spark] trait ResetSystemProperties extends BeforeAndAfterEach { this: Su
var oldProperties: Properties = null

override def beforeEach(): Unit = {
oldProperties = new Properties(System.getProperties)
// we need SerializationUtils.clone instead of `new Properties(System.getProperties()` because
// the later way of creating a copy does not copy the properties but it initializes a new
// Properties object with the given properties as defaults. They are not recognized at all
// by standard Scala wrapper over Java Properties then.
oldProperties = SerializationUtils.clone(System.getProperties)
super.beforeEach()
}

Expand Down

0 comments on commit 8faf2ea

Please sign in to comment.