fix: 修正了数据库命名错误的问题.

由于 MessageDigest 不适用于多线程环境, 导致用于创建数据库名称的数据会不断累加, 最终出现 botToken 无法对应数据库的问题.
This commit is contained in:
2022-01-16 21:12:48 +08:00
parent 37f0d4e6b8
commit 19c601817c
2 changed files with 3 additions and 4 deletions

View File

@ -8,7 +8,8 @@ final class ByteUtils {
public static String bytesToHexString(byte[] bytes) {
StringBuilder builder = new StringBuilder();
for (byte aByte : bytes) {
builder.append(Integer.toHexString(aByte));
String hexBit = Integer.toHexString(aByte & 0xFF);
builder.append(hexBit.length() == 1 ? "0" + hexBit : hexBit);
}
return builder.toString();
}