Jelajahi Sumber

commit da37613ea207129453cb7c2ba4e761ed50b020d7
Author: Krishna Ramachandran <ramach@yahoo-inc.com>
Date: Fri Feb 11 05:41:19 2011 -0800

Fix 4274823 "Distributed Cache is not adding files to class paths"
Contributed by Chris Douglas


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security-patches@1077790 13f79535-47bb-0310-9956-ffa450edef68

Owen O'Malley 14 tahun lalu
induk
melakukan
2594e254a2

+ 8 - 6
src/mapred/org/apache/hadoop/filecache/DistributedCache.java

@@ -450,10 +450,11 @@ public class DistributedCache {
   public static void addFileToClassPath
            (Path file, Configuration conf, FileSystem fs)
         throws IOException {
+    String filepath = file.toUri().getPath();
     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());
+    conf.set("mapred.job.classpath.files", classpath == null
+        ? filepath
+        : classpath + System.getProperty("path.separator") + filepath);
     URI uri = fs.makeQualified(file).toUri();
     addCacheFile(uri, conf);
   }
@@ -508,10 +509,11 @@ public class DistributedCache {
   public static void addArchiveToClassPath
          (Path archive, Configuration conf, FileSystem fs)
       throws IOException {
+    String archivepath = archive.toUri().getPath();
     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());
+    conf.set("mapred.job.classpath.archives", classpath == null
+        ? archivepath
+        : classpath + System.getProperty("path.separator") + archivepath);
     URI uri = fs.makeQualified(archive).toUri();
 
     addCacheArchive(uri, conf);