aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxuegao <xg353y@intl.att.com>2020-06-12 13:01:57 +0200
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-06-19 11:13:09 +0000
commit61aa954c94ddb1b60cb57d1c9d4b0908e0929487 (patch)
treeb25f168b9599e4a81c584d884dad40ed29f2530f
parent9ca59353f28ed9dcd6dbd7ece6063e7ff7d64cc8 (diff)
Fix Vulnerabilities
Fix the vulnerabilities reported by Sonar. Issue-ID: SDC-3114 Signed-off-by: xuegao <xg353y@intl.att.com> Change-Id: Icf97e427ef0c192b2f279380d7ee9eb570949d1f Signed-off-by: xuegao <xg353y@intl.att.com>
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphClient.java2
-rw-r--r--common-app-logging/src/main/java/org/openecomp/sdc/common/log/wrappers/Logger.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-worker/src/main/java/org/openecomp/sdc/notification/workers/NotificationReceiver.java43
-rw-r--r--openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-worker/src/main/java/org/openecomp/sdc/notification/workers/NotificationWorker.java4
4 files changed, 13 insertions, 38 deletions
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphClient.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphClient.java
index a44bbd8e12..20bbac3881 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphClient.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/JanusGraphClient.java
@@ -209,7 +209,7 @@ public class JanusGraphClient {
try {
JanusGraphFactory.drop(graph);
} catch (BackendException e) {
- e.printStackTrace();
+ logger.error(e.getMessage(),e);
}
}
}
diff --git a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/wrappers/Logger.java b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/wrappers/Logger.java
index 8f733b4f5e..284104cd57 100644
--- a/common-app-logging/src/main/java/org/openecomp/sdc/common/log/wrappers/Logger.java
+++ b/common-app-logging/src/main/java/org/openecomp/sdc/common/log/wrappers/Logger.java
@@ -132,7 +132,7 @@ public class Logger implements org.slf4j.Logger {
metric.startTimer()
.stopTimer();
} catch (Exception e) {
- e.printStackTrace();
+ error(e.getMessage(), e);
}
metric.log(ONAPLogConstants.Markers.INVOKE_RETURN, LogLevel.INFO, msg, params);
}
diff --git a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-worker/src/main/java/org/openecomp/sdc/notification/workers/NotificationReceiver.java b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-worker/src/main/java/org/openecomp/sdc/notification/workers/NotificationReceiver.java
index ee802640c4..4ce87427aa 100644
--- a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-worker/src/main/java/org/openecomp/sdc/notification/workers/NotificationReceiver.java
+++ b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-worker/src/main/java/org/openecomp/sdc/notification/workers/NotificationReceiver.java
@@ -24,46 +24,21 @@ import org.openecomp.sdc.notification.types.NotificationsStatusDto;
import java.util.UUID;
import java.util.function.Consumer;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.Setter;
-
+@Getter
+@Setter
+@AllArgsConstructor
public class NotificationReceiver {
- public String ownerId = null;
- public Consumer<NotificationsStatusDto> notesProcessor = null;
- public UUID lastEventId = null;
-
- NotificationReceiver(String ownerId, UUID lastEventId, Consumer<NotificationsStatusDto> notesProcessor) {
- this.ownerId = ownerId;
- this.lastEventId = lastEventId;
- this.notesProcessor = notesProcessor;
- }
+ private String ownerId = null;
+ private UUID lastEventId = null;
+ private Consumer<NotificationsStatusDto> notesProcessor = null;
NotificationReceiver(String ownerId, Consumer<NotificationsStatusDto> notesProcessor) {
this(ownerId, null, notesProcessor);
}
-
- public void setOwnerId(String ownerId) {
- this.ownerId = ownerId;
- }
-
- public String getOwnerId() {
- return this.ownerId;
- }
-
- public void setNotesProcessor(Consumer<NotificationsStatusDto> notesProcessor) {
- this.notesProcessor = notesProcessor;
- }
-
- public Consumer<NotificationsStatusDto> getNotesProcessor() {
- return this.notesProcessor;
- }
-
- public void setLastEventId(UUID lastEventId) {
- this.lastEventId = lastEventId;
- }
-
- public UUID getlastEventId() {
- return this.lastEventId;
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-worker/src/main/java/org/openecomp/sdc/notification/workers/NotificationWorker.java b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-worker/src/main/java/org/openecomp/sdc/notification/workers/NotificationWorker.java
index cde6419aa8..dce8edb356 100644
--- a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-worker/src/main/java/org/openecomp/sdc/notification/workers/NotificationWorker.java
+++ b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-worker/src/main/java/org/openecomp/sdc/notification/workers/NotificationWorker.java
@@ -89,7 +89,7 @@ public class NotificationWorker {
for (NotificationReceiver receiver : currUsers.values()) {
String ownerId = receiver.getOwnerId();
- UUID eventId = receiver.getlastEventId();
+ UUID eventId = receiver.getLastEventId();
NotificationsStatusDto status = news.getNewNotifications(ownerId, eventId, selectionLimit);
if(Objects.nonNull(status) && CollectionUtils.isNotEmpty(status.getNotifications())) {
receiver.setLastEventId(status.getLastScanned());
@@ -103,7 +103,7 @@ public class NotificationWorker {
public void register(String ownerId, UUID lastDelivered, Consumer<NotificationsStatusDto> notesProcessor) {
NotificationReceiver receiver = new NotificationReceiver(ownerId, lastDelivered, notesProcessor);
activeUsers.put(ownerId, receiver);
- LOGGER.debug("User {} is registered with eventId: {}", ownerId, receiver.getlastEventId());
+ LOGGER.debug("User {} is registered with eventId: {}", ownerId, receiver.getLastEventId());
}
public void unregister(String ownerId) {