Source:
private void sendAndProcessUidFetchCommand(UidFetchCommand command, HashMap<String, Message> messageMap, MessageRetrievalListener<ImapMessage> listener) throws MessagingException, IOException { command.send(connection); ImapResponse response; int messageNumber = 0; do { response = command.readResponse(connection); if (response.getTag() == null && ImapResponseParser.equalsIgnoreCase(response.get(1), "FETCH")) { ImapList fetchList = (ImapList) response.getKeyedValue("FETCH"); String uid = fetchList.getKeyedString("UID"); long msgSeq = response.getLong(0); if (uid != null) { try { msgSeqUidMap.put(msgSeq, uid); if (K9MailLib.isDebug()) { Timber.v("Stored uid '%s' for msgSeq %d into map", uid, msgSeq); } } catch (Exception e) { Timber.e("Unable to store uid '%s' for msgSeq %d", uid, msgSeq); } } Message message = messageMap.get(uid); if (message == null) { if (K9MailLib.isDebug()) { Timber.d("Do not have message in messageMap for UID %s for %s", uid, getLogId()); } handleUntaggedResponse(response); continue; } if (listener != null) { listener.messageStarted(uid, messageNumber, messageMap.size()); } ImapMessage imapMessage = (ImapMessage) message; Object literal = handleFetchResponse(imapMessage, fetchList); if (literal != null) { if (literal instanceof String) { String bodyString = (String) literal; InputStream bodyStream = new ByteArrayInputStream(bodyString.getBytes()); imapMessage.parse(bodyStream); } else if (literal instanceof Integer) { } else { throw new MessagingException("Got FETCH response with bogus parameters"); } } if (listener != null) { listener.messageFinished(imapMessage, messageNumber, messageMap.size()); } messageNumber++; } else { handleUntaggedResponse(response); } } while (response.getTag() == null); }

Target:
private void sendAndProcessUidFetchCommand(UidFetchCommand command, HashMap<String, Message> messageMap, MessageRetrievalListener<ImapMessage> listener) throws MessagingException, IOException { ImapResponse response; int messageNumber = 0; command.send(connection); do { response = command.readResponse(connection); if (response.getTag() == null && ImapResponseParser.equalsIgnoreCase(response.get(1), "FETCH")) { ImapList fetchList = (ImapList) response.getKeyedValue("FETCH"); String uid = fetchList.getKeyedString("UID"); long msgSeq = response.getLong(0); if (uid != null) { msgSeqUidMap.put(msgSeq, uid); if (K9MailLib.isDebug()) { Timber.v("Stored uid '%s' for msgSeq %d into map", uid, msgSeq); } } Message message = messageMap.get(uid); if (message == null) { if (K9MailLib.isDebug()) { Timber.d("Do not have message in messageMap for UID %s for %s", uid, getLogId()); } handleUntaggedResponse(response); continue; } if (listener != null) { listener.messageStarted(uid, messageNumber, messageMap.size()); } ImapMessage imapMessage = (ImapMessage) message; Object literal = handleFetchResponse(imapMessage, fetchList); if (literal != null) { if (literal instanceof String) { String bodyString = (String) literal; InputStream bodyStream = new ByteArrayInputStream(bodyString.getBytes()); imapMessage.parse(bodyStream); } else if (literal instanceof Integer) { } else { throw new MessagingException("Got FETCH response with bogus parameters"); } } if (listener != null) { listener.messageFinished(imapMessage, messageNumber, messageMap.size()); } messageNumber++; } else { handleUntaggedResponse(response); } } while (response.getTag() == null); }