From 7a1449b3f8a3aa93e25bede1531ebd08c64a64af Mon Sep 17 00:00:00 2001 From: Piumal1999 Date: Wed, 25 Sep 2024 12:20:35 +0530 Subject: [PATCH] Support arrays without square brackets --- .../publishers/impl/AnalyticsDataPublisher.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/components/apimgt/org.wso2.carbon.apimgt.common.analytics/src/main/java/org/wso2/carbon/apimgt/common/analytics/publishers/impl/AnalyticsDataPublisher.java b/components/apimgt/org.wso2.carbon.apimgt.common.analytics/src/main/java/org/wso2/carbon/apimgt/common/analytics/publishers/impl/AnalyticsDataPublisher.java index 08cc952ad984..7257fa58c939 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.common.analytics/src/main/java/org/wso2/carbon/apimgt/common/analytics/publishers/impl/AnalyticsDataPublisher.java +++ b/components/apimgt/org.wso2.carbon.apimgt.common.analytics/src/main/java/org/wso2/carbon/apimgt/common/analytics/publishers/impl/AnalyticsDataPublisher.java @@ -30,7 +30,6 @@ import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -61,14 +60,10 @@ private List getReporterTypesOrNull(String typeConfig) { if (typeConfig == null || typeConfig.isEmpty()) { return null; } - if (typeConfig.startsWith("[") && typeConfig.endsWith("]")) { - return Arrays.stream(typeConfig.substring(1, typeConfig.length() - 1).split(",")) - .map(String::trim) - .filter(s -> !s.isEmpty()) - .collect(Collectors.toList()); - } else { - return Collections.singletonList(typeConfig); - } + return Arrays.stream(typeConfig.replaceAll("[\\[\\]]", "").split(",")) + .map(String::trim) + .filter(s -> !s.isEmpty()) + .collect(Collectors.toList()); } private List getReportersClassesOrNull(Map configs) {