From 11bf8d31b828d21103f0a9aa3134276e10e9e194 Mon Sep 17 00:00:00 2001 From: sarada prasad sahoo Date: Fri, 9 Aug 2019 17:50:27 +0530 Subject: fix sonar issue fix sonar issues Issue-ID: SO-1811 Signed-off-by: sarada prasad sahoo Change-Id: I8e443077864d758149bb5f62bc5dc5f718c29204 --- .../onap/so/openstack/utils/CinderClientImpl.java | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'adapters/mso-adapter-utils/src/main/java/org/onap') diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/CinderClientImpl.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/CinderClientImpl.java index b0c2d9430a..71cdcf6078 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/CinderClientImpl.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/CinderClientImpl.java @@ -22,7 +22,6 @@ package org.onap.so.openstack.utils; import org.onap.so.cloud.authentication.KeystoneAuthHolder; -import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; import org.onap.so.openstack.exceptions.MsoException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,7 +41,7 @@ public class CinderClientImpl extends MsoCommonUtils { /** * Gets the Cinder client. * - * @param cloudSite the cloud site + * @param cloudSiteId the cloud site * @param tenantId the tenant id * @return the glance client * @throws MsoException the mso exception @@ -62,15 +61,12 @@ public class CinderClientImpl extends MsoCommonUtils { * @param cloudSiteId the cloud site id * @param tenantId the tenant id * @param limit limits the number of records returned - * @param visibility visibility in the image in openstack * @param marker the last viewed record - * @param name the image names * @return the list of images in openstack - * @throws MsoCloudSiteNotFound the mso cloud site not found * @throws CinderClientException the glance client exception */ public Volumes queryVolumes(String cloudSiteId, String tenantId, int limit, String marker) - throws MsoCloudSiteNotFound, CinderClientException { + throws CinderClientException { try { Cinder cinderClient = getCinderClient(cloudSiteId, tenantId); // list is set to false, otherwise an invalid URL is appended @@ -78,22 +74,23 @@ public class CinderClientImpl extends MsoCommonUtils { cinderClient.volumes().list(false).queryParam("limit", limit).queryParam("marker", marker); return executeAndRecordOpenstackRequest(request, false); } catch (MsoException e) { - logger.error("Error building Cinder Client", e); - throw new CinderClientException("Error building Cinder Client", e); + String errorMsg = "Error building Cinder Client"; + logger.error(errorMsg, e); + throw new CinderClientException(errorMsg, e); } } - public Volume queryVolume(String cloudSiteId, String tenantId, String volumeId) - throws MsoCloudSiteNotFound, CinderClientException { + public Volume queryVolume(String cloudSiteId, String tenantId, String volumeId) throws CinderClientException { try { Cinder cinderClient = getCinderClient(cloudSiteId, tenantId); // list is set to false, otherwise an invalid URL is appended OpenStackRequest request = cinderClient.volumes().show(volumeId); return executeAndRecordOpenstackRequest(request, false); } catch (MsoException e) { - logger.error("Error building Cinder Client", e); - throw new CinderClientException("Error building Cinder Client", e); + String errorMsg = "Error building Cinder Client"; + logger.error(errorMsg, e); + throw new CinderClientException(errorMsg, e); } } -- cgit 1.2.3-korg