🐛 Object的equals方法容易抛空指针异常,应使用常量或确定有值的对象来调用equals。

This commit is contained in:
徐晓伟
2023-03-15 08:35:52 +08:00
parent 68d9148fa7
commit 270db3b53e
38 changed files with 129 additions and 129 deletions

View File

@@ -50,7 +50,7 @@ public class QrCodeServiceImpl implements QrCodeService {
Map<Object, Object> dataMap = JSONObject.toJavaObject(data, Map.class);
for (Map.Entry<Object, Object> m : dataMap.entrySet()) {
if(m.getKey().equals("path")){
if("path".equals(m.getKey())){
//前端路由, 不需要拼参数
page = m.getValue().toString();
continue;

View File

@@ -951,10 +951,10 @@ public class UserCenterServiceImpl extends ServiceImpl<UserDao, User> implements
* 绑定手机号数据校验
*/
private void checkBindingPhone(WxBindingPhoneRequest request) {
if (!request.getType().equals("public") && !request.getType().equals("routine") && !request.getType().equals("iosWx") && !request.getType().equals("androidWx")) {
if (!"public".equals(request.getType()) && !"routine".equals(request.getType()) && !"iosWx".equals(request.getType()) && !"androidWx".equals(request.getType())) {
throw new CrmebException("未知的用户类型");
}
if (request.getType().equals("public")) {
if ("public".equals(request.getType())) {
if (StrUtil.isBlank(request.getCaptcha())) {
throw new CrmebException("验证码不能为空");
}