diff --git a/curator-test/src/main/java/org/apache/curator/test/InstanceSpec.java b/curator-test/src/main/java/org/apache/curator/test/InstanceSpec.java index a5beced5a..531f5af74 100644 --- a/curator-test/src/main/java/org/apache/curator/test/InstanceSpec.java +++ b/curator-test/src/main/java/org/apache/curator/test/InstanceSpec.java @@ -209,11 +209,21 @@ public InstanceSpec( this.tickTime = (tickTime > 0 ? tickTime : -1); // -1 to set default value this.maxClientCnxns = (maxClientCnxns >= 0 ? maxClientCnxns : -1); // -1 to set default value this.customProperties = customProperties != null - ? Collections.unmodifiableMap(customProperties) - : Collections.emptyMap(); + ? Collections.unmodifiableMap(enforceStringMap(customProperties)) + : Collections.emptyMap(); this.hostname = hostname == null ? localhost : hostname; } + private static Map enforceStringMap(Map properties) { + for (Map.Entry entry : properties.entrySet()) { + if (!(entry.getValue() instanceof String)) { + String msg = String.format("property %s has non string value %s", entry.getKey(), entry.getValue()); + throw new IllegalArgumentException(msg); + } + } + return properties; + } + public int getServerId() { return serverId; }