Simplified search exceptions

This commit is contained in:
M66B 2021-06-17 22:35:48 +02:00
parent 019806b3c5
commit 2f256310cc
1 changed files with 65 additions and 59 deletions

View File

@ -353,7 +353,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
return found; return found;
} }
private int load_server(final State state) throws MessagingException, IOException { private int load_server(final State state) throws MessagingException, ProtocolException, IOException {
DB db = DB.getInstance(context); DB db = DB.getInstance(context);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
@ -418,7 +418,8 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
else else
state.imessages = state.ifolder.search(new AndTerm(and.toArray(new SearchTerm[0]))); state.imessages = state.ifolder.search(new AndTerm(and.toArray(new SearchTerm[0])));
EntityLog.log(context, "Boundary filter messages=" + state.imessages.length); EntityLog.log(context, "Boundary filter messages=" + state.imessages.length);
} else { } else
try {
Object result = state.ifolder.doCommand(new IMAPFolder.ProtocolCommand() { Object result = state.ifolder.doCommand(new IMAPFolder.ProtocolCommand() {
@Override @Override
public Object doCommand(IMAPProtocol protocol) throws ProtocolException { public Object doCommand(IMAPProtocol protocol) throws ProtocolException {
@ -484,6 +485,11 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
}); });
state.imessages = (Message[]) result; state.imessages = (Message[]) result;
} catch (MessagingException ex) {
if (ex.getCause() instanceof ProtocolException)
throw (ProtocolException) ex.getCause();
else
throw ex;
} }
EntityLog.log(context, "Boundary found messages=" + state.imessages.length); EntityLog.log(context, "Boundary found messages=" + state.imessages.length);