From 3476a80ef54a7207ca0162ba59dc4f17bdb9f09b Mon Sep 17 00:00:00 2001 From: atayal Date: Sat, 30 Oct 2021 23:26:11 +0530 Subject: [PATCH] fix Sonar critical issue - Define constant instead of duplicating the literal --- .../src/main/java/com/iluwatar/commander/Commander.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/commander/src/main/java/com/iluwatar/commander/Commander.java b/commander/src/main/java/com/iluwatar/commander/Commander.java index 526bed682..e9fe3dec5 100644 --- a/commander/src/main/java/com/iluwatar/commander/Commander.java +++ b/commander/src/main/java/com/iluwatar/commander/Commander.java @@ -93,6 +93,7 @@ public class Commander { private static final String ORDER = "Order "; private static final String REQUEST_ID = " request Id: "; private static final String ERROR_CONNECTING_MSG_SVC = ": Error in connecting to messaging service "; + private static final String TRY_CONNECTING_MSG_SVC = ": Trying to connect to messaging service.."; Commander(EmployeeHandle empDb, PaymentService paymentService, ShippingService shippingService, MessagingService messagingService, QueueDatabase qdb, int numOfRetries, @@ -571,13 +572,13 @@ public class Commander { + " dequeue.."); } else if (qt.messageType == 0) { sendPaymentFailureMessage(qt.order); - LOG.debug(ORDER + qt.order.id + ": Trying to connect to messaging service.."); + LOG.debug(ORDER + qt.order.id + TRY_CONNECTING_MSG_SVC); } else if (qt.messageType == 1) { sendPaymentPossibleErrorMsg(qt.order); - LOG.debug(ORDER + qt.order.id + ": Trying to connect to messaging service.."); + LOG.debug(ORDER + qt.order.id + TRY_CONNECTING_MSG_SVC); } else if (qt.messageType == 2) { sendSuccessMessage(qt.order); - LOG.debug(ORDER + qt.order.id + ": Trying to connect to messaging service.."); + LOG.debug(ORDER + qt.order.id + TRY_CONNECTING_MSG_SVC); } } else if (qt.taskType.equals(TaskType.EMPLOYEE_DB)) { if (qt.order.addedToEmployeeHandle) {