-
Notifications
You must be signed in to change notification settings - Fork 28.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix SPARK-1629: Spark should inline use of commons-lang `SystemUtils.IS_... #569
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,6 @@ import scala.reflect.ClassTag | |
import scala.util.Try | ||
|
||
import com.google.common.io.Files | ||
import org.apache.commons.lang.SystemUtils | ||
import com.google.common.util.concurrent.ThreadFactoryBuilder | ||
import org.apache.hadoop.fs.{FileSystem, FileUtil, Path} | ||
import org.json4s._ | ||
|
@@ -50,7 +49,7 @@ private[spark] object Utils extends Logging { | |
val random = new Random() | ||
|
||
def sparkBin(sparkHome: String, which: String): File = { | ||
val suffix = if (SystemUtils.IS_OS_WINDOWS) ".cmd" else "" | ||
val suffix = if (isWindows) ".cmd" else "" | ||
new File(sparkHome + File.separator + "bin", which + suffix) | ||
} | ||
|
||
|
@@ -614,7 +613,7 @@ private[spark] object Utils extends Logging { | |
*/ | ||
def isSymlink(file: File): Boolean = { | ||
if (file == null) throw new NullPointerException("File must not be null") | ||
if (SystemUtils.IS_OS_WINDOWS) return false | ||
if (isWindows) return false | ||
val fileInCanonicalDir = if (file.getParent() == null) { | ||
file | ||
} else { | ||
|
@@ -1018,7 +1017,7 @@ private[spark] object Utils extends Logging { | |
throw new IOException("Destination must be relative") | ||
} | ||
var cmdSuffix = "" | ||
val linkCmd = if (SystemUtils.IS_OS_WINDOWS) { | ||
val linkCmd = if (isWindows) { | ||
// refer to http://technet.microsoft.com/en-us/library/cc771254.aspx | ||
cmdSuffix = " /s /e /k /h /y /i" | ||
"cmd /c xcopy " | ||
|
@@ -1062,6 +1061,12 @@ private[spark] object Utils extends Logging { | |
getHadoopFileSystem(new URI(path)) | ||
} | ||
|
||
/** | ||
* return true if this is Windows. | ||
*/ | ||
def isWindows = Option(System.getProperty("os.name")). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Regarding |
||
map(_.startsWith("Windows")).getOrElse(false) | ||
|
||
/** | ||
* Indicates whether Spark is currently running unit tests. | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@srowen
You think here will be thrown a SecurityException .Why?