diff options
author | qingshuting <qingshuting1@huawei.com> | 2022-09-14 10:37:24 +0800 |
---|---|---|
committer | qingshuting <qingshuting1@huawei.com> | 2022-09-14 10:40:23 +0800 |
commit | 7d549f48c21ff063518e8ff481c3e5a9eb8ca8b0 (patch) | |
tree | 9911bc7b0e7c8310460a00eddc73d5d6a3210e82 | |
parent | b260f64378d8906b3d03606e69877eebb85c35e4 (diff) |
[ConfigFetchFromCbs] Fix bug of cbs that fetch configs getting hung when
policy engine is empty
Issue-ID: DCAEGEN2-3242
Signed-off-by: qingshuting <qingshuting1@huawei.com>
Change-Id: I21307291c182e3681ba864afc5a6a6f7eb5a8add
-rw-r--r-- | Changelog.md | 3 | ||||
-rw-r--r-- | pom.xml | 3 | ||||
-rw-r--r-- | src/main/java/org/onap/dcaegen2/services/sonhms/controller/ConfigFetchFromCbs.java | 13 | ||||
-rw-r--r-- | version.properties | 3 |
4 files changed, 16 insertions, 6 deletions
diff --git a/Changelog.md b/Changelog.md index 770d5b2..7146bc7 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [2.1.10] - 2022/09/13 + - [DCAEGEN2-3242](https://jira.onap.org/browse/DCAEGEN2-3242) - Fix bug in ConfigFectchFromCbs that fetch will get hung when policy config in pdp engine is empty + ## [2.1.9] - 2022/09/01 - [DCAEGEN2-3148](https://jira.onap.org/browse/DCAEGEN2-3148) - Modify payload for ANR closedloop to align with A1 based action @@ -5,6 +5,7 @@ * son-handler * ================================================================================ * Copyright (C) 2019-2022 Wipro Limited. + * Copyright (C) 2022 Huawei Technologies Co., Ltd. * ============================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +28,7 @@ <groupId>org.onap.dcaegen2.services.son-handler</groupId> <artifactId>son-handler</artifactId> <name>dcaegen2-services-son-handler</name> - <version>2.1.9-SNAPSHOT</version> + <version>2.1.10-SNAPSHOT</version> <!--parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.4.RELEASE</version> </parent --> diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/controller/ConfigFetchFromCbs.java b/src/main/java/org/onap/dcaegen2/services/sonhms/controller/ConfigFetchFromCbs.java index afd5092..41f00a9 100644 --- a/src/main/java/org/onap/dcaegen2/services/sonhms/controller/ConfigFetchFromCbs.java +++ b/src/main/java/org/onap/dcaegen2/services/sonhms/controller/ConfigFetchFromCbs.java @@ -3,6 +3,7 @@ * son-handler * ================================================================================ * Copyright (C) 2019-2021 Wipro Limited. + * Copyright (C) 2022 Huawei Technologies Co., Ltd. * ============================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -93,11 +94,15 @@ public class ConfigFetchFromCbs implements Runnable { Type mapType = new TypeToken<Map<String, Object>>() { }.getType(); if (jsonObject.getAsJsonObject("policies") != null) { - JsonObject policyJson = jsonObject.getAsJsonObject("policies").getAsJsonArray("items").get(0) + if(jsonObject.getAsJsonObject("policies").getAsJsonArray("items").size() == 0) { + log.error("No policy in policy drool pdp engine, nothing to update."); + } else { + JsonObject policyJson = jsonObject.getAsJsonObject("policies").getAsJsonArray("items").get(0) .getAsJsonObject().getAsJsonObject("config"); - Map<String, Object> policy = new Gson().fromJson(policyJson, mapType); - configPolicy.setConfig(policy); - log.info("Config policy {}", configPolicy); + Map<String, Object> policy = new Gson().fromJson(policyJson, mapType); + configPolicy.setConfig(policy); + log.info("Config policy {}", configPolicy); + } } }, throwable -> log.warn("Ooops", throwable)); } diff --git a/version.properties b/version.properties index 27dd1a8..bc9110f 100644 --- a/version.properties +++ b/version.properties @@ -3,6 +3,7 @@ # son-handler # ================================================================================ # Copyright (C) 2019-2022 Wipro Limited. +# Copyright (C) 2022 Huawei Technologies Co., Ltd. # ============================================================================== # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,7 +21,7 @@ ############################################################################### major=2 minor=1 -patch=9 +patch=10 base_version=${major}.${minor}.${patch} release_version=${base_version} snapshot_version=${base_version}-SNAPSHOT |