woj-tek commented on code in PR #2386:
URL: https://github.com/apache/james-project/pull/2386#discussion_r1726750795


##########
protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java:
##########
@@ -444,14 +444,10 @@ protected Optional<MessageRange> 
messageRange(SelectedMailbox selected, IdRange
 
     private MessageRange msnRangeToMessageRange(SelectedMailbox selected, long 
lowVal, long highVal)
             throws MessageRangeException {
-        // Take care of "*" and "*:*" values by return the last message in
+        // Take care of "*", "1:*" and "*:*" values by return the last message 
in
         // the mailbox. See IMAP-289
-        if (lowVal == Long.MAX_VALUE && highVal == Long.MAX_VALUE) {
-            Optional<MessageUid> last = selected.getLastUid();
-            if (!last.isPresent()) {
-                throw new MessageRangeException("Mailbox is empty");
-            }
-            return last.get().toRange();
+        if ((lowVal == Long.MAX_VALUE || lowVal == 1) && highVal == 
Long.MAX_VALUE) {
+            return MessageRange.all();
         }

Review Comment:
   Added missing tests to the non-empty mailbox and fixed the logic for range 
retrieval.



-- 
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