This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-net.git


The following commit(s) were added to refs/heads/master by this push:
     new 5b7e8d09 Increase message limit in IMAPReply.UNTAGGED_RESPONSE from 
160 to 500 characters
5b7e8d09 is described below

commit 5b7e8d09c9a0e4b61ad3e9271c16a5f077060b41
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Mon Aug 26 15:06:29 2024 -0400

    Increase message limit in IMAPReply.UNTAGGED_RESPONSE from 160 to 500
    characters
---
 src/changes/changes.xml                                      | 1 +
 src/main/java/org/apache/commons/net/imap/IMAPReply.java     | 4 ++--
 src/test/java/org/apache/commons/net/imap/IMAPReplyTest.java | 6 +++++-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 98f72b24..862d64b6 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -77,6 +77,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate direct 
access to org.apache.commons.net.nntp.Article.kid and next fields.</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix SpotBugs 
CT_CONSTRUCTOR_THROW in Base64 by implementing finalize() as a noop to avoid 
finalizer attacks.</action>
       <action type="fix" dev="ggregory" due-to="Andreas Lemke, Gary 
Gregory">Increase message limit in IMAPReply.TAGGED_RESPONSE from 80 to 500 
characters.</action>
+      <action type="fix" dev="ggregory" due-to="Andreas Lemke, Gary 
Gregory">Increase message limit in IMAPReply.UNTAGGED_RESPONSE from 160 to 500 
characters.</action>
       <!-- ADD -->
       <action type="add" dev="ggregory" due-to="Gary 
Gregory">org.apache.commons.net.nntp.Article#getChild().</action>
       <action type="add" dev="ggregory" due-to="Gary 
Gregory">org.apache.commons.net.nntp.Article#getNext().</action>
diff --git a/src/main/java/org/apache/commons/net/imap/IMAPReply.java 
b/src/main/java/org/apache/commons/net/imap/IMAPReply.java
index 50b64c2e..59f954f7 100644
--- a/src/main/java/org/apache/commons/net/imap/IMAPReply.java
+++ b/src/main/java/org/apache/commons/net/imap/IMAPReply.java
@@ -84,10 +84,10 @@ public final class IMAPReply {
      * <ol>
      * <li>the start of a line, then a star, then a space.</li>
      * <li>non-whitespace characters, up to 80, for example {@code OK}.</li>
-     * <li>up to 160 extra characters.</li>
+     * <li>up to 500 extra characters.</li>
      * </ol>
      */
-    private static final String UNTAGGED_RESPONSE = "^\\* (\\S{1,80}).{0,160}";
+    private static final String UNTAGGED_RESPONSE = "^\\* (\\S{1,80}).{0,500}";
 
     private static final Pattern UNTAGGED_PATTERN = 
Pattern.compile(UNTAGGED_RESPONSE);
     private static final Pattern LITERAL_PATTERN = 
Pattern.compile("\\{(\\d+)\\}$"); // {dd}
diff --git a/src/test/java/org/apache/commons/net/imap/IMAPReplyTest.java 
b/src/test/java/org/apache/commons/net/imap/IMAPReplyTest.java
index d80fbd3a..84cb1411 100644
--- a/src/test/java/org/apache/commons/net/imap/IMAPReplyTest.java
+++ b/src/test/java/org/apache/commons/net/imap/IMAPReplyTest.java
@@ -138,7 +138,11 @@ public class IMAPReplyTest {
     @Test
     public void testGetUntaggedReplyCodeOkLine() throws IOException {
         assertEquals(IMAPReply.OK, IMAPReply.getUntaggedReplyCode("* OK 
Salvage successful, no data lost"));
-        assertEquals(IMAPReply.OK, IMAPReply.getUntaggedReplyCode("* OK The 
Microsoft Exchange IMAP4 service is ready. 
[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]"));
+        assertEquals(IMAPReply.OK,
+                IMAPReply.getUntaggedReplyCode("* OK The Microsoft Exchange 
IMAP4 service is ready. [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]"));
+        assertEquals(IMAPReply.OK, IMAPReply.getUntaggedReplyCode(
+                "* OK The Microsoft Exchange IMAP4 service is ready. 
[TQBXADIAUABSADIAMQAwADEAQwBBADAAMAAzADYALgBuAGEAbQBwAHIAZAAyADEALgBwAHIAbwBkAC4AbwB1AHQAbABvAG8AawAuAGMAbwBtAA==]"));
+
     }
 
     @Test

Reply via email to