Merge "Fix sonar issues in Aggregate"
authorWilliam Reehil <william.reehil@att.com>
Tue, 23 Jun 2020 20:08:41 +0000 (20:08 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 23 Jun 2020 20:08:41 +0000 (20:08 +0000)
aai-core/src/main/java/org/onap/aai/serialization/queryformats/Aggregate.java

index b762726..9ce343f 100644 (file)
@@ -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);