aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2023-10-04 14:03:14 +0100
committerFrancesco Fiora <francesco.fiora@est.tech>2023-10-04 13:09:06 +0000
commit02756d57ac2451c5e6f5c97465390b491e46ebc9 (patch)
tree1652d101f2726381c8b0c45258f0a1153f4c9461
parent8833b1dbfc0a8693acaec89801223542b29314f1 (diff)
Fix close response in clamp/acm
Fix close response using try-with-resources statement Issue-ID: POLICY-4834 Change-Id: Ifc90a09816b2338b020fc72125f2dd5450428409 Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
-rwxr-xr-xparticipant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java
index 7fd8e0dec..281fe3e01 100755
--- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java
@@ -165,12 +165,16 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
if (automationCompositionDefinition.getPolicyTypes() != null) {
LOGGER.info("Found Policy Types in automation composition definition: {} , Creating Policy Types",
automationCompositionDefinition.getName());
- createPolicyTypeResp = apiHttpClient.createPolicyType(automationCompositionDefinition).getStatus();
+ try (var response = apiHttpClient.createPolicyType(automationCompositionDefinition)) {
+ createPolicyTypeResp = response.getStatus();
+ }
}
if (automationCompositionDefinition.getToscaTopologyTemplate().getPolicies() != null) {
LOGGER.info("Found Policies in automation composition definition: {} , Creating Policies",
automationCompositionDefinition.getName());
- createPolicyResp = apiHttpClient.createPolicy(automationCompositionDefinition).getStatus();
+ try (var response = apiHttpClient.createPolicy(automationCompositionDefinition)) {
+ createPolicyResp = response.getStatus();
+ }
}
if (createPolicyTypeResp == HttpStatus.SC_OK && createPolicyResp == HttpStatus.SC_OK) {
LOGGER.info(