Author: ab Date: Thu Dec 14 00:53:08 2006 New Revision: 487143 URL: http://svn.apache.org/viewvc?view=rev&rev=487143 Log: Check if paths exist before deleting them. Reported by Renaud Richardet.
Modified: lucene/nutch/trunk/src/java/org/apache/nutch/crawl/LinkDb.java Modified: lucene/nutch/trunk/src/java/org/apache/nutch/crawl/LinkDb.java URL: http://svn.apache.org/viewvc/lucene/nutch/trunk/src/java/org/apache/nutch/crawl/LinkDb.java?view=diff&rev=487143&r1=487142&r2=487143 ============================================================================== --- lucene/nutch/trunk/src/java/org/apache/nutch/crawl/LinkDb.java (original) +++ lucene/nutch/trunk/src/java/org/apache/nutch/crawl/LinkDb.java Thu Dec 14 00:53:08 2006 @@ -315,11 +315,13 @@ FileSystem fs = new JobClient(job).getFs(); Path old = new Path(linkDb, "old"); Path current = new Path(linkDb, CURRENT_NAME); - fs.delete(old); - fs.rename(current, old); + if (fs.exists(current)) { + if (fs.exists(old)) fs.delete(old); + fs.rename(current, old); + } fs.mkdirs(linkDb); fs.rename(newLinkDb, current); - fs.delete(old); + if (fs.exists(old)) fs.delete(old); } public static void main(String[] args) throws Exception {