mirror of https://github.com/apache/lucene.git
temporary directory in constructor was never closed
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150301 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8256d94f56
commit
236466c37f
|
@ -49,6 +49,10 @@ public final class RAMDirectory extends Directory {
|
||||||
* @exception IOException if an error occurs
|
* @exception IOException if an error occurs
|
||||||
*/
|
*/
|
||||||
public RAMDirectory(Directory dir) throws IOException {
|
public RAMDirectory(Directory dir) throws IOException {
|
||||||
|
this(dir, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private RAMDirectory(Directory dir, boolean closeDir) throws IOException {
|
||||||
final String[] files = dir.list();
|
final String[] files = dir.list();
|
||||||
for (int i = 0; i < files.length; i++) {
|
for (int i = 0; i < files.length; i++) {
|
||||||
// make place on ram disk
|
// make place on ram disk
|
||||||
|
@ -64,6 +68,8 @@ public final class RAMDirectory extends Directory {
|
||||||
is.close();
|
is.close();
|
||||||
os.close();
|
os.close();
|
||||||
}
|
}
|
||||||
|
if(closeDir)
|
||||||
|
dir.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -72,7 +78,7 @@ public final class RAMDirectory extends Directory {
|
||||||
* @param dir a <code>File</code> specifying the index directory
|
* @param dir a <code>File</code> specifying the index directory
|
||||||
*/
|
*/
|
||||||
public RAMDirectory(File dir) throws IOException {
|
public RAMDirectory(File dir) throws IOException {
|
||||||
this(FSDirectory.getDirectory(dir, false));
|
this(FSDirectory.getDirectory(dir, false), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -81,7 +87,7 @@ public final class RAMDirectory extends Directory {
|
||||||
* @param dir a <code>String</code> specifying the full index directory path
|
* @param dir a <code>String</code> specifying the full index directory path
|
||||||
*/
|
*/
|
||||||
public RAMDirectory(String dir) throws IOException {
|
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. */
|
/** Returns an array of strings, one for each file in the directory. */
|
||||||
|
|
Loading…
Reference in New Issue