Hello,

Today, while using Lucene 1.9-rc1-dev, I encountered this exception:

java.lang.NullPointerException
 at org.apache.lucene.store.FSDirectory.create(FSDirectory.java:174)
 at org.apache.lucene.store.FSDirectory.init(FSDirectory.java:150)
 at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:122)
 at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:225)

Puzzled, I added some debugging println() statements in FSDirectory and found out that java.io.tmpdir did not exist in my setup. It may be that I am in a unique situation, having accidentally changed that value to some non-existent directory. If I'm not, someone else might encounter the same problem. Just in case, below is the little patch I generated from the change I came up with.

   Mike

Index: org/apache/lucene/store/FSDirectory.java
===================================================================
--- org/apache/lucene/store/FSDirectory.java    (revision 230511)
+++ org/apache/lucene/store/FSDirectory.java    (working copy)
@@ -146,6 +146,13 @@
    else {
      lockDir = new File(LOCK_DIR);
    }
+    // Ensure that lockDir exists and is a directory.
+    if (!lockDir.exists()) {
+      if (!lockDir.mkdirs())
+        throw new IOException("Cannot create directory: " + lockDir);
+    } else if (!lockDir.isDirectory()) {
+ throw new IOException("Found regular file where directory expected: " + lockDir);
+    }
    if (create) {
      create();
    }


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

Reply via email to