diff options
author | ramu.n <ramu.n@huawei.com> | 2020-04-30 21:21:15 +0530 |
---|---|---|
committer | ramu.n <ramu.n@huawei.com> | 2020-04-30 21:21:43 +0530 |
commit | 440c44a4f57858b8bc5146ae730bb08d8d09ddc1 (patch) | |
tree | a3db4744306e6415b94540cc326ba2eb77dd3129 /adapters/mso-catalog-db-adapter/src | |
parent | 788ada8a8c280e7599c46281804468d0e468d42b (diff) |
Fix BBS integration issue
Issue-ID: SO-2827
Change-Id: I292094db2740632cefc9962ab5bf6028b51bdbb8
Signed-off-by: ramu.n <ramu.n@huawei.com>
Diffstat (limited to 'adapters/mso-catalog-db-adapter/src')
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()); } |