aboutsummaryrefslogtreecommitdiffstats
path: root/common-app-api/src/main
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2023-08-15 12:29:21 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2023-08-15 19:31:40 +0000
commite489b852c39e45f43c7113abbfd439b29fc35348 (patch)
treefc00a661b6d3b858cb0916533d50e1294c58eb27 /common-app-api/src/main
parent34aad2f1cf716655ddd9bb5b5db1fe022999bb3e (diff)
Fix 'Fail to import service with get_property of map-of-string'-bug
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Change-Id: I5b6d6c5b9296f3e21d71ed312fe447ff399f85c1 Issue-ID: SDC-4596
Diffstat (limited to 'common-app-api/src/main')
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/JsonUtils.java15
1 files changed, 7 insertions, 8 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 c76310ecf4..9d1b166a3d 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
@@ -21,22 +21,21 @@ package org.openecomp.sdc.common.util;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class JsonUtils {
- private JsonUtils() {
-
- }
-
public static String toString(JsonElement jsonElement) {
if (jsonElement == null) {
return null;
}
if (!jsonElement.isJsonNull()) {
- if (!jsonElement.isJsonObject()) {
- return jsonElement.getAsString();
- } else {
+ if (jsonElement.isJsonObject() || jsonElement.isJsonArray()) {
return jsonElement.toString();
+ } else {
+ return jsonElement.getAsString();
}
} else {
return null;
@@ -59,7 +58,7 @@ public class JsonUtils {
return json.getAsJsonArray().isEmpty();
}
if (json.isJsonObject()) {
- return JsonUtils.isEmptyJson(json.getAsJsonObject());
+ return isEmptyJson(json.getAsJsonObject());
}
return false;