Close body input streams

b/16153171

Change-Id: Iab1224957d1079969be51d2843df5250c8660b8a
This commit is contained in:
Tony Mantler 2014-07-08 09:39:50 -07:00
parent c11f7b9027
commit a3d4117117
1 changed files with 12 additions and 2 deletions

View File

@ -70,7 +70,12 @@ public class EmailMessageCursor extends CursorWrapper {
if (mHtmlColumnIndex != -1) {
final Uri htmlUri = Body.getBodyHtmlUriForMessageWithId(messageId);
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);
mHtmlParts.put(position, sanitizedHtml);
}
@ -81,7 +86,12 @@ public class EmailMessageCursor extends CursorWrapper {
if (mTextColumnIndex != -1) {
final Uri textUri = Body.getBodyTextUriForMessageWithId(messageId);
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);
}
} catch (final IOException e) {