From 0c8e5c97e4269947bb79595d57555123c222b7e3 Mon Sep 17 00:00:00 2001 From: atayal Date: Sun, 31 Oct 2021 22:02:34 +0530 Subject: [PATCH] fix Sonar critical issue - fix code smells --- .../src/main/java/com/iluwatar/commander/Commander.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/commander/src/main/java/com/iluwatar/commander/Commander.java b/commander/src/main/java/com/iluwatar/commander/Commander.java index db8de692a..37d0268a3 100644 --- a/commander/src/main/java/com/iluwatar/commander/Commander.java +++ b/commander/src/main/java/com/iluwatar/commander/Commander.java @@ -262,7 +262,7 @@ public class Commander { } queue.add(qt); queueItems++; - LOG.info(ORDER_ID + ": " + qt.getType() + " task enqueued..", qt.order.id); + LOG.info(ORDER_ID + ": {}" + " task enqueued..", qt.order.id, qt.getType()); tryDoingTasksInQueue(); }; Retry.HandleErrorIssue handleError = (qt1, err) -> { @@ -546,14 +546,14 @@ public class Commander { if (queueItems != 0) { var qt = queue.peek(); //this should probably be cloned here //this is why we have retry for doTasksInQueue - LOG.trace(ORDER_ID + ": Started doing task of type " + qt.getType(), qt.order.id); + LOG.trace(ORDER_ID + ": Started doing task of type {}", qt.order.id, qt.getType()); if (qt.getFirstAttemptTime() == -1) { qt.setFirstAttemptTime(System.currentTimeMillis()); } if (System.currentTimeMillis() - qt.getFirstAttemptTime() >= queueTaskTime) { tryDequeue(); - LOG.trace(ORDER_ID + ": This queue task of type " + qt.getType() - + " does not need to be done anymore (timeout), dequeue..", qt.order.id); + LOG.trace(ORDER_ID + ": This queue task of type {}" + + " does not need to be done anymore (timeout), dequeue..", qt.order.id, qt.getType()); } else { if (qt.taskType.equals(TaskType.PAYMENT)) { if (!qt.order.paid.equals(PaymentStatus.TRYING)) {