From: emaclee Date: Wed, 16 Jul 2025 13:34:10 +0000 (+0100) Subject: SonarQube Violation: fields() deprecated X-Git-Tag: 3.7.0~13^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=e3509aac90ccc0700e07681510bc5ad564abae16;p=cps.git SonarQube Violation: fields() deprecated - change use of fields() to properties() as documented https://www.javadoc.io/doc/com.fasterxml.jackson.core/jackson-databind/latest/com/fasterxml/jackson/databind/JsonNode.html#fields-- Issue-ID: CPS-475 Change-Id: I17c9d08c3b753103cfe0a07addf175df59c9a082 Signed-off-by: emaclee --- diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/sync/ModuleOperationsUtils.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/sync/ModuleOperationsUtils.java index 80e41652ee..203198d49d 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/sync/ModuleOperationsUtils.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/sync/ModuleOperationsUtils.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2022-2025 Nordix Foundation + * Copyright (C) 2022-2025 OpenInfra Foundation Europe. All rights reserved. * Modifications Copyright (C) 2022 Bell Canada * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,9 +26,9 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.UUID; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -201,8 +201,8 @@ public class ModuleOperationsUtils { private String getFirstResource(final Object responseBody) { final String jsonObjectAsString = jsonObjectMapper.asJsonString(responseBody); final JsonNode overallJsonNode = jsonObjectMapper.convertToJsonNode(jsonObjectAsString); - final Iterator> overallJsonTreeMap = overallJsonNode.fields(); - final Map.Entry firstElement = overallJsonTreeMap.next(); + final Set> overallJsonTreeMap = overallJsonNode.properties(); + final Map.Entry firstElement = overallJsonTreeMap.iterator().next(); return jsonObjectMapper.asJsonString(Map.of(firstElement.getKey(), firstElement.getValue())); }