From 0ae1b6f609d9920a4b37501a40d7e2c210b80fc0 Mon Sep 17 00:00:00 2001 From: yanglin Date: Thu, 24 Oct 2024 11:05:43 +0800 Subject: [PATCH] =?UTF-8?q?REQ-3045:=20=E5=87=8F=E5=B0=91=E5=93=8D?= =?UTF-8?q?=E5=BA=94=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/axzo/msg/center/service/pending/ModelVersion.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/msg-center-api/src/main/java/cn/axzo/msg/center/service/pending/ModelVersion.java b/msg-center-api/src/main/java/cn/axzo/msg/center/service/pending/ModelVersion.java index d5292a9a..f72ebf0e 100644 --- a/msg-center-api/src/main/java/cn/axzo/msg/center/service/pending/ModelVersion.java +++ b/msg-center-api/src/main/java/cn/axzo/msg/center/service/pending/ModelVersion.java @@ -1,7 +1,6 @@ package cn.axzo.msg.center.service.pending; import cn.axzo.framework.domain.ServiceException; -import com.microsoft.schemas.office.x2006.encryption.STSaltSize; import lombok.AccessLevel; import lombok.Getter; import lombok.RequiredArgsConstructor; @@ -19,6 +18,7 @@ public class ModelVersion { private static final Map VERSIONS = new ConcurrentHashMap<>(); private static final Integer MAX_VERSION_NUMBER = 500; + private static final Integer MIN_VERSION_NUMBER = -1; public static final ModelVersion V2 = of(null); public static final ModelVersion V3 = of(3); @@ -28,9 +28,7 @@ public class ModelVersion { public static ModelVersion of(Integer version) { // attack? - if (version != null - && version > MAX_VERSION_NUMBER - && version < Integer.MAX_VALUE) + if (version != null && (version > MAX_VERSION_NUMBER || version < MIN_VERSION_NUMBER)) throw new ServiceException("model version is too large"); if (version == null) version = Integer.MIN_VALUE; return VERSIONS.computeIfAbsent(version, ModelVersion::new);