Browse Source

HADOOP-4864. Fixes a problem to do with -libjars with multiple jars when client and cluster reside on different OSs. Contributed by Amareshwari Sriramadasu.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@779553 13f79535-47bb-0310-9956-ffa450edef68
Devaraj Das 16 years ago
parent
commit
7543e18ea6
2 changed files with 17 additions and 15 deletions
  1. 3 0
      CHANGES.txt
  2. 14 15
      src/core/org/apache/hadoop/filecache/DistributedCache.java

+ 3 - 0
CHANGES.txt

@@ -701,6 +701,9 @@ Trunk (unreleased changes)
     HADOOP-5856. Fix "unsafe multithreaded use of DateFormat" findbugs warning
     in DataBlockScanner.  (Kan Zhang via szetszwo)
 
+    HADOOP-4864. Fixes a problem to do with -libjars with multiple jars when
+    client and cluster reside on different OSs. (Amareshwari Sriramadasu via ddas)
+
 Release 0.20.1 - Unreleased
 
   INCOMPATIBLE CHANGES

+ 14 - 15
src/core/org/apache/hadoop/filecache/DistributedCache.java

@@ -683,7 +683,7 @@ public class DistributedCache {
     throws IOException {
     String classpath = conf.get("mapred.job.classpath.files");
     conf.set("mapred.job.classpath.files", classpath == null ? file.toString()
-             : classpath + System.getProperty("path.separator") + file.toString());
+             : classpath + "," + file.toString());
     FileSystem fs = FileSystem.get(conf);
     URI uri = fs.makeQualified(file).toUri();
 
@@ -696,14 +696,14 @@ public class DistributedCache {
    * @param conf Configuration that contains the classpath setting
    */
   public static Path[] getFileClassPaths(Configuration conf) {
-    String classpath = conf.get("mapred.job.classpath.files");
-    if (classpath == null)
-      return null;
-    ArrayList list = Collections.list(new StringTokenizer(classpath, System
-                                                          .getProperty("path.separator")));
+    ArrayList<String> list = (ArrayList<String>)conf.getStringCollection(
+                                "mapred.job.classpath.files");
+    if (list.size() == 0) { 
+      return null; 
+    }
     Path[] paths = new Path[list.size()];
     for (int i = 0; i < list.size(); i++) {
-      paths[i] = new Path((String) list.get(i));
+      paths[i] = new Path(list.get(i));
     }
     return paths;
   }
@@ -719,8 +719,7 @@ public class DistributedCache {
     throws IOException {
     String classpath = conf.get("mapred.job.classpath.archives");
     conf.set("mapred.job.classpath.archives", classpath == null ? archive
-             .toString() : classpath + System.getProperty("path.separator")
-             + archive.toString());
+             .toString() : classpath + "," + archive.toString());
     FileSystem fs = FileSystem.get(conf);
     URI uri = fs.makeQualified(archive).toUri();
 
@@ -733,14 +732,14 @@ public class DistributedCache {
    * @param conf Configuration that contains the classpath setting
    */
   public static Path[] getArchiveClassPaths(Configuration conf) {
-    String classpath = conf.get("mapred.job.classpath.archives");
-    if (classpath == null)
-      return null;
-    ArrayList list = Collections.list(new StringTokenizer(classpath, System
-                                                          .getProperty("path.separator")));
+    ArrayList<String> list = (ArrayList<String>)conf.getStringCollection(
+                                "mapred.job.classpath.archives");
+    if (list.size() == 0) { 
+      return null; 
+    }
     Path[] paths = new Path[list.size()];
     for (int i = 0; i < list.size(); i++) {
-      paths[i] = new Path((String) list.get(i));
+      paths[i] = new Path(list.get(i));
     }
     return paths;
   }