I found the root cause. The culprit is at line
1663 FileUtil.fullyDelete(fs, oldDbFile);
in src/java/net/nutch/db/WebDBWriter.java
It can't delete and in fact returns false.
The real bug lurks in src/java/net/nutch/util/FileUtil.java, line
20 File contents[] = nfs.listFiles(dir);
which, in turn, manifests itself in
src/java/net/nutch/util/LocalFileSystem.java, line
265 NDFSFile[] nfiles = new NDFSFile[files.length];
Currenlty NDFSFile.java does not support severl methods, including delete().
My suggested fix is attached below.
It also fixes ant test error. So build failure at sf.net should be gone too.
If no objection, I will commit in 2 days.
John
-------------------------patch.txt.20041022 ---------------------------
diff -Nur --exclude=build --exclude='*.ori' --exclude=conf
nutch-cvs-20041018/src/java/net/nutch/util/FileUtil.java
nutch-cvs-20041018.bug/src/java/net/nutch/util/FileUtil.java
--- nutch-cvs-20041018/src/java/net/nutch/util/FileUtil.java 2004-08-20
13:36:15.000000000 -0700
+++ nutch-cvs-20041018.bug/src/java/net/nutch/util/FileUtil.java 2004-10-22
13:06:51.000000000 -0700
@@ -17,20 +17,10 @@
return fullyDelete(new LocalFileSystem(), dir);
}
public static boolean fullyDelete(NutchFileSystem nfs, File dir) throws
IOException {
- File contents[] = nfs.listFiles(dir);
- if (contents != null) {
- for (int i = 0; i < contents.length; i++) {
- if (nfs.isFile(contents[i])) {
- if (! nfs.delete(contents[i])) {
- return false;
- }
- } else {
- if (! fullyDelete(nfs, contents[i])) {
- return false;
- }
- }
- }
- }
+ // 20041022, xing.
+ // Currently nfs.detele(File) means fully delete for both
+ // LocalFileSystem.java and NDFSFileSystem.java. So we are okay now.
+ // If implementation changes in future, it should be modified too.
return nfs.delete(dir);
}
diff -Nur --exclude=build --exclude='*.ori' --exclude=conf
nutch-cvs-20041018/src/java/net/nutch/util/LocalFileSystem.java
nutch-cvs-20041018.bug/src/java/net/nutch/util/LocalFileSystem.java
--- nutch-cvs-20041018/src/java/net/nutch/util/LocalFileSystem.java 2004-10-07
14:27:15.000000000 -0700
+++ nutch-cvs-20041018.bug/src/java/net/nutch/util/LocalFileSystem.java 2004-10-22
13:13:27.000000000 -0700
@@ -262,6 +262,15 @@
public File[] listFiles(File f) throws IOException {
File[] files = f.listFiles();
if (files == null) return null;
+ // 20041022, xing, Watch out here:
+ // currently NDFSFile.java does not support those methods
+ // public boolean canRead()
+ // public boolean canWrite()
+ // public boolean createNewFile()
+ // public boolean delete()
+ // public void deleteOnExit()
+ // public boolean isHidden()
+ // so you can not rely on returned list for these operations.
NDFSFile[] nfiles = new NDFSFile[files.length];
for (int i = 0; i < files.length; i++) {
long len = files[i].length();
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Nutch-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nutch-developers