Skip to content

Commit

Permalink
fix: correct the length check of cluster label
Browse files Browse the repository at this point in the history
  • Loading branch information
lenoxzhao committed Aug 16, 2023
1 parent a94c876 commit bdf1929
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

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 {

Expand Down Expand Up @@ -86,9 +86,9 @@ public boolean equals(Object other) {
@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());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bdf1929

Please sign in to comment.