Remove spaces from the user-supplied Zookeeper connection string.
Zookeeper will throw an exception when it encounters an otherwise perfectly
good connection string if the string contains spaces.
Fixes ONOS-1828.
Change-Id: I7844d595f008298b9f45eec564bc3a3e274fa4cc
diff --git a/src/main/java/net/onrc/onos/core/registry/ZookeeperRegistry.java b/src/main/java/net/onrc/onos/core/registry/ZookeeperRegistry.java
index ffb5564..3f318e1 100644
--- a/src/main/java/net/onrc/onos/core/registry/ZookeeperRegistry.java
+++ b/src/main/java/net/onrc/onos/core/registry/ZookeeperRegistry.java
@@ -580,6 +580,10 @@
"net.onrc.onos.core.registry.ZookeeperRegistry.connectionString",
DEFAULT_CONNECTION_STRING);
}
+
+ // Remove spaces from connection string otherwise Zookeeper complains
+ connectionString = connectionString.replaceAll("\\s", "");
+
log.info("Setting Zookeeper connection string to {}", this.connectionString);
namespace = System.getProperty(ZK_NAMESPACE_KEY, DEFAULT_NAMESPACE).trim();