Skip to content

Commit 17329d2

Browse files
ustcweizhouweizhouapache
authored andcommitted
LB config: String values should not contain whitespace
1 parent 1a8f64d commit 17329d2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

api/src/main/java/org/apache/cloudstack/network/lb/LoadBalancerConfigKey.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import org.apache.cloudstack.network.lb.LoadBalancerConfig.SSLConfiguration;
2424
import org.apache.cloudstack.network.lb.LoadBalancerConfig.Scope;
2525

26+
import org.apache.commons.lang3.StringUtils;
27+
2628
import com.cloud.utils.Pair;
2729

2830
public enum LoadBalancerConfigKey {
@@ -202,6 +204,12 @@ public static Pair<LoadBalancerConfigKey, String> validate(Scope scope, String k
202204
}
203205
}
204206

207+
if (type.equals(String.class)) {
208+
if (StringUtils.containsWhitespace(value)) {
209+
return new Pair<>(null, "Please enter valid value without whitespace characters for parameter " + key);
210+
}
211+
}
212+
205213
if (LbSslConfiguration.key().equals(key)) {
206214
if (value == null || ! SSLConfiguration.validate(value.toLowerCase())) {
207215
return new Pair<>(null, "Please enter valid value in " + String.join(",", SSLConfiguration.getValues()) + " for parameter " + key);

0 commit comments

Comments
 (0)