[ISSUES#8905]simplify some code (#8908)

This commit is contained in:
liushaoyu-soft 2022-08-11 14:32:50 +08:00 committed by GitHub
parent 493b99b726
commit 0c61c5d5eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,16 +30,13 @@ public class MD5Utils {
private static final char[] DIGITS_LOWER = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd',
'e', 'f'};
private static final ThreadLocal<MessageDigest> MESSAGE_DIGEST_LOCAL = new ThreadLocal<MessageDigest>() {
@Override
protected MessageDigest initialValue() {
try {
return MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
return null;
}
private static final ThreadLocal<MessageDigest> MESSAGE_DIGEST_LOCAL = ThreadLocal.withInitial(() -> {
try {
return MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
return null;
}
};
});
/**
* Calculate MD5 hex string.