mirror of https://github.com/apache/lucene.git
SOLR-15145: Additional fix for SolrJ back-compat (#2366)
This commit is contained in:
parent
99f011a06e
commit
97763ad3ce
|
@ -125,10 +125,15 @@ public class ZkNodeProps implements JSONWriter.Writable {
|
|||
@Override
|
||||
public void write(JSONWriter jsonWriter) {
|
||||
// don't write out the base_url if we have a node_name
|
||||
if (!STORE_BASE_URL && propMap.containsKey(ZkStateReader.BASE_URL_PROP) && propMap.containsKey(ZkStateReader.NODE_NAME_PROP)) {
|
||||
final Map<String,Object> filtered = new HashMap<>(propMap);
|
||||
if (!STORE_BASE_URL && propMap.containsKey(ZkStateReader.BASE_URL_PROP) && propMap.get(ZkStateReader.NODE_NAME_PROP) != null) {
|
||||
final Map<String, Object> filtered = new HashMap<>(propMap);
|
||||
filtered.remove(ZkStateReader.BASE_URL_PROP);
|
||||
jsonWriter.write(filtered);
|
||||
} else if (STORE_BASE_URL && propMap.get(ZkStateReader.BASE_URL_PROP) == null && propMap.get(ZkStateReader.NODE_NAME_PROP) != null) {
|
||||
// this is for back-compat with older SolrJ
|
||||
final Map<String, Object> addBaseUrl = new HashMap<>(propMap);
|
||||
addBaseUrl.put(ZkStateReader.BASE_URL_PROP, UrlScheme.INSTANCE.getBaseUrlForNodeName((String)propMap.get(ZkStateReader.NODE_NAME_PROP)));
|
||||
jsonWriter.write(addBaseUrl);
|
||||
} else {
|
||||
jsonWriter.write(propMap);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue