diff options
author | Arundathi Patil <arundpil@in.ibm.com> | 2019-07-09 08:35:24 +0530 |
---|---|---|
committer | Arundathi Patil <arundpil@in.ibm.com> | 2019-07-09 08:35:36 +0530 |
commit | 878dcb36a30e0f90d6d11bd68a98b9bfb02ca9ee (patch) | |
tree | 92f1d48c2fa51de82f9e4e14f57b3b76ef69d513 /adapters/mso-openstack-adapters | |
parent | ab9522a55b6cf8dd2137f635b1accef60de34d20 (diff) |
Sonar fix in CreateInventoryTask.java
Fixed multiple sonar issues in this file
Issue-ID: SO-2098
Change-Id: I7da9ffae8ee11d8475445b5263bc7cfb78834a9c
Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
Diffstat (limited to 'adapters/mso-openstack-adapters')
-rw-r--r-- | adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java index 74cf7c38c9..c106591b25 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java @@ -3,6 +3,8 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * + * Copyright (C) 2019 IBM * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,6 +41,8 @@ public class CreateInventoryTask { private static final Logger logger = LoggerFactory.getLogger(CreateInventoryTask.class); + private static final String AAI_INVENTORY_FAILURE = "AAIInventoryFailure"; + @Autowired CreateAAIInventory createInventory; @@ -75,7 +79,7 @@ public class CreateInventoryTask { logger.debug("The External Task Id: {} Successful", externalTask.getId()); } else if (inventoryException) { logger.debug("The External Task Id: {} Failed, Retry not needed", externalTask.getId()); - externalTaskService.handleBpmnError(externalTask, "AAIInventoryFailure"); + externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE); } else { if (externalTask.getRetries() == null) { logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}", @@ -84,7 +88,7 @@ public class CreateInventoryTask { UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, getRetrySequence().length, 10000); } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) { logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId()); - externalTaskService.handleBpmnError(externalTask, "AAIInventoryFailure"); + externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE); } else { logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ", externalTask.getId(), externalTask.getRetries() - 1, @@ -97,13 +101,13 @@ public class CreateInventoryTask { } } else { logger.debug("The External Task Id: {} Failed, No Audit Results Written", externalTask.getId()); - externalTaskService.handleBpmnError(externalTask, "AAIInventoryFailure"); + externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE); } } private void setupMDC(ExternalTask externalTask) { try { - String msoRequestId = (String) externalTask.getVariable("mso-request-id"); + String msoRequestId = externalTask.getVariable("mso-request-id"); if (msoRequestId != null && !msoRequestId.isEmpty()) MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId); } catch (Exception e) { |