From bf06e83f40cdbfcfc1428040bf8fa58a518cdea4 Mon Sep 17 00:00:00 2001 From: Taka Cho Date: Tue, 17 Aug 2021 14:23:26 -0400 Subject: sonar fix for clamp - bug: added InterruptedException for sleep - vulns: two false positve - removed some unused import - changed to use var for local variable Issue-ID: POLICY-3452 Change-Id: I8b4be1378a2aad8f68562b63f70853832673ce97 Signed-off-by: Taka Cho --- .../participant/kubernetes/configurations/ParticipantConfig.java | 6 ++---- .../clamp/controlloop/participant/kubernetes/helm/HelmClient.java | 3 ++- .../controlloop/participant/kubernetes/service/ChartStore.java | 8 +++++--- 3 files changed, 9 insertions(+), 8 deletions(-) (limited to 'participant/participant-impl/participant-impl-kubernetes/src/main/java') diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/configurations/ParticipantConfig.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/configurations/ParticipantConfig.java index 97adfde88..54627d557 100644 --- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/configurations/ParticipantConfig.java +++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/configurations/ParticipantConfig.java @@ -2,6 +2,8 @@ * ========================LICENSE_START================================= * Copyright (C) 2021 Nordix Foundation. All rights reserved. * ====================================================================== + * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. + * ====================================================================== * 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 @@ -18,10 +20,6 @@ package org.onap.policy.clamp.controlloop.participant.kubernetes.configurations; -import org.apache.catalina.connector.Connector; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; -import org.springframework.boot.web.servlet.server.ServletWebServerFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.multipart.MultipartResolver; diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java index b38fbeb81..6a1b98654 100644 --- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java +++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/helm/HelmClient.java @@ -2,6 +2,8 @@ * ========================LICENSE_START================================= * Copyright (C) 2021 Nordix Foundation. All rights reserved. * ====================================================================== + * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. + * ====================================================================== * 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 @@ -25,7 +27,6 @@ import java.io.InputStreamReader; import java.lang.invoke.MethodHandles; import java.nio.charset.StandardCharsets; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Map; import org.apache.commons.io.IOUtils; diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartStore.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartStore.java index 975671705..ed53d0352 100644 --- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartStore.java +++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/service/ChartStore.java @@ -2,6 +2,8 @@ * ========================LICENSE_START================================= * Copyright (C) 2021 Nordix Foundation. All rights reserved. * ====================================================================== + * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. + * ====================================================================== * 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 @@ -168,7 +170,7 @@ public class ChartStore { try (var out = new PrintStream(new FileOutputStream(getFile(chart)))) { out.print(STANDARD_CODER.encode(chart)); } catch (Exception exc) { - LOGGER.warn("Could not store chart: {} {}", chart.getChartId(), exc); + LOGGER.warn("Could not store chart: {}", chart.getChartId(), exc); } } @@ -179,11 +181,11 @@ public class ChartStore { private synchronized void restoreFromLocalFileSystem() { try { - Path localChartDirectoryPath = Paths.get(participantK8sParameters.getLocalChartDirectory()); + var localChartDirectoryPath = Paths.get(participantK8sParameters.getLocalChartDirectory()); Files.createDirectories(localChartDirectoryPath); restoreFromLocalFileSystem(localChartDirectoryPath); } catch (Exception ioe) { - LOGGER.warn("Could not restore charts from local file system: {}", ioe); + LOGGER.warn("Could not restore charts from local file system", ioe); } } -- cgit 1.2.3-korg