From 268b3658a817eab751cce31d753c10ca68f2eea1 Mon Sep 17 00:00:00 2001 From: Sandeep J Date: Tue, 11 Sep 2018 19:49:40 +0530 Subject: fixed sonar issue in VolumeAdapterRestV2.java fixed sonar issue as detailed in SO-1019 Issue-ID: SO-1019 Change-Id: I80452161d3be178fc0bc5aea3eae297ef4bc2c8c Signed-off-by: Sandeep J --- .../onap/so/adapters/vnf/VolumeAdapterRestV2.java | 27 +++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java index 3f3a312e12..a1ff139707 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. 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 @@ -83,6 +85,9 @@ import io.swagger.annotations.ApiResponses; public class VolumeAdapterRestV2 { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, VolumeAdapterRestV2.class); private static final String TESTING_KEYWORD = "___TESTING___"; + private static final String RESP=", resp="; + private static final String EXCEPTION="Exception :"; + private static final String VOLUME_GROUPID_MISSING="VolumeGroupId in URL does not match content"; @Autowired private VnfAdapterRestUtils vnfAdapterRestUtils; @@ -219,7 +224,7 @@ public class VolumeAdapterRestV2 { rb, req.getMessageId()); } catch (VnfException e) { - LOGGER.debug("Exception :",e); + LOGGER.debug(EXCEPTION,e); eresp = new VolumeGroupExceptionResponse( e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } @@ -228,7 +233,7 @@ public class VolumeAdapterRestV2 { 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()); } } @@ -257,7 +262,7 @@ public class VolumeAdapterRestV2 { return Response .status(HttpStatus.SC_BAD_REQUEST) .type(MediaType.TEXT_PLAIN) - .entity("VolumeGroupId in URL does not match content") + .entity(VOLUME_GROUPID_MISSING) .build(); } DeleteVNFVolumesTask task = new DeleteVNFVolumesTask(req, mode); @@ -323,7 +328,7 @@ public class VolumeAdapterRestV2 { } 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()) { @@ -331,7 +336,7 @@ public class VolumeAdapterRestV2 { 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()); } } @@ -358,7 +363,7 @@ public class VolumeAdapterRestV2 { return Response .status(HttpStatus.SC_BAD_REQUEST) .type(MediaType.TEXT_PLAIN) - .entity("VolumeGroupId in URL does not match content") + .entity(VOLUME_GROUPID_MISSING) .build(); } RollbackVNFVolumesTask task = new RollbackVNFVolumesTask(req); @@ -424,7 +429,7 @@ public class VolumeAdapterRestV2 { 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()) { @@ -432,7 +437,7 @@ public class VolumeAdapterRestV2 { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug("RollbackVNFVolumesTask exit: code=" + getStatusCode() + ", resp="+ getResponse()); + LOGGER.debug("RollbackVNFVolumesTask exit: code=" + getStatusCode() + RESP+ getResponse()); } } @@ -462,7 +467,7 @@ public class VolumeAdapterRestV2 { return Response .status(HttpStatus.SC_BAD_REQUEST) .type(MediaType.TEXT_PLAIN) - .entity("VolumeGroupId in URL does not match content") + .entity(VOLUME_GROUPID_MISSING) .build(); } UpdateVNFVolumesTask task = new UpdateVNFVolumesTask(req, mode); @@ -550,7 +555,7 @@ public class VolumeAdapterRestV2 { 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()) { @@ -558,7 +563,7 @@ public class VolumeAdapterRestV2 { 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