close stream if file not found (though a stream is not really opened in this case...)

This commit is contained in:
kimchy 2010-12-30 12:30:33 +02:00
parent abe33d59a5
commit 20b6e0bdde
1 changed files with 3 additions and 1 deletions

View File

@ -25,6 +25,7 @@ import org.elasticsearch.common.blobstore.support.AbstractBlobContainer;
import org.elasticsearch.common.blobstore.support.PlainBlobMetaData;
import org.elasticsearch.common.collect.ImmutableMap;
import org.elasticsearch.common.collect.MapBuilder;
import org.elasticsearch.common.io.Closeables;
import java.io.File;
import java.io.FileInputStream;
@ -77,10 +78,11 @@ public abstract class AbstractFsBlobContainer extends AbstractBlobContainer {
blobStore.executor().execute(new Runnable() {
@Override public void run() {
byte[] buffer = new byte[blobStore.bufferSizeInBytes()];
FileInputStream is;
FileInputStream is = null;
try {
is = new FileInputStream(new File(path, blobName));
} catch (FileNotFoundException e) {
Closeables.closeQuietly(is);
listener.onFailure(e);
return;
}