woj-tek commented on PR #2385:
URL: https://github.com/apache/james-project/pull/2385#issuecomment-2302215010

   I noticed one discrepancy in the provided tests:
   
   ```
   C: b3 FETCH 1:* (UID)
   ```
   
   vs what I observerd:
   ```
   C: b3 UID FETCH 1:* (UID)
   ```
   
   When I include the UID I get the same codepath and it's quite simple to fix 
with calling `okComplete(request, responder);` 
   
   However without UID if fails with different codepath:
   
   
   ```
   org.apache.james.mailbox.exception.MessageRangeException: No message found 
with msn 1
        at 
org.apache.james.imap.processor.AbstractMailboxProcessor.msnlowValToUid(AbstractMailboxProcessor.java:470)
        at 
org.apache.james.imap.processor.AbstractMailboxProcessor.msnRangeToMessageRange(AbstractMailboxProcessor.java:460)
        at 
org.apache.james.imap.processor.AbstractMailboxProcessor.messageRange(AbstractMailboxProcessor.java:425)
   ```
   
   Which is kinda the same issue but slightly different. I imagine touching 
implementation for other processors would be problematic (getting ranges out of 
scope should yield error) but in this case maybe checking if the mailbox is 
empty with `session.getSelected().getLastUid().isEmpty()` and if so returning 
OK as well?:
   
   ```java
   for (IdRange range : request.getIdSet()) {
       if (session.getSelected().getLastUid().isEmpty()) {
           continue;
       }
       Optional<MessageRange> messageSet = messageRange(session.getSelected(), 
range, request.isUseUids());
       if (messageSet.isPresent()) {
           MessageRange normalizedMessageSet = normalizeMessageRange(selected, 
messageSet.orElse(null));
           MessageRange batchedMessageSet = 
MessageRange.range(normalizedMessageSet.getUidFrom(), 
normalizedMessageSet.getUidTo());
           ranges.add(batchedMessageSet);
       }
   }
   ```
   
   
   ----
   
   > Only ASF james commiters can edit this PR, yes.
   > 
   > I think it is easier to open a new branch, new PR, cherry-pick my work 
then close this one.
   
   I think I can create branch from this one just fine.
   
   (GH should offer adding "contributors" to PRs - would be very convenient)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to