From e666de6335e32f64f1999855d4ac8038e8873ec5 Mon Sep 17 00:00:00 2001 From: JvD_Ericsson Date: Tue, 21 Jul 2020 12:33:11 +0100 Subject: Fix replaceAll SONAR issues in apex-pdp Change replaceAll() with repalce() in apex-pdp/plugins and apex-pdp/testsuites Issue-ID: POLICY-2722 Signed-off-by: JvD_Ericsson Change-Id: Ib9d5256c050197b06f9df9c4cbb7562be081283c --- .../context/schema/avro/AvroSchemaKeyTranslationUtilities.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaKeyTranslationUtilities.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaKeyTranslationUtilities.java index bc695373b..965457206 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaKeyTranslationUtilities.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaKeyTranslationUtilities.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +34,7 @@ import java.util.Map.Entry; */ public final class AvroSchemaKeyTranslationUtilities { // Constants for key replacements - private static final String DOT_STRING = "\\."; + private static final String DOT_STRING = "."; private static final String DOT_STRING_REPLACEMENT = "_DoT_"; private static final String DASH_STRING = "-"; private static final String DASH_STRING_REPLACEMENT = "_DasH_"; @@ -133,9 +134,9 @@ public final class AvroSchemaKeyTranslationUtilities { */ private static String translateIllegalKey(final String key, final boolean revert) { if (revert) { - return key.replaceAll(DOT_STRING_REPLACEMENT, DOT_STRING).replaceAll(DASH_STRING_REPLACEMENT, DASH_STRING); + return key.replace(DOT_STRING_REPLACEMENT, DOT_STRING).replace(DASH_STRING_REPLACEMENT, DASH_STRING); } else { - return key.replaceAll(DOT_STRING, DOT_STRING_REPLACEMENT).replaceAll(DASH_STRING, DASH_STRING_REPLACEMENT); + return key.replace(DOT_STRING, DOT_STRING_REPLACEMENT).replace(DASH_STRING, DASH_STRING_REPLACEMENT); } } } -- cgit 1.2.3-korg