aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorMatei Zaharia <matei.zaharia@gmail.com>2013-09-01 23:45:57 +0000
committerMatei Zaharia <matei.zaharia@gmail.com>2013-09-01 23:45:57 +0000
commit3db404a43a90a9cca37090381857dc955496385a (patch)
treea34e4946b3e30747b910bcda62a62fbb471abe8b /core
parentf957c26fa27486c329d82cb66595b2cf07aed0ef (diff)
downloadspark-3db404a43a90a9cca37090381857dc955496385a.tar.gz
spark-3db404a43a90a9cca37090381857dc955496385a.tar.bz2
spark-3db404a43a90a9cca37090381857dc955496385a.zip
Run script fixes for Windows after package & assembly change
Diffstat (limited to 'core')
-rw-r--r--core/src/main/scala/org/apache/spark/SparkContext.scala28
1 files changed, 17 insertions, 11 deletions
diff --git a/core/src/main/scala/org/apache/spark/SparkContext.scala b/core/src/main/scala/org/apache/spark/SparkContext.scala
index faf0c2362a..f2641851cb 100644
--- a/core/src/main/scala/org/apache/spark/SparkContext.scala
+++ b/core/src/main/scala/org/apache/spark/SparkContext.scala
@@ -631,20 +631,26 @@ class SparkContext(
* filesystems), or an HTTP, HTTPS or FTP URI.
*/
def addJar(path: String) {
- if (null == path) {
+ if (path == null) {
logWarning("null specified as parameter to addJar",
new SparkException("null specified as parameter to addJar"))
} else {
- val env = SparkEnv.get
- val uri = new URI(path)
- val key = uri.getScheme match {
- case null | "file" =>
- if (env.hadoop.isYarnMode()) {
- logWarning("local jar specified as parameter to addJar under Yarn mode")
- return
- }
- env.httpFileServer.addJar(new File(uri.getPath))
- case _ => path
+ var key = ""
+ if (path.contains("\\")) {
+ // For local paths with backslashes on Windows, URI throws an exception
+ key = env.httpFileServer.addJar(new File(path))
+ } else {
+ val uri = new URI(path)
+ key = uri.getScheme match {
+ case null | "file" =>
+ if (env.hadoop.isYarnMode()) {
+ logWarning("local jar specified as parameter to addJar under Yarn mode")
+ return
+ }
+ env.httpFileServer.addJar(new File(uri.getPath))
+ case _ =>
+ path
+ }
}
addedJars(key) = System.currentTimeMillis
logInfo("Added JAR " + path + " at " + key + " with timestamp " + addedJars(key))