Skip to content

Commit

Permalink
do not use ClientMetricsConfigs in validate
Browse files Browse the repository at this point in the history
  • Loading branch information
TaiJuWu committed Sep 26, 2024
1 parent 1dd26e0 commit 8f39965
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ public static void validate(String subscriptionName, Properties properties) {
validateProperties(properties);
}

@SuppressWarnings("unchecked")
private static void validateProperties(Properties properties) {
// Make sure that all the properties are valid
properties.forEach((key, value) -> {
Expand All @@ -131,12 +132,10 @@ private static void validateProperties(Properties properties) {
}
});

ClientMetricsConfigs configs = new ClientMetricsConfigs(properties);

// Make sure that push interval is between 100ms and 1 hour.
if (properties.containsKey(PUSH_INTERVAL_MS)) {
int pushIntervalMs = configs.getInt(PUSH_INTERVAL_MS);
if (pushIntervalMs < MIN_INTERVAL_MS || pushIntervalMs > MAX_INTERVAL_MS) {
Integer pushIntervalMs = (Integer) ConfigDef.parseType(PUSH_INTERVAL_MS, properties.getProperty(PUSH_INTERVAL_MS), Type.INT);
if (pushIntervalMs == null || pushIntervalMs < MIN_INTERVAL_MS || pushIntervalMs > MAX_INTERVAL_MS) {
String msg = String.format("Invalid value %s for %s, interval must be between 100 and 3600000 (1 hour)",
pushIntervalMs, PUSH_INTERVAL_MS);
throw new InvalidRequestException(msg);
Expand All @@ -145,7 +144,7 @@ private static void validateProperties(Properties properties) {

// Make sure that client match patterns are valid by parsing them.
if (properties.containsKey(CLIENT_MATCH_PATTERN)) {
List<String> patterns = configs.getList(CLIENT_MATCH_PATTERN);
List<String> patterns = (List<String>) ConfigDef.parseType(CLIENT_MATCH_PATTERN, properties.getProperty(CLIENT_MATCH_PATTERN), Type.LIST);
// Parse the client matching patterns to validate if the patterns are valid.
parseMatchingPatterns(patterns);
}
Expand Down

0 comments on commit 8f39965

Please sign in to comment.