summaryrefslogtreecommitdiffstats
path: root/common-app-api
diff options
context:
space:
mode:
Diffstat (limited to 'common-app-api')
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/JsonUtils.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/JsonUtils.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/JsonUtils.java
index 6ee4984b9f..be534d2909 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/JsonUtils.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/JsonUtils.java
@@ -47,8 +47,15 @@ public class JsonUtils {
return json.entrySet().isEmpty();
}
- public static boolean isEmptyJson(JsonElement json) {
- return json.isJsonPrimitive() ? false : JsonUtils.isEmptyJson(json.getAsJsonObject());
+ public static boolean isEmptyJson(final JsonElement json) {
+ if (json.isJsonArray()) {
+ return json.getAsJsonArray().isEmpty();
+ }
+ if (json.isJsonObject()) {
+ return JsonUtils.isEmptyJson(json.getAsJsonObject());
+ }
+
+ return false;
}
public static boolean isJsonNullOrEmpty(JsonObject json) {