Project

General

Profile

« Previous | Next » 

Revision 53823

fixed zk chroot parsing

View differences:

modules/dnet-index-solr-common/branches/solr75/src/main/java/eu/dnetlib/functionality/index/utils/ZkServers.java
12 12
public class ZkServers {
13 13

  
14 14
    private static final Log log = LogFactory.getLog(ZkServers.class);
15
    public static final String SEPARATOR = "/";
15 16

  
16 17
    private List<String> hosts;
17 18

  
......
21 22

  
22 23
        //quorum0:2182,quorum1:2182,quorum2:2182,quorum3:2182,quorum4:2182/solr-dev-openaire
23 24
        String urls = zkUrl;
24
        final Optional<String> chRoot = Optional.of(StringUtils.substringAfterLast(zkUrl, "/"));
25
        final Optional<String> chRoot = Optional.of(SEPARATOR + StringUtils.substringAfterLast(zkUrl, SEPARATOR));
25 26
        if (chRoot.isPresent() && StringUtils.isNotBlank(chRoot.get())) {
26 27
            log.debug(String.format("found zk chroot %s", chRoot));
27
            urls = zkUrl.replace("/" + chRoot, "");
28
            urls = zkUrl.replace(chRoot.get(), "");
28 29
        }
29 30

  
30 31
        final List<String> urlList = Lists.newArrayList(Splitter.on(",").omitEmptyStrings().split(urls));

Also available in: Unified diff