REQ-3045: 减少响应大小
This commit is contained in:
parent
94956c4dd3
commit
0ae1b6f609
@ -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<Integer, ModelVersion> 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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user