MS Model GUI fix for edit/view
[policy/engine.git] / ONAP-REST / src / main / java / org / onap / policy / rest / util / PolicyValidation.java
index 70be832..aa2c8f3 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP Policy Engine
  * ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018, 2020 AT&T Intellectual Property. All rights reserved.
  * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -40,7 +40,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
-
+import java.util.stream.Collectors;
 import javax.json.Json;
 import javax.json.JsonException;
 import javax.json.JsonObject;
@@ -1345,7 +1345,8 @@ public class PolicyValidation {
                 Map<String, String> attributesMap = null;
                 if (",".equals(attributes.substring(attributes.length() - 1))) {
                     String attributesString = attributes.substring(0, attributes.length() - 1);
-                    attributesMap = Splitter.on(",").withKeyValueSeparator("=").split(attributesString);
+                    attributesMap = Splitter.on(",").splitToList(attributesString).stream().map(kv -> kv.split("="))
+                            .collect(Collectors.toMap(kv -> kv[0], kv -> kv[1], (exist, d2) -> exist));
                 } else if (!StringUtils.isBlank(modelAttributes)) {
                     attributesMap = Splitter.on(",").withKeyValueSeparator("=").split(modelAttributes);
                 } else {