jiajunwang commented on a change in pull request #1043:
URL: https://github.com/apache/helix/pull/1043#discussion_r443090524



##########
File path: helix-core/src/main/java/org/apache/helix/model/InstanceConfig.java
##########
@@ -150,12 +150,22 @@ public String getDomainAsString() {
    */
   public Map<String, String> getDomainAsMap() {
     String domain = getDomainAsString();
+    Map<String, String> domainAsMap = new HashMap<>();
     if (domain == null || domain.isEmpty()) {
-      return Collections.emptyMap();
+      return domainAsMap;
+    }
+
+    String[] pathPairs = domain.trim().split(",");
+    for (String pair : pathPairs) {
+      String[] values = pair.trim().split("=");
+      if (values.length != 2 || values[0].isEmpty() || values[1].isEmpty()) {
+        throw new IllegalArgumentException(
+            String.format("Domain-Value pair %s is not valid.", pair));
+      }
+      domainAsMap.put(values[0], values[1]);

Review comment:
       We shall trim at the final values level but not the above layers. What 
do you think?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to