This is an automated email from the ASF dual-hosted git repository.
peacewong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/linkis.git
The following commit(s) were added to refs/heads/master by this push:
new faa8d1531 fix: correct the length check of cluster label (#4865)
faa8d1531 is described below
commit faa8d15315a802553c6a261770e3cd7fa8d23640
Author: zlucelia <[email protected]>
AuthorDate: Thu Aug 17 11:14:08 2023 +0800
fix: correct the length check of cluster label (#4865)
---
.../apache/linkis/manager/label/entity/cluster/ClusterLabel.java | 6 +++---
.../linkis/manager/label/errorcode/LabelCommonErrorCodeSummary.java | 4 +++-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git
a/linkis-computation-governance/linkis-manager/linkis-label-common/src/main/java/org/apache/linkis/manager/label/entity/cluster/ClusterLabel.java
b/linkis-computation-governance/linkis-manager/linkis-label-common/src/main/java/org/apache/linkis/manager/label/entity/cluster/ClusterLabel.java
index fa7708d7f..05754c653 100644
---
a/linkis-computation-governance/linkis-manager/linkis-label-common/src/main/java/org/apache/linkis/manager/label/entity/cluster/ClusterLabel.java
+++
b/linkis-computation-governance/linkis-manager/linkis-label-common/src/main/java/org/apache/linkis/manager/label/entity/cluster/ClusterLabel.java
@@ -26,7 +26,7 @@ import org.apache.commons.lang3.StringUtils;
import java.util.HashMap;
-import static
org.apache.linkis.manager.label.errorcode.LabelCommonErrorCodeSummary.LABEL_ERROR_CODE;
+import static
org.apache.linkis.manager.label.errorcode.LabelCommonErrorCodeSummary.CLUSTER_LABEL_VALUE_ERROR;
public class ClusterLabel extends GenericLabel implements EngineNodeLabel,
UserModifiable {
@@ -86,9 +86,9 @@ public class ClusterLabel extends GenericLabel implements
EngineNodeLabel, UserM
@Override
public void valueCheck(String stringValue) throws LabelErrorException {
if (!StringUtils.isEmpty(stringValue)) {
- if (stringValue.split(SerializableLabel.VALUE_SEPARATOR).length != 1) {
+ if (stringValue.split(SerializableLabel.VALUE_SEPARATOR).length != 2) {
throw new LabelErrorException(
- LABEL_ERROR_CODE.getErrorCode(), LABEL_ERROR_CODE.getErrorDesc());
+ CLUSTER_LABEL_VALUE_ERROR.getErrorCode(),
CLUSTER_LABEL_VALUE_ERROR.getErrorDesc());
}
}
}
diff --git
a/linkis-computation-governance/linkis-manager/linkis-label-common/src/main/java/org/apache/linkis/manager/label/errorcode/LabelCommonErrorCodeSummary.java
b/linkis-computation-governance/linkis-manager/linkis-label-common/src/main/java/org/apache/linkis/manager/label/errorcode/LabelCommonErrorCodeSummary.java
index a0ebdffe8..322eb5af8 100644
---
a/linkis-computation-governance/linkis-manager/linkis-label-common/src/main/java/org/apache/linkis/manager/label/errorcode/LabelCommonErrorCodeSummary.java
+++
b/linkis-computation-governance/linkis-manager/linkis-label-common/src/main/java/org/apache/linkis/manager/label/errorcode/LabelCommonErrorCodeSummary.java
@@ -31,7 +31,9 @@ public enum LabelCommonErrorCodeSummary implements
LinkisErrorCode {
CHECK_LABEL_REMOVE_REQUEST(
25007,
"ServiceInstance in request is null, please check label remove
request(请求中的 ServiceInstance 为空,请检查标签删除请求)"),
- CHECK_LABEL_VALUE_EMPTY(25008, "Label value cannot be empty");
+ CHECK_LABEL_VALUE_EMPTY(25008, "Label value cannot be empty"),
+ CLUSTER_LABEL_VALUE_ERROR(
+ 25009, "The value of cluster label should have a length of 2 and be
separated by '-' ");
/** (errorCode)错误码 */
private final int errorCode;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]