1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-08-13 17:03:48 -04:00

Merge pull request #211 from colund/master

Close stream in case of an exception
This commit is contained in:
cketti 2013-03-10 00:11:53 -08:00
commit 337487e2ae

View File

@ -36,9 +36,15 @@ public class BinaryTempFileBody implements Body {
}
public InputStream getInputStream() throws MessagingException {
InputStream is = null;
FileInputStream fis = null;
try {
return new BinaryTempFileBodyInputStream(new FileInputStream(mFile));
fis = new FileInputStream(mFile);
is = new BinaryTempFileBodyInputStream(fis);
return is;
} catch (IOException ioe) {
try { if (fis != null) { fis.close(); } } catch (IOException e) { }
try { if (is != null) { is.close(); } } catch (IOException e) { }
throw new MessagingException("Unable to open body", ioe);
}
}