Source:
<code>private LinkedHashMap<String, String> computeInstanceTopologyMap(boolean isTopologyAwareEnabled, String instanceName, InstanceConfig instanceConfig, LinkedHashSet<String> clusterTopologyKeys) throws IllegalArgumentException { LinkedHashMap<String, String> instanceTopologyMap = new LinkedHashMap<>(); if (isTopologyAwareEnabled) { if (clusterTopologyKeys.size() == 0) { String zone = instanceConfig.getZoneId(); if (zone == null) { throw new IllegalArgumentException(String .format("ZONE_ID for instance %s is not set, fail the topology-aware placement!", instanceName)); } instanceTopologyMap.put(Types.ZONE.name(), zone); instanceTopologyMap.put(Types.INSTANCE.name(), instanceName); } else { <START> Map<String, String> domainAsMap = new HashMap<>(); <END> String[] pathPairs = instanceConfig.getDomainAsString().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 for instance %s is not valid, failed the topology-aware placement!", pair, instanceName)); } domainAsMap.put(values[0], values[1]); } int numOfMatchedKeys = 0; for (String key : clusterTopologyKeys) { String value = domainAsMap.get(key); if (value == null || value.length() == 0) { value = _defaultDomainPathValues.get(key); } else { numOfMatchedKeys++; } instanceTopologyMap.put(key, value); } if (numOfMatchedKeys != domainAsMap.size()) { logger.warn( "Key-value pairs in InstanceConfig.Domain do not align with keys in ClusterConfig.Topology " + "{}, using default domain value instead", instanceConfig.getDomainAsString(), clusterTopologyKeys.toString()); } } } else { instanceTopologyMap.put(Types.INSTANCE.name(), instanceName); } return instanceTopologyMap; }</code><technical_language>this block logic getDomainAsMap()</technical_language>

Target:
private LinkedHashMap<String, String> computeInstanceTopologyMap(boolean isTopologyAwareEnabled, String instanceName, InstanceConfig instanceConfig, LinkedHashSet<String> clusterTopologyKeys) throws IllegalArgumentException { LinkedHashMap<String, String> instanceTopologyMap = new LinkedHashMap<>(); if (isTopologyAwareEnabled) { if (clusterTopologyKeys.size() == 0) { String zone = instanceConfig.getZoneId(); if (zone == null) { throw new IllegalArgumentException(String .format("ZONE_ID for instance %s is not set, fail the topology-aware placement!", instanceName)); } instanceTopologyMap.put(Types.ZONE.name(), zone); instanceTopologyMap.put(Types.INSTANCE.name(), instanceName); } else { Map<String, String> domainAsMap = instanceConfig.getDomainAsMap(); if (domainAsMap.isEmpty()) { throw new IllegalArgumentException(String .format("Domain for instance %s is not set, fail the topology-aware placement!", instanceName)); } int numOfMatchedKeys = 0; for (String key : clusterTopologyKeys) { String value = domainAsMap.get(key); if (value == null || value.length() == 0) { value = _defaultDomainPathValues.get(key); } else { numOfMatchedKeys++; } instanceTopologyMap.put(key, value); } if (numOfMatchedKeys != domainAsMap.size()) { logger.warn( "Key-value pairs in InstanceConfig.Domain do not align with keys in ClusterConfig.Topology " + "{}, using default domain value instead", instanceConfig.getDomainAsString(), clusterTopologyKeys.toString()); } } } else { instanceTopologyMap.put(Types.INSTANCE.name(), instanceName); } return instanceTopologyMap; }