Close body input streams
b/16153171 Change-Id: Iab1224957d1079969be51d2843df5250c8660b8a
This commit is contained in:
parent
c11f7b9027
commit
a3d4117117
@ -70,7 +70,12 @@ public class EmailMessageCursor extends CursorWrapper {
|
|||||||
if (mHtmlColumnIndex != -1) {
|
if (mHtmlColumnIndex != -1) {
|
||||||
final Uri htmlUri = Body.getBodyHtmlUriForMessageWithId(messageId);
|
final Uri htmlUri = Body.getBodyHtmlUriForMessageWithId(messageId);
|
||||||
final InputStream in = cr.openInputStream(htmlUri);
|
final InputStream in = cr.openInputStream(htmlUri);
|
||||||
final String underlyingHtmlString = IOUtils.toString(in);
|
final String underlyingHtmlString;
|
||||||
|
try {
|
||||||
|
underlyingHtmlString = IOUtils.toString(in);
|
||||||
|
} finally {
|
||||||
|
in.close();
|
||||||
|
}
|
||||||
final String sanitizedHtml = HtmlSanitizer.sanitizeHtml(underlyingHtmlString);
|
final String sanitizedHtml = HtmlSanitizer.sanitizeHtml(underlyingHtmlString);
|
||||||
mHtmlParts.put(position, sanitizedHtml);
|
mHtmlParts.put(position, sanitizedHtml);
|
||||||
}
|
}
|
||||||
@ -81,7 +86,12 @@ public class EmailMessageCursor extends CursorWrapper {
|
|||||||
if (mTextColumnIndex != -1) {
|
if (mTextColumnIndex != -1) {
|
||||||
final Uri textUri = Body.getBodyTextUriForMessageWithId(messageId);
|
final Uri textUri = Body.getBodyTextUriForMessageWithId(messageId);
|
||||||
final InputStream in = cr.openInputStream(textUri);
|
final InputStream in = cr.openInputStream(textUri);
|
||||||
final String underlyingTextString = IOUtils.toString(in);
|
final String underlyingTextString;
|
||||||
|
try {
|
||||||
|
underlyingTextString = IOUtils.toString(in);
|
||||||
|
} finally {
|
||||||
|
in.close();
|
||||||
|
}
|
||||||
mTextParts.put(position, underlyingTextString);
|
mTextParts.put(position, underlyingTextString);
|
||||||
}
|
}
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user