Report search error once

This commit is contained in:
M66B 2019-01-22 09:08:12 +00:00
parent eefe9667ec
commit f355a0a2c8
1 changed files with 7 additions and 2 deletions

View File

@ -66,6 +66,7 @@ public class ViewModelBrowse extends ViewModel {
Message[] imessages = null;
int index = -1;
boolean error = false;
}
void set(Context context, long folder, String search, int pageSize) {
@ -75,6 +76,7 @@ public class ViewModelBrowse extends ViewModel {
currentState.search = search;
currentState.pageSize = pageSize;
currentState.index = -1;
currentState.error = false;
}
boolean isSearching() {
@ -83,8 +85,8 @@ public class ViewModelBrowse extends ViewModel {
}
void load() throws MessagingException, IOException {
State state = currentState;
if (state == null)
final State state = currentState;
if (state == null || state.error)
return;
DB db = DB.getInstance(state.context);
@ -157,6 +159,7 @@ public class ViewModelBrowse extends ViewModel {
try {
Properties props = MessageHelper.getSessionProperties(account.auth_type, account.realm, account.insecure);
Session isession = Session.getInstance(props, null);
isession.setDebug(true);
Log.i("Boundary connecting account=" + account.name);
state.istore = (IMAPStore) isession.getStore(account.starttls ? "imap" : "imaps");
@ -188,11 +191,13 @@ public class ViewModelBrowse extends ViewModel {
}
state.imessages = state.ifolder.search(term);
}
Log.i("Boundary found messages=" + state.imessages.length);
state.index = state.imessages.length - 1;
} catch (Throwable ex) {
state.error = true;
if (ex instanceof FolderClosedException)
Log.w("Search", ex);
else {