aboutsummaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2020-05-04 08:47:07 +0000
committerGerrit Code Review <gerrit@onap.org>2020-05-04 08:47:07 +0000
commit84728ef2083b7e9bd21ceb2d0b4b4591c8a44a83 (patch)
tree38a1728d15705eb52074b9aaa657b7a9c808926e /adapters
parent7ceffbb04dddbdf39e232340223c792d40d514f0 (diff)
parent440c44a4f57858b8bc5146ae730bb08d8d09ddc1 (diff)
Merge "Fix BBS integration issue"
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java14
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java3
2 files changed, 10 insertions, 7 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java
index a98778bf5d..e8e3f34f28 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java
@@ -8,9 +8,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,13 +21,14 @@
package org.onap.so.adapters.catalogdb.catalogrest;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.commons.lang3.StringEscapeUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import com.fasterxml.jackson.databind.ObjectMapper;
public abstract class CatalogQuery {
protected static Logger logger = LoggerFactory.getLogger(CatalogQuery.class);
@@ -103,9 +104,10 @@ public abstract class CatalogQuery {
return false;
}
ObjectMapper mapper = new ObjectMapper();
- mapper.readValue(jsonInString, String.class);
+ mapper.readTree(jsonInString);
return true;
} catch (IOException e) {
+ logger.error("Invalid json: {}", jsonInString);
return false;
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
index f945208854..8cd6ada792 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
@@ -28,6 +28,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlRootElement;
+import org.apache.commons.lang3.StringEscapeUtils;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.slf4j.Logger;
@@ -120,7 +121,7 @@ public class QueryServiceVnfs extends CatalogQuery {
put(valueMap, "NF_NAMING_CODE", o.getNfNamingCode());
put(valueMap, "VNFC_INSTANCE_GROUP_ORDER", o.getVnfcInstanceGroupOrder());
put(valueMap, "MULTI_STEP_DESIGN", o.getMultiStageDesign());
- if (isJSONValid(o.getResourceInput())) {
+ if (isJSONValid(StringEscapeUtils.unescapeJava(o.getResourceInput()))) {
put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
}