fix 修复 可能导致异常类无法反序列化问题

This commit is contained in:
疯狂的狮子Li 2023-07-17 16:59:33 +08:00
parent 1c081a5892
commit 9a53ed796b
3 changed files with 20 additions and 19 deletions

View File

@ -1,5 +1,10 @@
package org.dromara.common.core.exception; package org.dromara.common.core.exception;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.io.Serial; import java.io.Serial;
/** /**
@ -7,6 +12,10 @@ import java.io.Serial;
* *
* @author ruoyi * @author ruoyi
*/ */
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class GlobalException extends RuntimeException { public class GlobalException extends RuntimeException {
@Serial @Serial
@ -22,12 +31,6 @@ public class GlobalException extends RuntimeException {
*/ */
private String detailMessage; private String detailMessage;
/**
* 空构造方法避免反序列化问题
*/
public GlobalException() {
}
public GlobalException(String message) { public GlobalException(String message) {
this.message = message; this.message = message;
} }

View File

@ -1,5 +1,10 @@
package org.dromara.common.core.exception; package org.dromara.common.core.exception;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.io.Serial; import java.io.Serial;
/** /**
@ -7,6 +12,10 @@ import java.io.Serial;
* *
* @author ruoyi * @author ruoyi
*/ */
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public final class ServiceException extends RuntimeException { public final class ServiceException extends RuntimeException {
@Serial @Serial
@ -27,12 +36,6 @@ public final class ServiceException extends RuntimeException {
*/ */
private String detailMessage; private String detailMessage;
/**
* 空构造方法避免反序列化问题
*/
public ServiceException() {
}
public ServiceException(String message) { public ServiceException(String message) {
this.message = message; this.message = message;
} }

View File

@ -1,5 +1,6 @@
package org.dromara.common.core.exception.base; package org.dromara.common.core.exception.base;
import lombok.AllArgsConstructor;
import org.dromara.common.core.utils.MessageUtils; import org.dromara.common.core.utils.MessageUtils;
import org.dromara.common.core.utils.StringUtils; import org.dromara.common.core.utils.StringUtils;
import lombok.Data; import lombok.Data;
@ -16,6 +17,7 @@ import java.io.Serial;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor
public class BaseException extends RuntimeException { public class BaseException extends RuntimeException {
@Serial @Serial
@ -41,13 +43,6 @@ public class BaseException extends RuntimeException {
*/ */
private String defaultMessage; private String defaultMessage;
public BaseException(String module, String code, Object[] args, String defaultMessage) {
this.module = module;
this.code = code;
this.args = args;
this.defaultMessage = defaultMessage;
}
public BaseException(String module, String code, Object[] args) { public BaseException(String module, String code, Object[] args) {
this(module, code, args, null); this(module, code, args, null);
} }