[Issue 6921][pulsar-broker-common] Replaced "Paths.get(...).getParent()", because it's system dependent and uses '\' as path separator on Windows
*/
package org.apache.pulsar.broker.cache;
-import java.nio.file.Paths;
import java.util.Map;
import org.apache.bookkeeper.util.ZkUtils;
@@ -127,7 +126,8 @@ public class ConfigurationCacheService {
private void createFailureDomainRoot(ZooKeeper zk, String path) {
try {
- final String clusterZnodePath = Paths.get(path).getParent().toString();
+ final int index = path.lastIndexOf('/');
+ final String clusterZnodePath = (index > 0) ? path.substring(0, index) : null;
if (zk.exists(clusterZnodePath, false) != null && zk.exists(path, false) == null) {
try {
byte[] data = "".getBytes();
