Added workaround for folder list processing error

pull/214/head
M66B 10 months ago
parent e5f89e4d90
commit 8f84ccd178

@ -930,17 +930,26 @@ public class EmailService implements AutoCloseable {
List<EntityFolder> getFolders() throws MessagingException { List<EntityFolder> getFolders() throws MessagingException {
List<EntityFolder> folders = new ArrayList<>(); List<EntityFolder> folders = new ArrayList<>();
for (Folder ifolder : getStore().getDefaultFolder().list("*")) { try {
String fullName = ifolder.getFullName(); for (Folder ifolder : getStore().getDefaultFolder().list("*")) {
String[] attrs = ((IMAPFolder) ifolder).getAttributes(); String fullName = ifolder.getFullName();
String type = EntityFolder.getType(attrs, fullName, true); String[] attrs = ((IMAPFolder) ifolder).getAttributes();
Log.i(fullName + " attrs=" + TextUtils.join(" ", attrs) + " type=" + type); String type = EntityFolder.getType(attrs, fullName, true);
Log.i(fullName + " attrs=" + TextUtils.join(" ", attrs) + " type=" + type);
if (type != null)
folders.add(new EntityFolder(fullName, type)); if (type != null)
} folders.add(new EntityFolder(fullName, type));
}
EntityFolder.guessTypes(folders); EntityFolder.guessTypes(folders);
} catch (MessagingException ex) {
if (ex.getMessage() != null &&
ex.getMessage().contains("LIST processing failed")) {
Log.w(ex);
folders.add(new EntityFolder("Inbox", EntityFolder.INBOX));
} else
throw ex;
}
return folders; return folders;
} }

Loading…
Cancel
Save