mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-25 00:58:50 -05:00
Fix for StrictMode error.
When the device lost connectivity, a StrictMode error could be thrown since the stream was never closed.
This commit is contained in:
parent
f4fb907eca
commit
bbdec62e37
@ -36,9 +36,15 @@ public class BinaryTempFileBody implements Body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public InputStream getInputStream() throws MessagingException {
|
public InputStream getInputStream() throws MessagingException {
|
||||||
|
InputStream is = null;
|
||||||
|
FileInputStream fis = null;
|
||||||
try {
|
try {
|
||||||
return new BinaryTempFileBodyInputStream(new FileInputStream(mFile));
|
fis = new FileInputStream(mFile);
|
||||||
|
is = new BinaryTempFileBodyInputStream(fis);
|
||||||
|
return is;
|
||||||
} catch (IOException ioe) {
|
} 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);
|
throw new MessagingException("Unable to open body", ioe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user