You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2019/11/19 02:43:07 UTC
[james-project] 05/43: [Refactoring] mailet-base StringUtils:
remove unused methods
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 82659ad0aa3232a3c6fdb01305aafd75363c56bb
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 11:32:14 2019 +0700
[Refactoring] mailet-base StringUtils: remove unused methods
---
.../java/org/apache/mailet/base/StringUtils.java | 56 ----------------------
1 file changed, 56 deletions(-)
diff --git a/mailet/base/src/main/java/org/apache/mailet/base/StringUtils.java b/mailet/base/src/main/java/org/apache/mailet/base/StringUtils.java
index 5337448..0ba3c5a 100644
--- a/mailet/base/src/main/java/org/apache/mailet/base/StringUtils.java
+++ b/mailet/base/src/main/java/org/apache/mailet/base/StringUtils.java
@@ -19,8 +19,6 @@
package org.apache.mailet.base;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
@@ -67,60 +65,6 @@ public final class StringUtils {
}
return list.toArray(new String[list.size()]);
}
-
- /**
- * Creates an MD5 digest from the message.
- * Note that this implementation is unsalted.
- * @param message not null
- * @return MD5 digest, not null
- */
- public static String md5(java.lang.String message) {
- try {
- MessageDigest md = MessageDigest.getInstance("MD5");
- StringBuilder sb = new StringBuilder();
- byte[] buf = message.getBytes();
- byte[] md5 = md.digest(buf);
-
- for (byte aMd5 : md5) {
- String tmpStr = "0" + Integer.toHexString((0xff & aMd5));
- sb.append(tmpStr.substring(tmpStr.length() - 2));
- }
- return sb.toString();
-
- } catch (NoSuchAlgorithmException e) {
- return null;
- }
- }
-
- /**
- * Capitalizes each word in the given text by converting the
- * first letter to upper case.
- * @param data text to be capitalize, possibly null
- * @return text with each work capitalized,
- * or null when the text is null
- */
- public static String capitalizeWords(String data) {
- if (data == null) {
- return null;
- }
- StringBuilder res = new StringBuilder();
- char ch;
- char prevCh = '.';
- for (int i = 0; i < data.length(); i++) {
- ch = data.charAt(i);
- if (Character.isLetter(ch)) {
- if (!Character.isLetter(prevCh)) {
- res.append(Character.toUpperCase(ch));
- } else {
- res.append(Character.toLowerCase(ch));
- }
- } else {
- res.append(ch);
- }
- prevCh = ch;
- }
- return res.toString();
- }
/**
* Utility method for obtaining a string representation of an array of Objects.
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org