This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit a8e68044afbbed9391ea64c6d2b037bf0f061f1b Author: Benoit Tellier <[email protected]> AuthorDate: Sun Nov 17 11:28:00 2019 +0700 [Refactoring] Remove unused MailetUtil::normalizeSubject method --- .../java/org/apache/mailet/base/MailetUtil.java | 62 +--------------------- 1 file changed, 1 insertion(+), 61 deletions(-) diff --git a/mailet/base/src/main/java/org/apache/mailet/base/MailetUtil.java b/mailet/base/src/main/java/org/apache/mailet/base/MailetUtil.java index 238fa7b..3174215 100644 --- a/mailet/base/src/main/java/org/apache/mailet/base/MailetUtil.java +++ b/mailet/base/src/main/java/org/apache/mailet/base/MailetUtil.java @@ -17,82 +17,22 @@ * under the License. * ****************************************************************/ - - package org.apache.mailet.base; import java.util.Optional; + import javax.mail.MessagingException; import org.apache.mailet.MailetConfig; import com.google.common.base.Strings; - /** * Collects utility methods. */ public class MailetUtil { /** - * <p>This takes the subject string and reduces (normailzes) it. - * Multiple "Re:" entries are reduced to one, and capitalized. The - * prefix is always moved/placed at the beginning of the line, and - * extra blanks are reduced, so that the output is always of the - * form:</p> - * <code> - * <prefix> + <one-optional-"Re:"*gt; + <remaining subject> - * </code> - * <p>I have done extensive testing of this routine with a standalone - * driver, and am leaving the commented out debug messages so that - * when someone decides to enhance this method, it can be yanked it - * from this file, embedded it with a test driver, and the comments - * enabled.</p> - */ - public static String normalizeSubject(String subj, String prefix) { - StringBuilder subject = new StringBuilder(subj); - int prefixLength = prefix.length(); - - // If the "prefix" is not at the beginning the subject line, remove it - int index = subject.indexOf(prefix); - if (index != 0) { - - if (index > 0) { - subject.delete(index, index + prefixLength); - } - subject.insert(0, prefix); // insert prefix at the front - } - - // Replace Re: with RE: - String match = "Re:"; - index = subject.indexOf(match, prefixLength); - - while (index > -1) { - subject.replace(index, index + match.length(), "RE:"); - index = subject.indexOf(match, prefixLength); - } - - // Reduce them to one at the beginning - match = "RE:"; - int indexRE = subject.indexOf(match, prefixLength) + match.length(); - index = subject.indexOf(match, indexRE); - while (index > 0) { - subject.delete(index, index + match.length()); - index = subject.indexOf(match, indexRE); - } - - // Reduce blanks - match = " "; - index = subject.indexOf(match, prefixLength); - while (index > -1) { - subject.replace(index, index + match.length(), " "); - index = subject.indexOf(match, prefixLength); - } - return subject.toString(); - } - - - /** * <p>Gets a boolean valued init parameter.</p> * @param config not null * @param name name of the init parameter to be queried --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
