nutch-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Wechner <michael.wech...@wyona.com>
Subject Re: [Nutch-dev] Checking if crawl dir exists ...
Date Sat, 26 Aug 2006 21:49:09 GMT
Hasan Diwan wrote:

> On 25/08/06, Michael Wechner <michael.wechner@wyona.com> wrote:
>
>> >> Index: nutch-0.8/src/java/org/apache/nutch/searcher/NutchBean.java
>> >> ===================================================================
>> >> --- nutch-0.8/src/java/org/apache/nutch/searcher/NutchBean.java
>> >> (Revision 436787)
>> >> +++ nutch-0.8/src/java/org/apache/nutch/searcher/NutchBean.java
>> >> (Arbeitskopie)
>> >> @@ -95,6 +95,9 @@
>> >>         if (dir == null) {
>> >>             dir = new Path(this.conf.get("searcher.dir", "crawl"));
>> >>         }
>> >> +       if (!new java.io.File(dir.toString()).exists()) {
>> >> +            LOG.warn("No such directory: " + new java.io.File
>> >> (dir.toString()));
>> >> +        }
>> >>         Path servers = new Path(dir, "search-servers.txt");
>> >>         if (fs.exists(servers)) {
>> >>             if (LOG.isInfoEnabled())
>
>
>
> Is this not what java.io.FileNotFoundException is for?


yes, but I am not sure if it actually has to be a File resp. Directory,
but could be something else (DB, ...)

> In other words, in
> addition to putting a log message, you should throw a 
> FileNotFoundException
> as well. You might also want to terminate the process altogether, as I 
> see
> no use in doing anything without a search directory. Another approach 
> is to
> throw an exception. The caller of the function then catches said 
> exception
> and generates the searcher.dir.


whatever, but as it is at the moment, it just seems to me very misleading
and I think it would be nice if this could be changed.

Thanks

Michi


-- 
Michael Wechner
Wyona      -   Open Source Content Management   -    Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
michael.wechner@wyona.com                        michi@apache.org
+41 44 272 91 61


Mime
View raw message