goller 2004/04/20 11:27:55
Modified: src/java/org/apache/lucene/store RAMDirectory.java
Log:
temporary directory in constructor was never closed
Revision Changes Path
1.14 +9 -3
jakarta-lucene/src/java/org/apache/lucene/store/RAMDirectory.java
Index: RAMDirectory.java
===================================================================
RCS file:
/home/cvs/jakarta-lucene/src/java/org/apache/lucene/store/RAMDirectory.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- RAMDirectory.java 29 Mar 2004 22:48:05 -0000 1.13
+++ RAMDirectory.java 20 Apr 2004 18:27:55 -0000 1.14
@@ -49,6 +49,10 @@
* @exception IOException if an error occurs
*/
public RAMDirectory(Directory dir) throws IOException {
+ this(dir, false);
+ }
+
+ private RAMDirectory(Directory dir, boolean closeDir) throws IOException {
final String[] files = dir.list();
for (int i = 0; i < files.length; i++) {
// make place on ram disk
@@ -64,6 +68,8 @@
is.close();
os.close();
}
+ if(closeDir)
+ dir.close();
}
/**
@@ -72,7 +78,7 @@
* @param dir a <code>File</code> specifying the index directory
*/
public RAMDirectory(File dir) throws IOException {
- this(FSDirectory.getDirectory(dir, false));
+ this(FSDirectory.getDirectory(dir, false), true);
}
/**
@@ -81,7 +87,7 @@
* @param dir a <code>String</code> specifying the full index directory path
*/
public RAMDirectory(String dir) throws IOException {
- this(FSDirectory.getDirectory(dir, false));
+ this(FSDirectory.getDirectory(dir, false), true);
}
/** Returns an array of strings, one for each file in the directory. */
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]