close the index input in any case when computing length
This commit is contained in:
parent
bb76542068
commit
594598f493
|
@ -3,6 +3,7 @@ package org.elasticsearch.common.compress;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import org.apache.lucene.store.*;
|
import org.apache.lucene.store.*;
|
||||||
|
import org.apache.lucene.util.IOUtils;
|
||||||
import org.elasticsearch.index.store.support.ForceSyncDirectory;
|
import org.elasticsearch.index.store.support.ForceSyncDirectory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -77,8 +78,8 @@ public class CompressedDirectory extends Directory implements ForceSyncDirectory
|
||||||
IndexInput in = openInput(name, IOContext.READONCE);
|
IndexInput in = openInput(name, IOContext.READONCE);
|
||||||
try {
|
try {
|
||||||
return in.length();
|
return in.length();
|
||||||
} catch (Exception e) {
|
} finally {
|
||||||
in.close();
|
IOUtils.close(in);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return dir.fileLength(name);
|
return dir.fileLength(name);
|
||||||
|
|
Loading…
Reference in New Issue