You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nutch.apache.org by cu...@apache.org on 2005/09/12 19:04:36 UTC
svn commit: r280370 -
/lucene/nutch/branches/mapred/src/java/org/apache/nutch/fs/NDFSFileSystem.java
Author: cutting
Date: Mon Sep 12 10:04:33 2005
New Revision: 280370
URL: http://svn.apache.org/viewcvs?rev=280370&view=rev
Log:
Fix to correctly convert empty path to home directory rather than root.
Modified:
lucene/nutch/branches/mapred/src/java/org/apache/nutch/fs/NDFSFileSystem.java
Modified: lucene/nutch/branches/mapred/src/java/org/apache/nutch/fs/NDFSFileSystem.java
URL: http://svn.apache.org/viewcvs/lucene/nutch/branches/mapred/src/java/org/apache/nutch/fs/NDFSFileSystem.java?rev=280370&r1=280369&r2=280370&view=diff
==============================================================================
--- lucene/nutch/branches/mapred/src/java/org/apache/nutch/fs/NDFSFileSystem.java (original)
+++ lucene/nutch/branches/mapred/src/java/org/apache/nutch/fs/NDFSFileSystem.java Mon Sep 12 10:04:33 2005
@@ -50,12 +50,11 @@
public String getName() { return name; }
private UTF8 getPath(File file) {
- File f = file;
String path = getNDFSPath(file);
if (!path.startsWith(NDFSFile.NDFS_FILE_SEPARATOR)) {
- f = new File(HOME_DIR, path);
+ path = getNDFSPath(new File(HOME_DIR, path)); // make absolute
}
- return new UTF8(getNDFSPath(f));
+ return new UTF8(path);
}
/**
@@ -305,17 +304,10 @@
parent = parent.getParentFile();
}
StringBuffer path = new StringBuffer();
- String fname = (String) l.get(l.size() - 1);
- if (!"".equals(fname)) {
- path.append(fname); //handle not absolute paths
- } else {
- if (l.size() == 1)
- path.append(NDFSFile.NDFS_FILE_SEPARATOR); //handle root path
- }
+ path.append(l.get(l.size() - 1));
for (int i = l.size() - 2; i >= 0; i--) {
- fname = (String) l.get(i);
path.append(NDFSFile.NDFS_FILE_SEPARATOR);
- path.append(fname);
+ path.append(l.get(i));
}
return path.toString();
}