Repository: spark
Updated Branches:
  refs/heads/master 749418d28 -> bbd8d7def


[SPARK-20806][DEPLOY] Launcher: redundant check for Spark lib dir

## What changes were proposed in this pull request?

Remove redundant check for libdir in CommandBuilderUtils

## How was this patch tested?

Existing tests

Author: Sean Owen <so...@cloudera.com>

Closes #18032 from srowen/SPARK-20806.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/bbd8d7de
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/bbd8d7de
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/bbd8d7de

Branch: refs/heads/master
Commit: bbd8d7def149e787a33ed0decf332d33c593e93c
Parents: 749418d
Author: Sean Owen <so...@cloudera.com>
Authored: Sat May 20 15:27:13 2017 +0100
Committer: Sean Owen <so...@cloudera.com>
Committed: Sat May 20 15:27:13 2017 +0100

----------------------------------------------------------------------
 .../org/apache/spark/launcher/CommandBuilderUtils.java | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/bbd8d7de/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java
----------------------------------------------------------------------
diff --git 
a/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java 
b/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java
index e14c8aa..47d2f8e 100644
--- a/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java
+++ b/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java
@@ -335,22 +335,17 @@ class CommandBuilderUtils {
    */
   static String findJarsDir(String sparkHome, String scalaVersion, boolean 
failIfNotFound) {
     // TODO: change to the correct directory once the assembly build is 
changed.
-    File libdir;
-    if (new File(sparkHome, "jars").isDirectory()) {
-      libdir = new File(sparkHome, "jars");
-      checkState(!failIfNotFound || libdir.isDirectory(),
-        "Library directory '%s' does not exist.",
-        libdir.getAbsolutePath());
-    } else {
+    File libdir = new File(sparkHome, "jars");
+    if (!libdir.isDirectory()) {
       libdir = new File(sparkHome, 
String.format("assembly/target/scala-%s/jars", scalaVersion));
       if (!libdir.isDirectory()) {
         checkState(!failIfNotFound,
           "Library directory '%s' does not exist; make sure Spark is built.",
           libdir.getAbsolutePath());
-        libdir = null;
+        return null;
       }
     }
-    return libdir != null ? libdir.getAbsolutePath() : null;
+    return libdir.getAbsolutePath();
   }
 
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to