aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWitold Ficio Kopel <w.kopel@samsung.com>2019-04-16 16:59:38 +0200
committerWitold Ficio Kopel <w.kopel@samsung.com>2019-04-17 14:58:08 +0200
commitedf132efb3d616f582350bc3f77ed20e79d3b9c6 (patch)
tree48d5ebaf8d273956ed95b8f1c65695e10d99f136
parent76815fc4c9ec7b42774da2df5b38c943e1bbcc31 (diff)
Changed constants collections to immutable
Fix to three Sonar vulnerabilites. Changed mutable collections of constants (exposed by utility class) to immutable. Change-Id: I3b301eac20b52df72a6d1318483b7b931e750313 Issue-ID: SO-1794 Signed-off-by: Witold Ficio Kopel <w.kopel@samsung.com>
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java13
2 files changed, 10 insertions, 10 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
index 7bf68fff78..e16bf90d4d 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
@@ -28,9 +28,7 @@ import com.woorea.openstack.heat.model.CreateStackParam;
import com.woorea.openstack.heat.model.Stack;
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.Arrays;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.Scanner;
import javax.ws.rs.core.Response;
@@ -64,6 +62,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
+import com.google.common.collect.ImmutableSet;
@Component
public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
@@ -75,8 +74,8 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
public static final String VF_MODULE_ID = "vf_module_id";
public static final String TEMPLATE_TYPE = "template_type";
public static final String MULTICLOUD_QUERY_BODY_NULL = "multicloudQueryBody is null";
- public static final List<String> MULTICLOUD_INPUTS =
- Arrays.asList(OOF_DIRECTIVES, SDNC_DIRECTIVES, USER_DIRECTIVES, TEMPLATE_TYPE);
+ public static final ImmutableSet<String> MULTICLOUD_INPUTS =
+ ImmutableSet.of(OOF_DIRECTIVES, SDNC_DIRECTIVES, USER_DIRECTIVES, TEMPLATE_TYPE);
private static final Logger logger = LoggerFactory.getLogger(MsoMulticloudUtils.class);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java
index 01519fab6e..4cf5131747 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java
@@ -2,6 +2,8 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* 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
@@ -20,8 +22,7 @@
package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
-import static com.google.common.collect.Sets.newHashSet;
-import java.util.Set;
+import com.google.common.collect.ImmutableSet;
import org.onap.vnfmadapter.v1.model.OperationStateEnum;
import org.onap.vnfmadapter.v1.model.OperationStatusRetrievalStatusEnum;
@@ -51,11 +52,11 @@ public class Constants {
public static final String PRELOAD_VNFS_URL = "/restconf/config/VNF-API:preload-vnfs/vnf-preload-list/";
- public static final Set<OperationStateEnum> OPERATION_FINISHED_STATES =
- newHashSet(OperationStateEnum.COMPLETED, OperationStateEnum.FAILED, OperationStateEnum.ROLLED_BACK);
+ public static final ImmutableSet<OperationStateEnum> OPERATION_FINISHED_STATES =
+ ImmutableSet.of(OperationStateEnum.COMPLETED, OperationStateEnum.FAILED, OperationStateEnum.ROLLED_BACK);
- public static final Set<OperationStatusRetrievalStatusEnum> OPERATION_RETRIEVAL_STATES = newHashSet(
- OperationStatusRetrievalStatusEnum.STATUS_FOUND, OperationStatusRetrievalStatusEnum.WAITING_FOR_STATUS);
+ public static final ImmutableSet<OperationStatusRetrievalStatusEnum> OPERATION_RETRIEVAL_STATES = ImmutableSet
+ .of(OperationStatusRetrievalStatusEnum.STATUS_FOUND, OperationStatusRetrievalStatusEnum.WAITING_FOR_STATUS);
public static final String OPERATION_STATUS_PARAM_NAME = "operationStatus";