You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2020/06/04 18:13:19 UTC

[pulsar] branch master updated: [Issue 6921][pulsar-broker-common] Replaced "Paths.get(...).getParent()", because it's system dependent and uses '\' as path separator on Windows (#6992)

This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new da0492b  [Issue 6921][pulsar-broker-common] Replaced "Paths.get(...).getParent()", because it's system dependent and uses '\' as path separator on Windows (#6992)
da0492b is described below

commit da0492b262b8677a7f9f6bc3adf1efebcb477734
Author: horsteff <ho...@users.noreply.github.com>
AuthorDate: Thu Jun 4 20:13:05 2020 +0200

    [Issue 6921][pulsar-broker-common] Replaced "Paths.get(...).getParent()", because it's system dependent and uses '\' as path separator on Windows (#6992)
    
    Co-authored-by: penghui <pe...@apache.org>
---
 .../org/apache/pulsar/broker/cache/ConfigurationCacheService.java     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/cache/ConfigurationCacheService.java b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/cache/ConfigurationCacheService.java
index 3c3c27a..6fda6cd 100644
--- a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/cache/ConfigurationCacheService.java
+++ b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/cache/ConfigurationCacheService.java
@@ -18,7 +18,6 @@
  */
 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();