diff options
author | kissand <andras.zoltan.kiss@est.tech> | 2022-06-02 16:26:23 +0200 |
---|---|---|
committer | kissand <andras.zoltan.kiss@est.tech> | 2022-06-09 15:26:38 +0200 |
commit | 2beebc64abb031ee98578ad2431ec2c0ca521567 (patch) | |
tree | d4238976ea4a4349ac4c8a599d14f4d59eb89ba9 /cps-ri/src/main | |
parent | 1410509e33142c0c79ff0e111c63abc47f5936d3 (diff) |
Handle errors during cm handle search
Issue-ID: CPS-1067
Change-Id: Iadc3413a29f9a455e658ec5bcaffc4881b7f7684
Signed-off-by: kissand <andras.zoltan.kiss@est.tech>
Diffstat (limited to 'cps-ri/src/main')
-rwxr-xr-x | cps-ri/src/main/java/org/onap/cps/spi/impl/CpsAdminPersistenceServiceImpl.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsAdminPersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsAdminPersistenceServiceImpl.java index 047ec9976f..20a39f98e3 100755 --- a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsAdminPersistenceServiceImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsAdminPersistenceServiceImpl.java @@ -23,10 +23,12 @@ package org.onap.cps.spi.impl; import java.util.Collection; +import java.util.Collections; import java.util.List; import java.util.stream.Collectors; import javax.transaction.Transactional; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.onap.cps.spi.CpsAdminPersistenceService; import org.onap.cps.spi.entities.AnchorEntity; import org.onap.cps.spi.entities.DataspaceEntity; @@ -34,6 +36,7 @@ import org.onap.cps.spi.entities.SchemaSetEntity; import org.onap.cps.spi.entities.YangResourceModuleReference; import org.onap.cps.spi.exceptions.AlreadyDefinedException; import org.onap.cps.spi.exceptions.DataspaceInUseException; +import org.onap.cps.spi.exceptions.DataspaceNotFoundException; import org.onap.cps.spi.exceptions.ModuleNamesNotFoundException; import org.onap.cps.spi.model.Anchor; import org.onap.cps.spi.repository.AnchorRepository; @@ -43,6 +46,7 @@ import org.onap.cps.spi.repository.YangResourceRepository; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.stereotype.Component; +@Slf4j @Component @RequiredArgsConstructor public class CpsAdminPersistenceServiceImpl implements CpsAdminPersistenceService { @@ -113,7 +117,13 @@ public class CpsAdminPersistenceServiceImpl implements CpsAdminPersistenceServic @Override public Collection<Anchor> queryAnchors(final String dataspaceName, final Collection<String> inputModuleNames) { - validateDataspaceAndModuleNames(dataspaceName, inputModuleNames); + try { + validateDataspaceAndModuleNames(dataspaceName, inputModuleNames); + } catch (DataspaceNotFoundException | ModuleNamesNotFoundException e) { + log.info("Module search encountered unknown dataspace or modulename, treating this as nothing found"); + return Collections.emptySet(); + } + final DataspaceEntity dataspaceEntity = dataspaceRepository.getByName(dataspaceName); final Collection<AnchorEntity> anchorEntities = anchorRepository .getAnchorsByDataspaceIdAndModuleNames(dataspaceEntity.getId(), inputModuleNames, inputModuleNames.size()); |