diff options
Diffstat (limited to 'models-interactions/model-impl/aai/src')
-rw-r--r-- | models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiCqResponse.java | 5 | ||||
-rw-r--r-- | models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java | 11 |
2 files changed, 7 insertions, 9 deletions
diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiCqResponse.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiCqResponse.java index 7a6eb6859..ed77525be 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiCqResponse.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiCqResponse.java @@ -3,7 +3,7 @@ * * ================================================================================ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2023 Nordix Foundation. + * Modifications Copyright (C) 2023-2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,7 +42,6 @@ import org.onap.aai.domain.yang.Vserver; public class AaiCqResponse implements Serializable { private static final long serialVersionUID = 1L; - public static final String CONTEXT_KEY = AaiConstants.CONTEXT_PREFIX + "AaiCqResponse"; public static final String OPERATION = "CustomQuery"; private static final String GENERIC_VNF = "generic-vnf"; private static final String VF_MODULE = "vf-module"; @@ -50,7 +49,7 @@ public class AaiCqResponse implements Serializable { @SerializedName("results") private List<Serializable> inventoryResponseItems = new LinkedList<>(); - private final Gson gson; + private final transient Gson gson; /** * Constructor creates a custom query response from a valid json string. diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java index a6a671815..26a39875f 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java @@ -3,7 +3,7 @@ * aai * ================================================================================ * Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019-2020 Nordix Foundation. + * Modifications Copyright (C) 2019-2020, 2024 Nordix Foundation. * Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,6 +25,7 @@ package org.onap.policy.aai; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; +import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.UUID; @@ -48,8 +49,6 @@ import org.slf4j.LoggerFactory; @AllArgsConstructor public final class AaiManager { - // TODO remove this class - /** The Constant logger. */ private static final Logger logger = LoggerFactory.getLogger(AaiManager.class); @@ -246,12 +245,12 @@ public final class AaiManager { pnfName = URLEncoder.encode(pnfName, StandardCharsets.UTF_8.toString()) + AAI_DEPTH_SUFFIX; } catch (UnsupportedEncodingException e) { logger.error("Failed to encode the pnfName: {} using UTF-8", pnfName, e); - return null; + return Collections.emptyMap(); } var responseGet = getStringQuery(urlGet, username, password, requestId, pnfName); if (responseGet == null) { logger.error("Null response from AAI for the url: {}.", urlGet); - return null; + return Collections.emptyMap(); } try { @SuppressWarnings("unchecked") @@ -261,7 +260,7 @@ public final class AaiManager { .collect(Collectors.toMap(e -> "pnf." + e.getKey(), Map.Entry::getValue)); } catch (CoderException e) { logger.error("Failed to fetch PNF from AAI", e); - return null; + return Collections.emptyMap(); } } } |