From 017c95fc8016787d17d060b586c3f5bd52582a04 Mon Sep 17 00:00:00 2001 From: Rodrigo Lima Date: Mon, 15 Jun 2020 17:21:00 -0400 Subject: Fix sonar issues in Aggregate - check obj.isPresent() in method processInput - return Optional.empty instead of null in method createPropertiesObject Issue-ID: AAI-2934 Signed-off-by: Rodrigo Lima Change-Id: Iebe0184ce39f244dd56e6861617cbf4e5dafb06c --- .../main/java/org/onap/aai/serialization/queryformats/Aggregate.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'aai-core') diff --git a/aai-core/src/main/java/org/onap/aai/serialization/queryformats/Aggregate.java b/aai-core/src/main/java/org/onap/aai/serialization/queryformats/Aggregate.java index b7627267..9ce343f6 100644 --- a/aai-core/src/main/java/org/onap/aai/serialization/queryformats/Aggregate.java +++ b/aai-core/src/main/java/org/onap/aai/serialization/queryformats/Aggregate.java @@ -129,7 +129,7 @@ public class Aggregate extends MultiFormatMapper { json.addProperty(prop.key(), gson.toJson(prop.value())); } else { // throw exception? - return null; + return Optional.empty(); } } } else { @@ -214,7 +214,7 @@ public class Aggregate extends MultiFormatMapper { json.add(inner); } else { Optional obj = this.getJsonFromVertex((Vertex)l, properties); - json.add(obj.get()); + if(obj.isPresent()) json.add(obj.get()); } } return Optional.of(json); -- cgit 1.2.3-korg