baihe 2 vuotta sitten
vanhempi
commit
ec94a00fbe

+ 1 - 1
component-common/src/main/java/com/gihon/component/properties/GihonCommonProperties.java

@@ -18,7 +18,7 @@ public class GihonCommonProperties {
 	
 	private long refreshTokenExpired = 1000*60*60*72L;//72小时
 	
-	private long exipredMore = 1000*60;
+	private long exipredMore = 1000*60L;
 	
 	private boolean mutiLogin = false;//互踢或者共存
 

+ 1 - 1
component-common/src/main/java/com/gihon/component/util/SpringContextUtils.java

@@ -9,7 +9,7 @@ import org.springframework.context.ApplicationContextAware;
  * 
  */
 public class SpringContextUtils implements ApplicationContextAware {
-	public static ApplicationContext applicationContext; 
+	private  static ApplicationContext applicationContext; 
 
 	@Override
 	public void setApplicationContext(ApplicationContext applicationContext)

+ 3 - 9
component-common/src/main/java/com/gihon/component/web/auth/AuthUtils.java

@@ -31,24 +31,21 @@ public class AuthUtils {
 
     public static ServletRequestAttributes getRequestAttributes() {
         RequestAttributes r = RequestContextHolder.currentRequestAttributes();
-        return (ServletRequestAttributes) r;
+    	return (ServletRequestAttributes) r;
     }
 
     public static HttpServletRequest getRequest() {
         ServletRequestAttributes r = getRequestAttributes();
-        return r == null ? null : r.getRequest();
+        return r.getRequest();
     }
 
     public static HttpServletResponse getResponse() {
         ServletRequestAttributes r = getRequestAttributes();
-        return r == null ? null : r.getResponse();
+        return r.getResponse();
     }
 
     public static String getToken() {
         HttpServletRequest request = getRequest();
-        if (request == null) {
-            return null;
-        }
         return (String) request.getAttribute(AuthUtils.REQ_TOKEN);
     }
     public static Long getUserId() {
@@ -61,9 +58,6 @@ public class AuthUtils {
 
     public static AuthUser getUser() {
         HttpServletRequest request = getRequest();
-        if (request == null) {
-            return null;
-        }
         AuthUser user = null;
         Object o = request.getAttribute(REQ_USER);
         if (o != null) {

+ 0 - 8
component-entity/src/main/java/com/gihon/component/response/ResponseStatus.java

@@ -30,16 +30,8 @@ public enum ResponseStatus {
         return desc;
     }
 
-    public void setDesc(String desc) {
-        this.desc = desc;
-    }
-
     public int getCode() {
         return code;
     }
 
-    public void setCode(int code) {
-        this.code = code;
-    }
-
 }

+ 1 - 1
component-springboot/src/main/java/com/gihon/component/config/swagger/DemoKnife4jConfig.java

@@ -72,7 +72,7 @@ public class DemoKnife4jConfig implements ApplicationListener<WebServerInitializ
             InetAddress inetAddress = Inet4Address.getLocalHost();
             logger.info("项目启动成功!接口文档地址: http://" + inetAddress.getHostAddress() + ":" + event.getWebServer().getPort() + event.getApplicationContext().getEnvironment().getProperty("server.servlet.context-path") + "/doc.html");
         } catch (Exception e) {
-            e.printStackTrace();
+        	logger.error("Knife4J error,",e);
         }
     }
 }

+ 2 - 1
component-websecurity/src/main/java/com/gihon/component/web/config/HttpErrorController.java

@@ -7,6 +7,7 @@ import javax.servlet.http.HttpServletResponse;
 import org.springframework.boot.web.servlet.error.ErrorController;
 import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import com.gihon.component.response.Response;
@@ -28,7 +29,7 @@ public class HttpErrorController implements ErrorController {
 
     private final static String ERROR_PATH = "/error";
 
-    @RequestMapping(path = ERROR_PATH)
+    @RequestMapping(path = ERROR_PATH,method = {RequestMethod.GET})
     @org.springframework.web.bind.annotation.ResponseStatus(HttpStatus.OK)
     public Response<?> error(HttpServletRequest request, HttpServletResponse response) {
         log.error("error 错误代码:{},{}", response.getStatus(),request.getRequestURI());

+ 1 - 1
component-websecurity/src/main/java/com/gihon/component/web/security/GihonInvocationSecurityMetadataSource.java

@@ -44,7 +44,7 @@ public class GihonInvocationSecurityMetadataSource implements InitializingBean,
             }
             // 查询每个资源所对应的所有角色 按照url排序
             LinkedList<String[]> resourcesRoleRelationList = securityService.getAllResourceAndRoles();
-            Collection<ConfigAttribute> array = null;
+            Collection<ConfigAttribute> array = new ArrayList<ConfigAttribute>();
             RequestMatcher matcher = null;
             SecurityConfig securityConfig = null;
             String tempUrl = "";

+ 1 - 1
component-websecurity/src/main/java/com/gihon/component/web/service/TokenService.java

@@ -27,7 +27,7 @@ public interface TokenService {
 
     final static long REFRESH_TOKEN_EXPIRED = 1000 * 60 * 60 * 72L;// 72小时
 
-    final static long EXIPRED_MORE = 1000 * 60;
+    final static long EXIPRED_MORE = 1000 * 60L;
 
     String getUserName(String securityToken);
 

+ 2 - 5
component-websecurity/src/main/java/com/gihon/component/web/xss/XssFilter.java

@@ -34,10 +34,8 @@ public class XssFilter implements Filter {
 	 */
 	private  boolean isIncludeRichText = false;
 	
-	public List<String> excludes = new ArrayList<>();
+	private List<String> excludes = new ArrayList<>();
 	
-	FilterConfig filterConfig = null;
-  
     @Override
 	public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException,ServletException {
     	if(logger.isDebugEnabled()){
@@ -90,10 +88,9 @@ public class XssFilter implements Filter {
 				excludes.add(url[i]);
 			}
 		}
-		this.filterConfig = filterConfig;
 	}
 
 	@Override
-	public void destroy() {this.filterConfig = null;}  
+	public void destroy() {}  
   
 }  

+ 2 - 0
pom.xml

@@ -39,6 +39,8 @@
         <shiro.version>1.4.0</shiro.version>
 		<jsoup.version>1.9.2</jsoup.version>
         <knife4j.version>3.0.2</knife4j.version>
+        <sonar.projectName>gihon-component</sonar.projectName>
+     <!-- 只能是mvn sonar:sonar -Dsonar.projectKey=gihon-component 这个标识是唯一的,会自动使用maven的坐标-->
 	</properties>
 
 	<dependencyManagement>