1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-27 18:27:43 +00:00

Refactoring

This commit is contained in:
M66B 2019-11-10 17:06:04 +01:00
parent d6525eaa68
commit 071ad5f85a

View file

@ -1971,33 +1971,34 @@ class Core {
return _synchronizeMessage(context, account, folder, uid, istore, imessage, browsed, download, rules, state);
} catch (MessagingException ex) {
// https://javaee.github.io/javamail/FAQ#imapserverbug
if (MessageHelper.retryRaw(ex)) try {
Log.w(folder.name + " " + ex.getMessage());
if (MessageHelper.retryRaw(ex))
try {
Log.w(folder.name + " " + ex.getMessage());
Log.i(folder.name + " fetching raw message uid=" + uid);
File file = File.createTempFile("serverbug." + folder.id, "." + uid, context.getCacheDir());
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
imessage.writeTo(os);
Log.i(folder.name + " fetching raw message uid=" + uid);
File file = File.createTempFile("serverbug." + folder.id, "." + uid, context.getCacheDir());
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
imessage.writeTo(os);
}
Properties props = MessageHelper.getSessionProperties();
Session isession = Session.getInstance(props, null);
Log.i(folder.name + " decoding again uid=" + uid);
try (InputStream is = new BufferedInputStream(new FileInputStream(file))) {
imessage = new MimeMessageEx(isession, is, imessage);
}
file.delete();
Log.i(folder.name + " synchronizing again uid=" + uid);
return _synchronizeMessage(context, account, folder, uid, istore, imessage, browsed, download, rules, state);
} catch (MessagingException ex1) {
if (MessageHelper.retryRaw(ex1))
Log.e(ex1);
throw ex1;
}
Properties props = MessageHelper.getSessionProperties();
Session isession = Session.getInstance(props, null);
Log.i(folder.name + " decoding again uid=" + uid);
try (InputStream is = new BufferedInputStream(new FileInputStream(file))) {
imessage = new MimeMessageEx(isession, is, imessage);
}
file.delete();
Log.i(folder.name + " synchronizing again uid=" + uid);
return _synchronizeMessage(context, account, folder, uid, istore, imessage, browsed, download, rules, state);
} catch (MessagingException ex1) {
if (MessageHelper.retryRaw(ex1))
Log.e(ex1);
throw ex1;
}
throw ex;
}
}