diff options
author | Rodrigo Lima <rodrigo.lima@yoppworks.com> | 2020-06-15 17:21:00 -0400 |
---|---|---|
committer | Rodrigo Lima <rodrigo.lima@yoppworks.com> | 2020-06-15 17:21:00 -0400 |
commit | 017c95fc8016787d17d060b586c3f5bd52582a04 (patch) | |
tree | 6dbd372dbc8c51a4c14aa6e03234d9eede67bfa3 | |
parent | a81695efd81cc14d53ad94c5539101c641feb539 (diff) |
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 <rodrigo.lima@yoppworks.com>
Change-Id: Iebe0184ce39f244dd56e6861617cbf4e5dafb06c
-rw-r--r-- | aai-core/src/main/java/org/onap/aai/serialization/queryformats/Aggregate.java | 4 |
1 files changed, 2 insertions, 2 deletions
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<JsonObject> obj = this.getJsonFromVertex((Vertex)l, properties); - json.add(obj.get()); + if(obj.isPresent()) json.add(obj.get()); } } return Optional.of(json); |