Format code (#873)

* Simplified DynamicThreadPool usage

* Simplified DynamicThreadPool usage

* init

* format code
pull/876/head
weihubeats 2 years ago committed by GitHub
parent 9165200fe2
commit eb3e6e7293
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,6 +17,16 @@
package cn.hippo4j.auth.filter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.FilterChain;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.hippo4j.auth.model.biz.user.JwtUser;
import cn.hippo4j.auth.model.biz.user.LoginUser;
import cn.hippo4j.auth.toolkit.JwtTokenUtil;
@ -25,6 +35,7 @@ import cn.hippo4j.common.toolkit.JSONUtil;
import cn.hippo4j.common.web.base.Results;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@ -33,15 +44,6 @@ import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import javax.servlet.FilterChain;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import static cn.hippo4j.auth.constant.Constants.SPLIT_COMMA;
import static cn.hippo4j.common.constant.Constants.BASE_PATH;
import static cn.hippo4j.common.constant.Constants.MAP_INITIAL_CAPACITY;
@ -75,10 +77,9 @@ public class JWTAuthenticationFilter extends UsernamePasswordAuthenticationFilte
} catch (BadCredentialsException e) {
log.warn("BadCredentialsException:{}", e.getMessage());
} catch (Exception e) {
log.error("attemptauthentication error:", e);
} finally {
return authenticate;
log.error("attemptAuthentication error:", e);
}
return authenticate;
}
@Override

@ -17,6 +17,12 @@
package cn.hippo4j.config.controller;
import java.net.URLDecoder;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.hippo4j.common.constant.ConfigModifyTypeConstants;
import cn.hippo4j.common.constant.Constants;
import cn.hippo4j.common.model.register.DynamicThreadPoolRegisterWrapper;
@ -35,13 +41,14 @@ import cn.hippo4j.config.toolkit.Md5ConfigUtil;
import cn.hippo4j.config.verify.ConfigModificationVerifyServiceChoose;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.net.URLDecoder;
import java.util.Map;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* Server configuration controller.
@ -76,7 +83,7 @@ public class ConfigController {
modifySaveReqDTO.setCorePoolSize(config.getCoreSize());
modifySaveReqDTO.setMaximumPoolSize(config.getMaxSize());
modifySaveReqDTO.setModifyUser(UserContext.getUserName());
modifySaveReqDTO.setModifyAll(StringUtil.isEmpty(identify) ? true : false);
modifySaveReqDTO.setModifyAll(StringUtil.isEmpty(identify));
modifySaveReqDTO.setIdentify(identify);
modifySaveReqDTO.setType(ConfigModifyTypeConstants.THREAD_POOL_INSTANCE);
configModificationVerifyServiceChoose.choose(modifySaveReqDTO.getType()).saveConfigModifyApplication(modifySaveReqDTO);

Loading…
Cancel
Save