Przeglądaj źródła

update 优化 删除无用异常类

疯狂的狮子Li 2 lat temu
rodzic
commit
1944cca859

+ 1 - 1
ruoyi-auth/src/main/java/org/dromara/auth/service/SysLoginService.java

@@ -19,7 +19,7 @@ import org.dromara.common.core.constant.TenantConstants;
 import org.dromara.common.core.enums.LoginType;
 import org.dromara.common.core.enums.TenantStatus;
 import org.dromara.common.core.enums.UserType;
-import org.dromara.common.core.exception.CaptchaException;
+import org.dromara.common.core.exception.user.CaptchaException;
 import org.dromara.common.core.exception.user.CaptchaExpireException;
 import org.dromara.common.core.exception.user.UserException;
 import org.dromara.common.core.utils.MessageUtils;

+ 1 - 1
ruoyi-auth/src/main/java/org/dromara/auth/service/impl/PasswordAuthStrategy.java

@@ -14,7 +14,7 @@ import org.dromara.auth.service.SysLoginService;
 import org.dromara.common.core.constant.Constants;
 import org.dromara.common.core.constant.GlobalConstants;
 import org.dromara.common.core.enums.LoginType;
-import org.dromara.common.core.exception.CaptchaException;
+import org.dromara.common.core.exception.user.CaptchaException;
 import org.dromara.common.core.exception.user.CaptchaExpireException;
 import org.dromara.common.core.utils.MessageUtils;
 import org.dromara.common.core.utils.StringUtils;

+ 0 - 29
ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/exception/CheckedException.java

@@ -1,29 +0,0 @@
-package org.dromara.common.core.exception;
-
-import java.io.Serial;
-
-/**
- * 检查异常
- *
- * @author ruoyi
- */
-public class CheckedException extends RuntimeException {
-    @Serial
-    private static final long serialVersionUID = 1L;
-
-    public CheckedException(String message) {
-        super(message);
-    }
-
-    public CheckedException(Throwable cause) {
-        super(cause);
-    }
-
-    public CheckedException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-    public CheckedException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
-        super(message, cause, enableSuppression, writableStackTrace);
-    }
-}

+ 0 - 17
ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/exception/DemoModeException.java

@@ -1,17 +0,0 @@
-package org.dromara.common.core.exception;
-
-import java.io.Serial;
-
-/**
- * 演示模式异常
- *
- * @author ruoyi
- */
-public class DemoModeException extends RuntimeException {
-
-    @Serial
-    private static final long serialVersionUID = 1L;
-
-    public DemoModeException() {
-    }
-}

+ 0 - 56
ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/exception/GlobalException.java

@@ -1,56 +0,0 @@
-package org.dromara.common.core.exception;
-
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.NoArgsConstructor;
-
-import java.io.Serial;
-
-/**
- * 全局异常
- *
- * @author ruoyi
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-@NoArgsConstructor
-@AllArgsConstructor
-public class GlobalException extends RuntimeException {
-
-    @Serial
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 错误提示
-     */
-    private String message;
-
-    /**
-     * 错误明细,内部调试错误
-     */
-    private String detailMessage;
-
-    public GlobalException(String message) {
-        this.message = message;
-    }
-
-    public String getDetailMessage() {
-        return detailMessage;
-    }
-
-    public GlobalException setDetailMessage(String detailMessage) {
-        this.detailMessage = detailMessage;
-        return this;
-    }
-
-    @Override
-    public String getMessage() {
-        return message;
-    }
-
-    public GlobalException setMessage(String message) {
-        this.message = message;
-        return this;
-    }
-}

+ 0 - 26
ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/exception/UtilException.java

@@ -1,26 +0,0 @@
-package org.dromara.common.core.exception;
-
-import java.io.Serial;
-
-/**
- * 工具类异常
- *
- * @author ruoyi
- */
-public class UtilException extends RuntimeException {
-
-    @Serial
-    private static final long serialVersionUID = 8247610319171014183L;
-
-    public UtilException(Throwable e) {
-        super(e.getMessage(), e);
-    }
-
-    public UtilException(String message) {
-        super(message);
-    }
-
-    public UtilException(String message, Throwable throwable) {
-        super(message, throwable);
-    }
-}

+ 1 - 3
ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/exception/CaptchaException.java → ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/exception/user/CaptchaException.java

@@ -1,6 +1,4 @@
-package org.dromara.common.core.exception;
-
-import org.dromara.common.core.exception.user.UserException;
+package org.dromara.common.core.exception.user;
 
 import java.io.Serial;
 

+ 0 - 18
ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/exception/user/UserPasswordNotMatchException.java

@@ -1,18 +0,0 @@
-package org.dromara.common.core.exception.user;
-
-import java.io.Serial;
-
-/**
- * 用户密码不正确或不符合规范异常类
- *
- * @author ruoyi
- */
-public class UserPasswordNotMatchException extends UserException {
-
-    @Serial
-    private static final long serialVersionUID = 1L;
-
-    public UserPasswordNotMatchException() {
-        super("user.password.not.match");
-    }
-}

+ 3 - 4
ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/utils/sql/SqlUtil.java

@@ -1,9 +1,8 @@
 package org.dromara.common.core.utils.sql;
 
-import org.dromara.common.core.exception.UtilException;
-import org.dromara.common.core.utils.StringUtils;
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
+import org.dromara.common.core.utils.StringUtils;
 
 /**
  * sql操作工具类
@@ -28,7 +27,7 @@ public class SqlUtil {
      */
     public static String escapeOrderBySql(String value) {
         if (StringUtils.isNotEmpty(value) && !isValidOrderBySql(value)) {
-            throw new UtilException("参数不符合规范,不能进行查询");
+            throw new IllegalArgumentException("参数不符合规范,不能进行查询");
         }
         return value;
     }
@@ -50,7 +49,7 @@ public class SqlUtil {
         String[] sqlKeywords = StringUtils.split(SQL_REGEX, "\\|");
         for (String sqlKeyword : sqlKeywords) {
             if (StringUtils.indexOfIgnoreCase(value, sqlKeyword) > -1) {
-                throw new UtilException("参数存在SQL注入风险");
+                throw new IllegalArgumentException("参数存在SQL注入风险");
             }
         }
     }