Skip to content

Commit

Permalink
Override certain SecurityManager methods to avoid filesystem performa…
Browse files Browse the repository at this point in the history
…nce hit.
  • Loading branch information
harrah authored and eed3si9n committed Mar 21, 2014
1 parent 52b765d commit 485da18
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions run/src/main/scala/sbt/TrapExit.scala
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,15 @@ private final class TrapExit(delegateManager: SecurityManager) extends SecurityM
private def isRealExit(element: StackTraceElement): Boolean =
element.getClassName == "java.lang.Runtime" && element.getMethodName == "exit"

// These are overridden to do nothing because there is a substantial filesystem performance penalty
// when there is a SecurityManager defined. The default implementations of these construct a
// FilePermission, and its initialization involves canonicalization, which is expensive.
override def checkRead(file: String) {}
override def checkRead(file: String, context: AnyRef) {}
override def checkWrite(file: String) {}
override def checkDelete(file: String) {}
override def checkExec(cmd: String) {}

override def checkPermission(perm: Permission)
{
if(delegateManager ne null)
Expand Down

0 comments on commit 485da18

Please sign in to comment.