Skip to content

Commit f21b00d

Browse files
Lucas Martinserikbocks
authored andcommitted
Optimize imports and add containsAny (Wei suggestions)
1 parent 711ee4f commit f21b00d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

api/src/main/java/org/apache/cloudstack/config/ApiServiceConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
// under the License.
1717
package org.apache.cloudstack.config;
1818

19+
import com.cloud.exception.InvalidParameterValueException;
1920
import org.apache.cloudstack.framework.config.ConfigKey;
2021
import org.apache.cloudstack.framework.config.Configurable;
21-
import com.cloud.exception.InvalidParameterValueException;
2222
import org.apache.commons.lang3.StringUtils;
2323
import org.apache.log4j.Logger;
2424

@@ -37,7 +37,7 @@ public class ApiServiceConfiguration implements Configurable {
3737

3838
public static void validateEndpointUrl() {
3939
String csUrl = getApiServletPathValue();
40-
if (StringUtils.isBlank(csUrl) || csUrl.contains("localhost") || csUrl.contains("127.0.0.1")) {
40+
if (StringUtils.isBlank(csUrl) || StringUtils.containsAny(csUrl, "localhost", "127.0.0.1")) {
4141
LOGGER.error(String.format("Global setting %s cannot contain localhost or be blank. Current value: %s", ApiServletPath.key(), csUrl));
4242
throw new InvalidParameterValueException("Unable to complete this operation. Contact your cloud admin.");
4343
}

0 commit comments

Comments
 (0)