refactor: 使用Convert工具进行类型转换,避免潜在的 NumberFormatException
- 在 RateLimiterFilter 中使用 Convert.toLong 替代 Long.parseLong - 在 UserImportListener 中使用 Convert.toInt 替代 Integer.parseInt - 这些修改提高了代码的健壮性和容错性,避免了潜在的 NumberFormatException
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.youlai.boot.system.listener;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
@@ -112,7 +113,7 @@ public class UserImportListener extends BaseAnalysisEventListener<UserImportDTO>
|
||||
.last("limit 1")
|
||||
);
|
||||
if (dictData != null) {
|
||||
Integer genderValue = Integer.parseInt(dictData.getValue());
|
||||
Integer genderValue = Convert.toInt(dictData.getValue(),0);
|
||||
entity.setGender(genderValue);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user