diff options
Diffstat (limited to 'cps-service/src/main')
-rw-r--r-- | cps-service/src/main/java/org/onap/cps/utils/CpsValidator.java | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/cps-service/src/main/java/org/onap/cps/utils/CpsValidator.java b/cps-service/src/main/java/org/onap/cps/utils/CpsValidator.java index 28b49c9666..f3774d9529 100644 --- a/cps-service/src/main/java/org/onap/cps/utils/CpsValidator.java +++ b/cps-service/src/main/java/org/onap/cps/utils/CpsValidator.java @@ -22,7 +22,6 @@ package org.onap.cps.utils; import com.google.common.collect.Lists; import java.util.Collection; -import java.util.regex.Pattern; import lombok.AccessLevel; import lombok.NoArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -33,30 +32,25 @@ import org.onap.cps.spi.exceptions.DataValidationException; public final class CpsValidator { private static final char[] UNSUPPORTED_NAME_CHARACTERS = "!\" #$%&'()*+,./\\:;<=>?@[]^`{|}~".toCharArray(); - private static final Pattern TOPIC_NAME_PATTERN = Pattern.compile("^[a-zA-Z0-9]([._-](?![._-])|" - + "[a-zA-Z0-9]){0,120}[a-zA-Z0-9]$"); /** * Validate characters in names within cps. + * * @param names names of data to be validated */ public static void validateNameCharacters(final String... names) { for (final String name : names) { - final Collection<Character> charactersOfName = Lists.charactersOf(name); + final Collection<Character> charactersOfName = Lists.charactersOf(name); for (final char unsupportedCharacter : UNSUPPORTED_NAME_CHARACTERS) { if (charactersOfName.contains(unsupportedCharacter)) { throw new DataValidationException("Name or ID Validation Error.", - name + " invalid token encountered at position " + (name.indexOf(unsupportedCharacter) + 1)); + name + " invalid token encountered at position " + + (name.indexOf(unsupportedCharacter) + 1)); } } } } - /** - * Validate kafka topic name pattern. - * @param topicName name of the topic to be validated - */ - public static boolean validateTopicName(final String topicName) { - return topicName != null && TOPIC_NAME_PATTERN.matcher(topicName).matches(); - } + + } |