mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
close stream if file not found (though a stream is not really opened in this case...)
This commit is contained in:
parent
abe33d59a5
commit
20b6e0bdde
@ -25,6 +25,7 @@ import org.elasticsearch.common.blobstore.support.AbstractBlobContainer;
|
|||||||
import org.elasticsearch.common.blobstore.support.PlainBlobMetaData;
|
import org.elasticsearch.common.blobstore.support.PlainBlobMetaData;
|
||||||
import org.elasticsearch.common.collect.ImmutableMap;
|
import org.elasticsearch.common.collect.ImmutableMap;
|
||||||
import org.elasticsearch.common.collect.MapBuilder;
|
import org.elasticsearch.common.collect.MapBuilder;
|
||||||
|
import org.elasticsearch.common.io.Closeables;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
@ -77,10 +78,11 @@ public abstract class AbstractFsBlobContainer extends AbstractBlobContainer {
|
|||||||
blobStore.executor().execute(new Runnable() {
|
blobStore.executor().execute(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
byte[] buffer = new byte[blobStore.bufferSizeInBytes()];
|
byte[] buffer = new byte[blobStore.bufferSizeInBytes()];
|
||||||
FileInputStream is;
|
FileInputStream is = null;
|
||||||
try {
|
try {
|
||||||
is = new FileInputStream(new File(path, blobName));
|
is = new FileInputStream(new File(path, blobName));
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
|
Closeables.closeQuietly(is);
|
||||||
listener.onFailure(e);
|
listener.onFailure(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user