Commit 8c84cc4d authored by Francisco Cunha's avatar Francisco Cunha

Revert "P4A-800 - Push try catch outside to encapsulate for loop"

This reverts commit 27f5e67b
parent 27f5e67b
......@@ -710,10 +710,11 @@ class ImapFolder extends Folder<ImapMessage> {
String spaceSeparatedFetchFields = combine(fetchFields.toArray(new String[fetchFields.size()]), ' ');
try {
for (int windowStart = 0; windowStart < messages.size(); windowStart += (FETCH_WINDOW_SIZE)) {
int windowEnd = Math.min(windowStart + FETCH_WINDOW_SIZE, messages.size());
List<String> uidWindow = uids.subList(windowStart, windowEnd);
for (int windowStart = 0; windowStart < messages.size(); windowStart += (FETCH_WINDOW_SIZE)) {
int windowEnd = Math.min(windowStart + FETCH_WINDOW_SIZE, messages.size());
List<String> uidWindow = uids.subList(windowStart, windowEnd);
try {
String commaSeparatedUids = combine(uidWindow.toArray(new String[uidWindow.size()]), ',');
String command = String.format("UID FETCH %s (%s)", commaSeparatedUids, spaceSeparatedFetchFields);
connection.sendCommand(command, false);
......@@ -783,13 +784,12 @@ class ImapFolder extends Folder<ImapMessage> {
}
} while (response.getTag() == null);
}
if (listener != null) {
listener.messagesFinished(messages.size());
} catch (IOException ioe) {
throw ioExceptionHandler(connection, ioe);
}
} catch (IOException ioe) {
throw ioExceptionHandler(connection, ioe);
}
if (listener != null) {
listener.messagesFinished(messages.size());
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment