Forráskód Böngészése

Better fix for Windows.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@410666 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 19 éve
szülő
commit
32193977cb

+ 4 - 6
src/java/org/apache/hadoop/util/CopyFiles.java

@@ -18,8 +18,6 @@ package org.apache.hadoop.util;
 
 import java.io.IOException;
 import java.net.URI;
-import java.net.URLEncoder;
-import java.net.URLDecoder;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -248,8 +246,8 @@ public class CopyFiles extends MapReduceBase implements Reducer {
     URI srcurl = null;
     URI desturl = null;
     try {
-      srcurl = new URI(URLEncoder.encode(srcPath, "UTF-8"));
-      desturl = new URI(URLEncoder.encode(destPath, "UTF-8"));
+      srcurl = new URI(srcPath);
+      desturl = new URI(destPath);
     } catch (URISyntaxException ex) {
       throw new RuntimeException("URL syntax error.", ex);
     }
@@ -267,9 +265,9 @@ public class CopyFiles extends MapReduceBase implements Reducer {
     srcfs = FileSystem.getNamed(srcFileSysName, conf);
     FileSystem destfs = FileSystem.getNamed(destFileSysName, conf);
  
-    srcPath = URLDecoder.decode(srcurl.getPath(), "UTF-8");
+    srcPath = srcurl.getPath();
     if ("".equals(srcPath)) { srcPath = "/"; }
-    destPath = URLDecoder.decode(desturl.getPath(), "UTF-8");
+    destPath = desturl.getPath();
     if ("".equals(destPath)) { destPath = "/"; }
     
     boolean isFile = false;

+ 4 - 3
src/test/org/apache/hadoop/fs/TestCopyFiles.java

@@ -32,9 +32,10 @@ import org.apache.hadoop.util.CopyFiles;
 public class TestCopyFiles extends TestCase {
   
   private static final int NFILES = 20;
-  private static Path TEST_ROOT_DIR = new Path(
-          System.getProperty("test.build.data","/tmp"));
-  
+  private static String TEST_ROOT_DIR =
+    new Path(System.getProperty("test.build.data","/tmp"))
+    .toString().replace(" ","+");
+
   /** class MyFile contains enough information to recreate the contents of
    * a single file.
    */