Merge "Apostrophe handling in CpsPathParser"
[cps.git] / cps-service / src / main / java / org / onap / cps / utils / YangUtils.java
index c0dfe52..f00f944 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  ============LICENSE_START=======================================================
- *  Copyright (C) 2020-2022 Nordix Foundation
+ *  Copyright (C) 2020-2023 Nordix Foundation
  *  Modifications Copyright (C) 2021 Bell Canada.
  *  Modifications Copyright (C) 2021 Pantheon.tech
  *  Modifications Copyright (C) 2022 TechMahindra Ltd.
@@ -87,7 +87,7 @@ public class YangUtils {
      * @param schemaContext schema context describing associated data model
      * @return the NormalizedNode object
      */
-    public static ContainerNode parseData(final ContentType contentType,
+    static ContainerNode parseData(final ContentType contentType,
                                           final String nodeData,
                                           final SchemaContext schemaContext) {
         if (contentType == ContentType.JSON) {
@@ -103,7 +103,7 @@ public class YangUtils {
      * @param schemaContext schema context describing associated data model
      * @return the NormalizedNode object
      */
-    public static ContainerNode parseData(final ContentType contentType,
+    static ContainerNode parseData(final ContentType contentType,
                                           final String nodeData,
                                           final SchemaContext schemaContext,
                                           final String parentNodeXpath) {
@@ -253,7 +253,7 @@ public class YangUtils {
         final List<String> keyAttributes = nodeIdentifier.entrySet().stream().map(
                 entry -> {
                     final String name = entry.getKey().getLocalName();
-                    final String value = String.valueOf(entry.getValue()).replace("'", "\\'");
+                    final String value = String.valueOf(entry.getValue()).replace("'", "''");
                     return String.format("@%s='%s'", name, value);
                 }
         ).collect(Collectors.toList());