X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cps-ncmp-service%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fcps%2Fncmp%2Fapi%2Fimpl%2FNetworkCmProxyDataServicePropertyHandler.java;h=aae2f209ae1327e5b8e24ea71ce2984bc9abf5b8;hb=b130fd3158c537df1ce2cb1e5a7a86c3d7e0d2a7;hp=c838a752ecda0db98e6f771c638d3138fb0240d0;hpb=a0bbcfd8de94bb433e787b1a6ee400c988975850;p=cps.git diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServicePropertyHandler.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServicePropertyHandler.java index c838a752e..aae2f209a 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServicePropertyHandler.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServicePropertyHandler.java @@ -45,8 +45,10 @@ import org.onap.cps.ncmp.api.models.CmHandleRegistrationResponse.RegistrationErr import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle; import org.onap.cps.spi.FetchDescendantsOption; import org.onap.cps.spi.exceptions.DataNodeNotFoundException; +import org.onap.cps.spi.exceptions.DataValidationException; import org.onap.cps.spi.model.DataNode; import org.onap.cps.spi.model.DataNodeBuilder; +import org.onap.cps.utils.CpsValidator; import org.springframework.stereotype.Service; @Slf4j @@ -70,8 +72,9 @@ public class NetworkCmProxyDataServicePropertyHandler { final Collection ncmpServiceCmHandles) { final List cmHandleRegistrationResponses = new ArrayList<>(); for (final NcmpServiceCmHandle ncmpServiceCmHandle : ncmpServiceCmHandles) { - final String cmHandle = ncmpServiceCmHandle.getCmHandleID(); + final String cmHandle = ncmpServiceCmHandle.getCmHandleId(); try { + CpsValidator.validateNameCharacters(cmHandle); final String cmHandleXpath = String.format(CM_HANDLE_XPATH_TEMPLATE, cmHandle); final DataNode existingCmHandleDataNode = cpsDataService.getDataNode(NCMP_DATASPACE_NAME, NCMP_DMI_REGISTRY_ANCHOR, cmHandleXpath, @@ -83,8 +86,14 @@ public class NetworkCmProxyDataServicePropertyHandler { cmHandle, e.getMessage()); cmHandleRegistrationResponses.add(CmHandleRegistrationResponse .createFailureResponse(cmHandle, RegistrationError.CM_HANDLE_DOES_NOT_EXIST)); + } catch (final DataValidationException e) { + log.error("Unable to update cm handle : {}, caused by : {}", + cmHandle, e.getMessage()); + cmHandleRegistrationResponses.add( + CmHandleRegistrationResponse.createFailureResponse(cmHandle, + RegistrationError.CM_HANDLE_INVALID_ID)); } catch (final Exception exception) { - log.error("Unable to update dataNode for cmHandleId : {} , caused by : {}", + log.error("Unable to update cmHandle : {} , caused by : {}", cmHandle, exception.getMessage()); cmHandleRegistrationResponses.add( CmHandleRegistrationResponse.createFailureResponse(cmHandle, exception));