Catch ParseException on get HTML

pull/156/head
M66B 6 years ago
parent 77beca5a34
commit 736e8d4dba

@ -800,10 +800,11 @@ public class MessageHelper {
throw new FolderClosedException(ex.getFolder(), "getHtml", ex); throw new FolderClosedException(ex.getFolder(), "getHtml", ex);
} catch (Throwable ex) { } catch (Throwable ex) {
Log.w(ex); Log.w(ex);
text = true; warnings.add(ex.getMessage());
result = ex + "\n" + android.util.Log.getStackTraceString(ex); return null;
} }
try {
ContentType ct = new ContentType(part.getContentType()); ContentType ct = new ContentType(part.getContentType());
String charset = ct.getParameter("charset"); String charset = ct.getParameter("charset");
if (TextUtils.isEmpty(charset)) { if (TextUtils.isEmpty(charset)) {
@ -818,6 +819,10 @@ public class MessageHelper {
!"US-ASCII".equals(charset.toUpperCase())) !"US-ASCII".equals(charset.toUpperCase()))
warnings.add(context.getString(R.string.title_no_charset, charset)); warnings.add(context.getString(R.string.title_no_charset, charset));
} }
} catch (ParseException ex) {
Log.w(ex);
warnings.add(ex.getMessage());
}
if (part.isMimeType("text/plain") || text) { if (part.isMimeType("text/plain") || text) {
result = TextUtils.htmlEncode(result); result = TextUtils.htmlEncode(result);

Loading…
Cancel
Save