Skip to content

Commit

Permalink
Remove usage of org.apache.hadoop.util.Shell
Browse files Browse the repository at this point in the history
  • Loading branch information
xuan authored and xuan committed Apr 15, 2014
1 parent be89fa7 commit bc0926f
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import org.apache.hadoop.io.Text
import org.apache.hadoop.mapred.JobConf
import org.apache.hadoop.security.Credentials
import org.apache.hadoop.security.UserGroupInformation
import org.apache.hadoop.util.Shell
import org.apache.hadoop.util.StringInterner
import org.apache.hadoop.yarn.conf.YarnConfiguration
import org.apache.hadoop.yarn.api.ApplicationConstants
Expand Down Expand Up @@ -103,7 +102,7 @@ object YarnSparkHadoopUtil {
classPathSeparator: String) = {
if (envString != null && envString.length() > 0) {
var childEnvs = envString.split(",")
var p = Pattern.compile(Shell.getEnvironmentVariableRegex())
var p = Pattern.compile(getEnvironmentVariableRegex())
for (cEnv <- childEnvs) {
var parts = cEnv.split("=") // split on '='
var m = p.matcher(parts(1))
Expand All @@ -130,4 +129,13 @@ object YarnSparkHadoopUtil {
}
}

private def getEnvironmentVariableRegex() : String = {
val osName = System.getProperty("os.name")
if (osName startsWith "Windows") {
"%([A-Za-z_][A-Za-z0-9_]*?)%"
} else {
"\\$([A-Za-z_][A-Za-z0-9_]*)"
}
}

}

0 comments on commit bc0926f

Please sign in to comment.