From adb892e88a82a2ef43600aff015a25d2db2b60d8 Mon Sep 17 00:00:00 2001 From: Sandeep J Date: Fri, 7 Sep 2018 00:44:25 +0530 Subject: fixed sonar issue in VolumeAdapterRest.java fixed sonar issue as detailed in SO-992 Issue-ID: SO-992 Change-Id: I4e222fd6b80a2dde199ad2d1e049357f64651e40 Signed-off-by: Sandeep J --- .../onap/so/adapters/vnf/VolumeAdapterRest.java | 28 ++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java index b4b5894491..e7bf3f79ce 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -81,7 +83,9 @@ import io.swagger.annotations.ApiResponses; public class VolumeAdapterRest { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, VolumeAdapterRest.class); private static final String TESTING_KEYWORD = "___TESTING___"; - + private static final String EXCEPTION="Exception :"; + private static final String RESP=", resp="; + private static final String VOLUME_GROUPID_IN_URL_DOESNT_MATCH_CONTENT="VolumeGroupId in URL does not match content"; @Autowired private MsoVnfAdapterImpl vnfAdapter; @@ -225,7 +229,7 @@ public class VolumeAdapterRest { rb, req.getMessageId()); } catch (VnfException e) { - LOGGER.debug("Exception :",e); + LOGGER.debug(EXCEPTION,e); eresp = new VolumeGroupExceptionResponse( e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } @@ -234,7 +238,7 @@ public class VolumeAdapterRest { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug ("CreateVFModule VolumesTask exit: code=" + getStatusCode() + ", resp="+ getResponse()); + LOGGER.debug ("CreateVFModule VolumesTask exit: code=" + getStatusCode() + RESP+ getResponse()); } } @@ -261,7 +265,7 @@ public class VolumeAdapterRest { return Response .status(HttpStatus.SC_BAD_REQUEST) .type(MediaType.TEXT_PLAIN) - .entity("VolumeGroupId in URL does not match content") + .entity(VOLUME_GROUPID_IN_URL_DOESNT_MATCH_CONTENT) .build(); } DeleteVNFVolumesTask task = new DeleteVNFVolumesTask(req); @@ -322,7 +326,7 @@ public class VolumeAdapterRest { } response = new DeleteVolumeGroupResponse(true, req.getMessageId()); } catch (VnfException e) { - LOGGER.debug("Exception :",e); + LOGGER.debug(EXCEPTION,e); eresp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } if (!req.isSynchronous()) { @@ -330,7 +334,7 @@ public class VolumeAdapterRest { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug("DeleteVNFVolumesTask exit: code=" + getStatusCode() + ", resp="+ getResponse()); + LOGGER.debug("DeleteVNFVolumesTask exit: code=" + getStatusCode() + RESP+ getResponse()); } } @@ -357,7 +361,7 @@ public class VolumeAdapterRest { return Response .status(HttpStatus.SC_BAD_REQUEST) .type(MediaType.TEXT_PLAIN) - .entity("VolumeGroupId in URL does not match content") + .entity(VOLUME_GROUPID_IN_URL_DOESNT_MATCH_CONTENT) .build(); } RollbackVNFVolumesTask task = new RollbackVNFVolumesTask(req); @@ -420,7 +424,7 @@ public class VolumeAdapterRest { vnfAdapter.rollbackVnf(vrb); response = new RollbackVolumeGroupResponse(true, req.getMessageId()); } catch (VnfException e) { - LOGGER.debug("Exception :",e); + LOGGER.debug(EXCEPTION,e); eresp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } if (!req.isSynchronous()) { @@ -428,7 +432,7 @@ public class VolumeAdapterRest { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug("DeleteVNFVolumesTask exit: code=" + getStatusCode() + ", resp="+ getResponse()); + LOGGER.debug("DeleteVNFVolumesTask exit: code=" + getStatusCode() + RESP+ getResponse()); } } @@ -456,7 +460,7 @@ public class VolumeAdapterRest { return Response .status(HttpStatus.SC_BAD_REQUEST) .type(MediaType.TEXT_PLAIN) - .entity("VolumeGroupId in URL does not match content") + .entity(VOLUME_GROUPID_IN_URL_DOESNT_MATCH_CONTENT) .build(); } UpdateVNFVolumesTask task = new UpdateVNFVolumesTask(req); @@ -552,7 +556,7 @@ public class VolumeAdapterRest { req.getVolumeGroupId(), req.getVolumeGroupStackId(), outputs.value, req.getMessageId()); } catch (VnfException e) { - LOGGER.debug("Exception :",e); + LOGGER.debug(EXCEPTION,e); eresp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } if (!req.isSynchronous()) { @@ -560,7 +564,7 @@ public class VolumeAdapterRest { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug("UpdateVNFVolumesTask exit: code=" + getStatusCode() + ", resp="+ getResponse()); + LOGGER.debug("UpdateVNFVolumesTask exit: code=" + getStatusCode() + RESP+ getResponse()); } } -- cgit 1.2.3-korg