Author: cutting Date: Wed May 31 13:25:47 2006 New Revision: 410659 URL: http://svn.apache.org/viewvc?rev=410659&view=rev Log: Fix for paths that might contain spaces (e.g. on windows).
Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/util/CopyFiles.java Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/util/CopyFiles.java URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/util/CopyFiles.java?rev=410659&r1=410658&r2=410659&view=diff ============================================================================== --- lucene/hadoop/trunk/src/java/org/apache/hadoop/util/CopyFiles.java (original) +++ lucene/hadoop/trunk/src/java/org/apache/hadoop/util/CopyFiles.java Wed May 31 13:25:47 2006 @@ -18,6 +18,8 @@ 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; @@ -246,8 +248,8 @@ URI srcurl = null; URI desturl = null; try { - srcurl = new URI(srcPath); - desturl = new URI(destPath); + srcurl = new URI(URLEncoder.encode(srcPath, "UTF-8")); + desturl = new URI(URLEncoder.encode(destPath, "UTF-8")); } catch (URISyntaxException ex) { throw new RuntimeException("URL syntax error.", ex); } @@ -265,9 +267,9 @@ srcfs = FileSystem.getNamed(srcFileSysName, conf); FileSystem destfs = FileSystem.getNamed(destFileSysName, conf); - srcPath = srcurl.getPath(); + srcPath = URLDecoder.decode(srcurl.getPath(), "UTF-8"); if ("".equals(srcPath)) { srcPath = "/"; } - destPath = desturl.getPath(); + destPath = URLDecoder.decode(desturl.getPath(), "UTF-8"); if ("".equals(destPath)) { destPath = "/"; } boolean isFile = false;