diff --git a/src/main/java/me/zhyd/oauth/request/AuthBaiduRequest.java b/src/main/java/me/zhyd/oauth/request/AuthBaiduRequest.java index 2225cacf11d585f08f63b430df196d677494a252..ff743d4967a8cb3b0ce20f93e9b695a94d1c9f3c 100644 --- a/src/main/java/me/zhyd/oauth/request/AuthBaiduRequest.java +++ b/src/main/java/me/zhyd/oauth/request/AuthBaiduRequest.java @@ -29,7 +29,7 @@ public class AuthBaiduRequest extends BaseAuthRequest { HttpResponse response = HttpRequest.post(accessTokenUrl).execute(); JSONObject accessTokenObject = JSONObject.parseObject(response.body()); AuthBaiduErrorCode errorCode = AuthBaiduErrorCode.getErrorCode(accessTokenObject.getString("error")); - if (!AuthBaiduErrorCode.OK.equals(errorCode)) { + if (AuthBaiduErrorCode.OK != errorCode) { throw new AuthException(errorCode.getDesc()); } return AuthToken.builder().accessToken(accessTokenObject.getString("access_token")).build(); @@ -42,7 +42,7 @@ public class AuthBaiduRequest extends BaseAuthRequest { String userInfo = response.body(); JSONObject object = JSONObject.parseObject(userInfo); AuthBaiduErrorCode errorCode = AuthBaiduErrorCode.getErrorCode(object.getString("error")); - if (!AuthBaiduErrorCode.OK.equals(errorCode)) { + if (AuthBaiduErrorCode.OK != errorCode) { throw new AuthException(errorCode.getDesc()); } return AuthUser.builder() diff --git a/src/main/java/me/zhyd/oauth/request/AuthDingTalkRequest.java b/src/main/java/me/zhyd/oauth/request/AuthDingTalkRequest.java index 05955e1df1ff7771c46a349d6971c20734e4ef29..cf50b1313a41a0e150f206fbb6d866801a82d555 100644 --- a/src/main/java/me/zhyd/oauth/request/AuthDingTalkRequest.java +++ b/src/main/java/me/zhyd/oauth/request/AuthDingTalkRequest.java @@ -40,13 +40,12 @@ public class AuthDingTalkRequest extends BaseAuthRequest { String urlEncodeSignature = GlobalAuthUtil.generateDingTalkSignature(config.getClientSecret(), timestamp); JSONObject param = new JSONObject(); param.put("tmp_auth_code", code); - HttpResponse response = HttpRequest.post(UrlBuilder.getDingTalkUserInfoUrl(urlEncodeSignature, timestamp, config.getClientId())) - .body(param.toJSONString()) - .execute(); + HttpResponse response = HttpRequest.post(UrlBuilder.getDingTalkUserInfoUrl(urlEncodeSignature, timestamp, config + .getClientId())).body(param.toJSONString()).execute(); String userInfo = response.body(); JSONObject object = JSON.parseObject(userInfo); AuthDingTalkErrorCode errorCode = AuthDingTalkErrorCode.getErrorCode(object.getIntValue("errcode")); - if (!AuthDingTalkErrorCode.EC0.equals(errorCode)) { + if (AuthDingTalkErrorCode.EC0 != errorCode) { throw new AuthException(errorCode.getDesc()); } object = object.getJSONObject("user_info");