This is an automated email from the ASF dual-hosted git repository. rcordier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 1f2140a6a7bd3a976671d226062606b41da943cb Author: Benoit TELLIER <btell...@linagora.com> AuthorDate: Thu Oct 31 10:56:59 2024 +0100 JAMES-3954 PartialRange might be reversed --- .../resources/org/apache/james/imap/scripts/SearchAtoms.test | 4 ++++ .../java/org/apache/james/imap/api/message/PartialRange.java | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SearchAtoms.test b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SearchAtoms.test index 37b523d4f5..86acd35f5e 100644 --- a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SearchAtoms.test +++ b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SearchAtoms.test @@ -1933,6 +1933,10 @@ C: A153 UID SEARCH RETURN (PARTIAL -1:-5) UNFLAGGED S: \* ESEARCH \(TAG "A153"\) UID PARTIAL \(-1:-5 15:19\) S: A153 OK SEARCH completed\. +C: A153 UID SEARCH RETURN (PARTIAL -5:-1) UNFLAGGED +S: \* ESEARCH \(TAG "A153"\) UID PARTIAL \(-1:-5 15:19\) +S: A153 OK SEARCH completed\. + C: A154 UID SEARCH RETURN (PARTIAL 50:100) UNFLAGGED S: \* ESEARCH \(TAG \"A154\"\) UID PARTIAL \(50:100 NIL\) S: A154 OK SEARCH completed\. diff --git a/protocols/imap/src/main/java/org/apache/james/imap/api/message/PartialRange.java b/protocols/imap/src/main/java/org/apache/james/imap/api/message/PartialRange.java index ccdd04da3a..7c481e9958 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/api/message/PartialRange.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/api/message/PartialRange.java @@ -32,10 +32,14 @@ public class PartialRange { checkArgument(lowVal != 0, "'lowVal' cannot be equal to 0"); checkArgument(upVal != 0, "'upVal' cannot be equal to 0"); checkArgument(lowVal > 0 == upVal > 0, "Both 'upVal' and 'lowVal' must have the same sign, got lowVal=" + lowVal + " and upVal=" + upVal); - checkArgument(Math.abs(lowVal) <= Math.abs(upVal), - "'lowVal' absolute value must lower than upVal absolute value, got lowVal=" + lowVal + " and upVal=" + upVal); - this.lowVal = lowVal; - this.upVal = upVal; + + if (Math.abs(lowVal) <= Math.abs(upVal)) { + this.lowVal = lowVal; + this.upVal = upVal; + } else { + this.lowVal = upVal; + this.upVal = lowVal; + } } public void checkArgument(boolean condition, String explanation) throws DecodingException { --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org