diff options
author | danielhanrahan <daniel.hanrahan@est.tech> | 2023-08-16 10:39:48 +0100 |
---|---|---|
committer | danielhanrahan <daniel.hanrahan@est.tech> | 2023-08-16 10:39:48 +0100 |
commit | 0fc90001599fed1727297da44b3c5d4fe1f1be43 (patch) | |
tree | 5a59c68179ce27d2359b1cb4ed7565d7c440c90c | |
parent | 8a369358cd7c6f20bbfd70bbe409cc7f5cc3ae23 (diff) |
Fixing sonar issues
Issue-ID: CPS-475
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
Change-Id: I7623a8301fd4567bf96c605eb26bf6c02b1d3c76
3 files changed, 3 insertions, 6 deletions
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<Long> 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()); } /** |