You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by GitBox <gi...@apache.org> on 2021/08/13 07:21:36 UTC
[GitHub] [incubator-shenyu] HessTina-YuI commented on a change in pull request #1915: refactor:[ISSUE #1866] remove lombok dependency
HessTina-YuI commented on a change in pull request #1915:
URL: https://github.com/apache/incubator-shenyu/pull/1915#discussion_r688299950
##########
File path: shenyu-common/src/main/java/org/apache/shenyu/common/utils/Md5Utils.java
##########
@@ -34,13 +41,20 @@
* @param charset the charset
* @return the string
*/
- @SneakyThrows
private static String md5(final String src, final String charset) {
- MessageDigest md5;
+ MessageDigest md5 = null;
StringBuilder hexValue = new StringBuilder(32);
- md5 = MessageDigest.getInstance("MD5");
- byte[] byteArray;
- byteArray = src.getBytes(charset);
+ try {
+ md5 = MessageDigest.getInstance("MD5");
+ } catch (NoSuchAlgorithmException e) {
+ LOG.error(e.getMessage(), e);
+ }
+ byte[] byteArray = new byte[0];
+ try {
+ byteArray = src.getBytes(charset);
+ } catch (UnsupportedEncodingException e) {
+ LOG.error(e.getMessage(), e);
+ }
byte[] md5Bytes = md5.digest(byteArray);
Review comment:
There may be a NPE, please add judgment condition.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org