|
|
@ -23,6 +23,8 @@ import android.content.Context;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.webkit.MimeTypeMap;
|
|
|
|
import android.webkit.MimeTypeMap;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.sun.mail.util.FolderClosedIOException;
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.BufferedOutputStream;
|
|
|
|
import java.io.BufferedOutputStream;
|
|
|
|
import java.io.BufferedReader;
|
|
|
|
import java.io.BufferedReader;
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
@ -724,7 +726,7 @@ public class MessageHelper {
|
|
|
|
private List<AttachmentPart> attachments = new ArrayList<>();
|
|
|
|
private List<AttachmentPart> attachments = new ArrayList<>();
|
|
|
|
private ArrayList<String> warnings = new ArrayList<>();
|
|
|
|
private ArrayList<String> warnings = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
String getHtml(Context context) throws MessagingException, IOException {
|
|
|
|
String getHtml(Context context) throws MessagingException {
|
|
|
|
if (plain == null && html == null) {
|
|
|
|
if (plain == null && html == null) {
|
|
|
|
warnings.add(context.getString(R.string.title_no_body));
|
|
|
|
warnings.add(context.getString(R.string.title_no_body));
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
@ -743,12 +745,10 @@ public class MessageHelper {
|
|
|
|
result = readStream((InputStream) content, "UTF-8");
|
|
|
|
result = readStream((InputStream) content, "UTF-8");
|
|
|
|
else
|
|
|
|
else
|
|
|
|
result = content.toString();
|
|
|
|
result = content.toString();
|
|
|
|
} catch (MessagingException ex) {
|
|
|
|
} catch (FolderClosedException ex) {
|
|
|
|
// Including FolderClosedException
|
|
|
|
|
|
|
|
throw ex;
|
|
|
|
|
|
|
|
} catch (IOException ex) {
|
|
|
|
|
|
|
|
// Including FolderClosedIOException
|
|
|
|
|
|
|
|
throw ex;
|
|
|
|
throw ex;
|
|
|
|
|
|
|
|
} catch (FolderClosedIOException ex) {
|
|
|
|
|
|
|
|
throw new FolderClosedException(ex.getFolder(), "getHtml", ex);
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
Log.w(ex);
|
|
|
|
Log.w(ex);
|
|
|
|
text = true;
|
|
|
|
text = true;
|
|
|
@ -876,6 +876,8 @@ public class MessageHelper {
|
|
|
|
db.attachment().setDownloaded(id, size);
|
|
|
|
db.attachment().setDownloaded(id, size);
|
|
|
|
|
|
|
|
|
|
|
|
Log.i("Downloaded attachment size=" + size);
|
|
|
|
Log.i("Downloaded attachment size=" + size);
|
|
|
|
|
|
|
|
} catch (FolderClosedIOException ex) {
|
|
|
|
|
|
|
|
throw new FolderClosedException(ex.getFolder(), "downloadAttachment", ex);
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
// Reset progress on failure
|
|
|
|
// Reset progress on failure
|
|
|
|
db.attachment().setError(id, Helper.formatThrowable(ex));
|
|
|
|
db.attachment().setError(id, Helper.formatThrowable(ex));
|
|
|
|