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 639e073a Allow longer data in pattern IMAPReply.UNTAGGED_RESPONSE 639e073a is described below commit 639e073ac3f012c66206e4f75617064ef72aaee3 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Fri May 31 17:25:23 2024 -0400 Allow longer data in pattern IMAPReply.UNTAGGED_RESPONSE - For example: * OK The Microsoft Exchange IMAP4 service is ready. [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] - Somehow, Jacoco thinks this changes the branchRatio --- pom.xml | 2 +- src/changes/changes.xml | 1 + src/main/java/org/apache/commons/net/imap/IMAPReply.java | 2 +- src/test/java/org/apache/commons/net/imap/IMAPReplyTest.java | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 4f819e5b..289b1179 100644 --- a/pom.xml +++ b/pom.xml @@ -78,7 +78,7 @@ Supported protocols include Echo, Finger, FTP, NNTP, NTP, POP3(S), SMTP(S), Teln <commons.jacoco.classRatio>0.47</commons.jacoco.classRatio> <commons.jacoco.instructionRatio>0.41</commons.jacoco.instructionRatio> <commons.jacoco.methodRatio>0.40</commons.jacoco.methodRatio> - <commons.jacoco.branchRatio>0.32</commons.jacoco.branchRatio> + <commons.jacoco.branchRatio>0.31</commons.jacoco.branchRatio> <commons.jacoco.lineRatio>0.38</commons.jacoco.lineRatio> <commons.jacoco.complexityRatio>0.31</commons.jacoco.complexityRatio> </properties> diff --git a/src/changes/changes.xml b/src/changes/changes.xml index c924b770..4aa8b30e 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -66,6 +66,7 @@ The <action> type attribute can be add,update,fix,remove. <body> <release version="3.11.1" date="YYYY-MM-DD" description="This is a feature and maintenance release. Java 8 or later is required."> <!-- FIX --> + <action type="fix" dev="ggregory" due-to="Stuart Maclean, Gary Gregory">Allow longer data in pattern IMAPReply.UNTAGGED_RESPONSE.</action> <!-- ADD --> <!-- UPDATE --> </release> 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 a656e4cd..26070b17 100644 --- a/src/main/java/org/apache/commons/net/imap/IMAPReply.java +++ b/src/main/java/org/apache/commons/net/imap/IMAPReply.java @@ -82,7 +82,7 @@ public final class IMAPReply { * Don't look for more than 80 backslashes. * Don't look for more than 80 character. */ - private static final String UNTAGGED_RESPONSE = "^\\* (\\S{1,80}).{0,80}"; + private static final String UNTAGGED_RESPONSE = "^\\* (\\S{1,80}).{0,160}"; 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 311afd00..888710a3 100644 --- a/src/test/java/org/apache/commons/net/imap/IMAPReplyTest.java +++ b/src/test/java/org/apache/commons/net/imap/IMAPReplyTest.java @@ -131,8 +131,8 @@ public class IMAPReplyTest { @Test public void testGetUntaggedReplyCodeOkLine() throws IOException { - final String okLine = "* OK Salvage successful, no data lost"; - assertEquals(IMAPReply.OK, IMAPReply.getUntaggedReplyCode(okLine)); + 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]")); } @Test