Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
merge mastet
  • Loading branch information
witgo committed Apr 27, 2014
commit fcaafd7d14153c2daefd8276d6e437db166d6427
6 changes: 6 additions & 0 deletions core/src/main/scala/org/apache/spark/util/Utils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1062,4 +1062,10 @@ private[spark] object Utils extends Logging {
def isWindows = Option(System.getProperty("os.name")).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srowen

def isWindows(): Boolean = {
  try {
    val osName = System.getProperty("os.name")
    osName != null && osName.startsWith("Windows")
  } catch {
    case e: SecurityException => (log a warning and return false)
  }
}

You think here will be thrown a SecurityException .Why?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding SecurityException, System.getProperty will often be disallowed in an environment where the security manager has been enabled. I strongly suspect that the rest of Spark fails already in such an environment for other reasons, and you could argue that the only reasonable response here is to fail rather than "guess" that the environment is not Windows. But I put it in mostly to mimic SystemUtils. It could go either way.

map(_.startsWith("Windows")).getOrElse(false)

/**
* Indicates whether Spark is currently running unit tests.
*/
private[spark] def isTesting = {
sys.env.contains("SPARK_TESTING") || sys.props.contains("spark.testing")
}
}
You are viewing a condensed version of this merge commit. You can view the full changes here.