Explorar o código

Fix unit tests on Windows. Don't assume that, just because a pathname begins with a slash that it also returns true for File.isAbsolute(). Instead use getAbsoluteFile() to force such things to be absolute.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@389620 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting %!s(int64=19) %!d(string=hai) anos
pai
achega
24465c6af4

+ 2 - 2
src/java/org/apache/hadoop/dfs/DistributedFileSystem.java

@@ -33,7 +33,7 @@ import org.apache.hadoop.conf.Configuration;
  *****************************************************************/
 public class DistributedFileSystem extends FileSystem {
     private File workingDir = 
-      new File("/user/", System.getProperty("user.name"));
+      new File("/user", System.getProperty("user.name")).getAbsoluteFile();
 
     private String name;
 
@@ -57,7 +57,7 @@ public class DistributedFileSystem extends FileSystem {
       if (f.isAbsolute()) {
         return f;
       } else {
-        return new File(workingDir, f.toString());
+        return new File(workingDir, f.getPath());
       }
     }
     

+ 1 - 1
src/test/org/apache/hadoop/dfs/TestLocalDFS.java

@@ -46,7 +46,7 @@ public class TestLocalDFS extends TestCase {
       writeFile(fileSys, file1);
       assertTrue(fileSys.exists(new File(orig_path, file1.getPath())));
       fileSys.delete(file1);
-      File subdir1 = new File("/somewhere");
+      File subdir1 = new File("/somewhere").getAbsoluteFile();
       fileSys.setWorkingDirectory(subdir1);
       writeFile(fileSys, file1);
       cleanupFile(fileSys, new File(subdir1, file1.getPath()));