Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

Update to NUTCH-552 to fix error in handling of paths for IndexSearcher. Now uses Path.makeQualified to be consistent in file handling across different OS.

Dennis Kubes848014c3e179
diff --git a/src/java/org/apache/nutch/searcher/IndexSearcher.java b/src/java/org/apache/nutch/searcher/IndexSearcher.java
index b3e680923..e73052242 100644
--- a/src/java/org/apache/nutch/searcher/IndexSearcher.java
+++ b/src/java/org/apache/nutch/searcher/IndexSearcher.java
@@ -83,8 +83,9 @@ public class IndexSearcher implements Searcher, HitDetailer {
private Directory getDirectory(Path file) throws IOException {
if ("local".equals(this.fs.getName())) {
- URI fileUri = file.toUri();
- return FSDirectory.getDirectory(new File(fileUri).toString(), false);
+ Path qualified = file.makeQualified(FileSystem.getLocal(conf));
+ File fsLocal = new File(qualified.toUri());
+ return FSDirectory.getDirectory(fsLocal.getAbsolutePath(), false);
} else {
return new FsDirectory(this.fs, file, false, this.conf);
}