File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
main/scala/org/apache/spark/deploy
test/scala/org/apache/spark/deploy Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ private[spark] class ClientArguments(args: Array[String]) {
7575
7676 if (! ClientArguments .isValidJarUrl(_jarUrl)) {
7777 println(s " Jar url ' ${_jarUrl}' is not in valid format. " )
78- println(s " Must be a jar file path in URL format (e.g. hdfs://XX.jar, file://XX.jar) " )
78+ println(s " Must be a jar file path in URL format (e.g. hdfs://XX.jar, file:/// XX.jar) " )
7979 printUsageAndExit(- 1 )
8080 }
8181
@@ -119,7 +119,7 @@ object ClientArguments {
119119 def isValidJarUrl (s : String ): Boolean = {
120120 try {
121121 val uri = new URI (s)
122- uri.getScheme != null && uri.getAuthority != null && s. endsWith(" jar" )
122+ uri.getScheme != null && uri.getPath != null && uri.getPath. endsWith(" . jar" )
123123 } catch {
124124 case _ : URISyntaxException => false
125125 }
Original file line number Diff line number Diff line change @@ -23,7 +23,14 @@ import org.scalatest.Matchers
2323class ClientSuite extends FunSuite with Matchers {
2424 test(" correctly validates driver jar URL's" ) {
2525 ClientArguments .isValidJarUrl(" http://someHost:8080/foo.jar" ) should be (true )
26- ClientArguments .isValidJarUrl(" file://some/path/to/a/jarFile.jar" ) should be (true )
26+
27+ // file scheme with authority is valid.
28+ ClientArguments .isValidJarUrl(" file://somehost/path/to/a/jarFile.jar" ) should be (true )
29+
30+ // file scheme without authority is not valid.
31+ ClientArguments .isValidJarUrl(" file://jarFile.jar" ) should be (false )
32+
33+ // file scheme without authority but with triple slash is valid.
2734 ClientArguments .isValidJarUrl(" file:///some/path/to/a/jarFile.jar" ) should be (true )
2835 ClientArguments .isValidJarUrl(" hdfs://someHost:1234/foo.jar" ) should be (true )
2936
You can’t perform that action at this time.
0 commit comments