DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26196>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26196

IndexWriter problem when create set to false

[EMAIL PROTECTED] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX



------- Additional Comments From [EMAIL PROTECTED]  2004-03-04 14:31 -------
Yes, the current behaviour is fine, it just needs to be documented in
IndexWriter's Javadocs.  I'd rather get an exception, than have Lucene create an
index in some weird place.
It is easy to check for existence of the directory before calling IndexWriter,
and 'mkdirs()-ing' it.

Stack trace, for the record:

Exception in thread "main" java.io.IOException: /tmp/wrong not a directory
        at org.apache.lucene.store.FSDirectory.<init>(FSDirectory.java:154)
        at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:132)
        at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:113)
        at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:151)
        at IWTest.main(IWTest.java:8)


You don't need and should not be catching the exception.  Instead, proactively
and explicitly check for the existence of the directory.  You could even inline
the check in the call to IndexWriter constructor:

.... = new IW(path, analyzer, !file.exists())

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to