From b869df842873550f246c51126d7e7c7b5c0a2e6f Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Mon, 17 Jun 2024 13:02:16 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=BF=BD=E7=95=A5EofException?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/handler/RestControllerExceptionHandler.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/handler/RestControllerExceptionHandler.java b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/handler/RestControllerExceptionHandler.java index 1affe5ca15..7ba14087e9 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/handler/RestControllerExceptionHandler.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/handler/RestControllerExceptionHandler.java @@ -10,6 +10,7 @@ import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.authz.UnauthorizedException; import org.apache.shiro.lang.ShiroException; +import org.eclipse.jetty.io.EofException; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.validation.FieldError; @@ -114,6 +115,11 @@ public class RestControllerExceptionHandler { @ExceptionHandler({Exception.class}) public ResponseEntity handlerException(Exception e) { + if (e instanceof EofException) { + return ResponseEntity.internalServerError() + .body(ResultHolder.error(MsHttpResultCode.FAILED.getCode(), + e.getMessage(), null)); + } return ResponseEntity.internalServerError() .body(ResultHolder.error(MsHttpResultCode.FAILED.getCode(), e.getMessage(), getStackTraceAsString(e)));