This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit a9c9f02ac5171b3d9f7351ec99e85a87d0eebbff Author: Benoit TELLIER <btell...@linagora.com> AuthorDate: Sat Mar 16 22:11:29 2024 +0100 [FIX] FETCH: do not reuse FetchResponseBuilder --- .../apache/james/imap/processor/fetch/FetchProcessor.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java index 83578d358b..db2c99fb90 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java @@ -227,14 +227,13 @@ public class FetchProcessor extends AbstractMailboxProcessor<FetchRequest> { * {@link org.apache.james.imap.api.process.ImapProcessor.Responder} */ private Mono<Void> processMessageRanges(SelectedMailbox selected, MessageManager mailbox, List<MessageRange> ranges, FetchData fetch, MailboxSession mailboxSession, Responder responder, ImapSession imapSession) { - FetchResponseBuilder builder = new FetchResponseBuilder(new EnvelopeBuilder()); FetchGroup resultToFetch = FetchDataConverter.getFetchGroup(fetch); if (fetch.isOnlyFlags()) { return Flux.fromIterable(consolidate(selected, ranges, fetch)) .concatMap(range -> Flux.from(mailbox.listMessagesMetadata(range, mailboxSession))) .filter(ids -> !fetch.contains(Item.MODSEQ) || ids.getModSeq().asLong() > fetch.getChangedSince()) - .concatMap(result -> toResponse(mailbox, fetch, mailboxSession, builder, selected, result)) + .concatMap(result -> toResponse(mailbox, fetch, mailboxSession, selected, result)) .doOnNext(responder::respond) .then(); } else { @@ -245,7 +244,7 @@ public class FetchProcessor extends AbstractMailboxProcessor<FetchRequest> { return Flux.from(mailbox.getMessagesReactive(range, resultToFetch, mailboxSession)) .filter(ids -> !fetch.contains(Item.MODSEQ) || ids.getModSeq().asLong() > fetch.getChangedSince()) - .concatMap(result -> toResponse(mailbox, fetch, mailboxSession, builder, selected, result)); + .concatMap(result -> toResponse(mailbox, fetch, mailboxSession, selected, result)); }) .subscribe(fetchSubscriber); @@ -266,9 +265,9 @@ public class FetchProcessor extends AbstractMailboxProcessor<FetchRequest> { return MessageRange.toRanges(filter.longStream().mapToObj(MessageUid::of).collect(ImmutableList.toImmutableList())); } - private Mono<FetchResponse> toResponse(MessageManager mailbox, FetchData fetch, MailboxSession mailboxSession, FetchResponseBuilder builder, SelectedMailbox selected, org.apache.james.mailbox.model.ComposedMessageIdWithMetaData result) { + private Mono<FetchResponse> toResponse(MessageManager mailbox, FetchData fetch, MailboxSession mailboxSession, SelectedMailbox selected, org.apache.james.mailbox.model.ComposedMessageIdWithMetaData result) { try { - return builder.build(fetch, result, mailbox, selected, mailboxSession); + return new FetchResponseBuilder(new EnvelopeBuilder()).build(fetch, result, mailbox, selected, mailboxSession); } catch (MessageRangeException e) { // we can't for whatever reason find the message so // just skip it and log it to debug @@ -285,9 +284,9 @@ public class FetchProcessor extends AbstractMailboxProcessor<FetchRequest> { } } - private Mono<FetchResponse> toResponse(MessageManager mailbox, FetchData fetch, MailboxSession mailboxSession, FetchResponseBuilder builder, SelectedMailbox selected, MessageResult result) { + private Mono<FetchResponse> toResponse(MessageManager mailbox, FetchData fetch, MailboxSession mailboxSession, SelectedMailbox selected, MessageResult result) { try { - return builder.build(fetch, result, mailbox, selected, mailboxSession); + return new FetchResponseBuilder(new EnvelopeBuilder()).build(fetch, result, mailbox, selected, mailboxSession); } catch (MessageRangeException e) { // we can't for whatever reason find the message so // just skip it and log it to debug --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org