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

View File

@ -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;
} }