diff options
author | jhh <jorge.hernandez-herrero@att.com> | 2021-06-14 17:20:51 -0500 |
---|---|---|
committer | jhh <jorge.hernandez-herrero@att.com> | 2021-06-14 17:20:51 -0500 |
commit | 0945bc95ad1eb147c1ddf3d2069ad9a531838649 (patch) | |
tree | be94e922aea3e58d97a5251597428c0a995bd04a /policy-management/src/main/java/org/onap/policy/drools/controller/IndexedDroolsControllerFactory.java | |
parent | ed08c7f8d6d124cc3a6a42a5b630d549a5b34968 (diff) |
Use re2j pattern for sonar vulnerabilities
Issue-ID: POLICY-3289
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Change-Id: Id6d58b5c8ac5f7715286f21274ccf5eea9155fd2
Diffstat (limited to 'policy-management/src/main/java/org/onap/policy/drools/controller/IndexedDroolsControllerFactory.java')
-rw-r--r-- | policy-management/src/main/java/org/onap/policy/drools/controller/IndexedDroolsControllerFactory.java | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/policy-management/src/main/java/org/onap/policy/drools/controller/IndexedDroolsControllerFactory.java b/policy-management/src/main/java/org/onap/policy/drools/controller/IndexedDroolsControllerFactory.java index d2196680..810cb65b 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/controller/IndexedDroolsControllerFactory.java +++ b/policy-management/src/main/java/org/onap/policy/drools/controller/IndexedDroolsControllerFactory.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,12 +20,13 @@ package org.onap.policy.drools.controller; +import com.google.re2j.Pattern; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; +import lombok.NonNull; import org.onap.policy.common.endpoints.event.comm.Topic; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.event.comm.TopicSink; @@ -49,10 +50,8 @@ import org.slf4j.LoggerFactory; */ class IndexedDroolsControllerFactory implements DroolsControllerFactory { - /** - * logger. - */ private static final Logger logger = LoggerFactory.getLogger(IndexedDroolsControllerFactory.class); + private static final Pattern COMMA_SPACE_PAT = Pattern.compile("\\s*,\\s*"); /** * Policy Controller Name Index. @@ -299,13 +298,10 @@ class IndexedDroolsControllerFactory implements DroolsControllerFactory { } private List<PotentialCoderFilter> getFilterExpressions(Properties properties, String propertyPrefix, - String eventClasses) { + @NonNull String eventClasses) { List<PotentialCoderFilter> classes2Filters = new ArrayList<>(); - - List<String> topicClasses = new ArrayList<>(Arrays.asList(eventClasses.split("\\s*,\\s*"))); - - for (String theClass : topicClasses) { + for (String theClass : COMMA_SPACE_PAT.split(eventClasses)) { // 4. for each coder class, get the filter expression |