Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bbdec62e authored by luyang's avatar luyang
Browse files

Fix for StrictMode error.

When the device lost connectivity, a StrictMode error could be thrown since
the stream was never closed.
parent f4fb907e
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -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);
        }
    }