From 0fc90001599fed1727297da44b3c5d4fe1f1be43 Mon Sep 17 00:00:00 2001 From: danielhanrahan Date: Wed, 16 Aug 2023 10:39:48 +0100 Subject: Fixing sonar issues Issue-ID: CPS-475 Signed-off-by: danielhanrahan Change-Id: I7623a8301fd4567bf96c605eb26bf6c02b1d3c76 --- .../java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java | 2 +- .../java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java | 5 +---- .../main/java/org/onap/cps/spi/repository/FragmentQueryBuilder.java | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) (limited to 'cps-ri/src') 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 56fbe8cceb..c3b8adb5dd 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 @@ -329,7 +329,7 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService final List anchorIds; if (paginationOption == NO_PAGINATION) { - anchorIds = Collections.EMPTY_LIST; + anchorIds = Collections.emptyList(); } else { anchorIds = getAnchorIdsForPagination(dataspaceEntity, cpsPathQuery, paginationOption); if (anchorIds.isEmpty()) { diff --git a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java index 136512077c..9d0b7ee0d6 100755 --- a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java @@ -337,10 +337,7 @@ public class CpsModulePersistenceServiceImpl implements CpsModulePersistenceServ .filter(entity -> StringUtils.equals(checksum, (entity.getChecksum()))) .findFirst() .map(YangResourceEntity::getFileName); - if (optionalFileName.isPresent()) { - return optionalFileName.get(); - } - return "no filename"; + return optionalFileName.orElse("no filename"); } private String getDuplicatedChecksumFromException(final ConstraintViolationException exception) { diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentQueryBuilder.java b/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentQueryBuilder.java index 0c43d62bc7..472ed409aa 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentQueryBuilder.java +++ b/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentQueryBuilder.java @@ -60,7 +60,7 @@ public class FragmentQueryBuilder { */ public Query getQueryForAnchorAndCpsPath(final AnchorEntity anchorEntity, final CpsPathQuery cpsPathQuery) { return getQueryForDataspaceOrAnchorAndCpsPath(anchorEntity.getDataspace(), - anchorEntity, cpsPathQuery, Collections.EMPTY_LIST); + anchorEntity, cpsPathQuery, Collections.emptyList()); } /** -- cgit 1.2.3-korg