From c27465347d10b573e7a211c0b11b7c8a6fd792c0 Mon Sep 17 00:00:00 2001 From: lukegleeson Date: Thu, 2 Sep 2021 15:11:34 +0100 Subject: Fix Sonar Qube Violations Issue-ID: CPS-475 Signed-off-by: lukegleeson Change-Id: Iffd7b24cf42db73a8b93c4d1f2860e41a82e565d --- .../java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cps-ri') diff --git a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java index 7b3b726284..c57723d322 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java @@ -91,7 +91,7 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService private static final Gson GSON = new GsonBuilder().create(); private static final String REG_EX_FOR_OPTIONAL_LIST_INDEX = "(\\[@[\\s\\S]+?]){0,1})"; - private static final String REG_EX_FOR_LIST_NODE_KEY = "\\[(\\@([^/]*?))+( and)*\\]$"; + private static final String REG_EX_FOR_LIST_NODE_KEY = "\\[(\\@([^/]*?)){0,99}( and)*\\]$"; @Override public void addChildDataNode(final String dataspaceName, final String anchorName, final String parentXpath, @@ -344,10 +344,10 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService final Matcher descendantNodeHasListNodeKey = Pattern.compile(REG_EX_FOR_LIST_NODE_KEY).matcher(descendantNode); final boolean xpathPointsToAValidChildNodeWithKey = parentEntity.getChildFragments().stream().anyMatch( - (fragment) -> fragment.getXpath().equals(listNodeXpath)); + fragment -> fragment.getXpath().equals(listNodeXpath)); final boolean xpathPointsToAValidChildNodeWithoutKey = parentEntity.getChildFragments().stream().anyMatch( - (fragment) -> fragment.getXpath().replaceAll(REG_EX_FOR_LIST_NODE_KEY, "").equals(listNodeXpath)); + fragment -> fragment.getXpath().replaceAll(REG_EX_FOR_LIST_NODE_KEY, "").equals(listNodeXpath)); if ((descendantNodeHasListNodeKey.find() && xpathPointsToAValidChildNodeWithKey) || -- cgit 1.2.3-korg