Browse Source

update token add exist check (#1598)

* misspell  words

* modify common queue TaskQueueZKImplTest.java unit test

* extends  BaseTaskQueueTest get zkServer

* modify zk config

* updateToken add entity exist check
pull/2/head
samz406 5 years ago committed by qiaozhanwei
parent
commit
7826843620
  1. 9
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/AccessTokenService.java

9
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/AccessTokenService.java

@ -154,8 +154,13 @@ public class AccessTokenService extends BaseService {
*/ */
public Map<String, Object> updateToken(int id,int userId, String expireTime, String token) { public Map<String, Object> updateToken(int id,int userId, String expireTime, String token) {
Map<String, Object> result = new HashMap<>(5); Map<String, Object> result = new HashMap<>(5);
AccessToken accessToken = new AccessToken();
accessToken.setId(id); AccessToken accessToken = accessTokenMapper.selectById(id);
if (accessToken == null) {
logger.error("access token not exist, access token id {}", id);
putMsg(result, Status.ACCESS_TOKEN_NOT_EXIST);
return result;
}
accessToken.setUserId(userId); accessToken.setUserId(userId);
accessToken.setExpireTime(DateUtils.stringToDate(expireTime)); accessToken.setExpireTime(DateUtils.stringToDate(expireTime));
accessToken.setToken(token); accessToken.setToken(token);

Loading…
Cancel
Save