Polishing
This commit is contained in:
@@ -31,9 +31,6 @@ import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import static java.lang.String.*;
|
||||
import static org.springframework.util.StringUtils.*;
|
||||
|
||||
/**
|
||||
* Abstract base class for {@link Environment} implementations. Supports the notion of
|
||||
* reserved default profile names and enables specifying active and default profiles
|
||||
@@ -124,7 +121,7 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment {
|
||||
public AbstractEnvironment() {
|
||||
customizePropertySources(this.propertySources);
|
||||
if (this.logger.isDebugEnabled()) {
|
||||
this.logger.debug(format(
|
||||
this.logger.debug(String.format(
|
||||
"Initialized %s with PropertySources %s", getClass().getSimpleName(), this.propertySources));
|
||||
}
|
||||
}
|
||||
@@ -242,7 +239,8 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment {
|
||||
if (this.activeProfiles.isEmpty()) {
|
||||
String profiles = getProperty(ACTIVE_PROFILES_PROPERTY_NAME);
|
||||
if (StringUtils.hasText(profiles)) {
|
||||
setActiveProfiles(commaDelimitedListToStringArray(trimAllWhitespace(profiles)));
|
||||
setActiveProfiles(StringUtils.commaDelimitedListToStringArray(
|
||||
StringUtils.trimAllWhitespace(profiles)));
|
||||
}
|
||||
}
|
||||
return this.activeProfiles;
|
||||
@@ -264,7 +262,7 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment {
|
||||
@Override
|
||||
public void addActiveProfile(String profile) {
|
||||
if (this.logger.isDebugEnabled()) {
|
||||
this.logger.debug(format("Activating profile '%s'", profile));
|
||||
this.logger.debug(String.format("Activating profile '%s'", profile));
|
||||
}
|
||||
validateProfile(profile);
|
||||
doGetActiveProfiles();
|
||||
@@ -296,7 +294,8 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment {
|
||||
if (this.defaultProfiles.equals(getReservedDefaultProfiles())) {
|
||||
String profiles = getProperty(DEFAULT_PROFILES_PROPERTY_NAME);
|
||||
if (StringUtils.hasText(profiles)) {
|
||||
setDefaultProfiles(commaDelimitedListToStringArray(trimAllWhitespace(profiles)));
|
||||
setDefaultProfiles(StringUtils.commaDelimitedListToStringArray(
|
||||
StringUtils.trimAllWhitespace(profiles)));
|
||||
}
|
||||
}
|
||||
return this.defaultProfiles;
|
||||
@@ -393,7 +392,7 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment {
|
||||
}
|
||||
catch (AccessControlException ex) {
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info(format("Caught AccessControlException when accessing system " +
|
||||
logger.info(String.format("Caught AccessControlException when accessing system " +
|
||||
"environment variable [%s]; its value will be returned [null]. Reason: %s",
|
||||
attributeName, ex.getMessage()));
|
||||
}
|
||||
@@ -434,7 +433,7 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment {
|
||||
}
|
||||
catch (AccessControlException ex) {
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info(format("Caught AccessControlException when accessing system " +
|
||||
logger.info(String.format("Caught AccessControlException when accessing system " +
|
||||
"property [%s]; its value will be returned [null]. Reason: %s",
|
||||
attributeName, ex.getMessage()));
|
||||
}
|
||||
@@ -569,7 +568,7 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return format("%s {activeProfiles=%s, defaultProfiles=%s, propertySources=%s}",
|
||||
return String.format("%s {activeProfiles=%s, defaultProfiles=%s, propertySources=%s}",
|
||||
getClass().getSimpleName(), this.activeProfiles, this.defaultProfiles,
|
||||
this.propertySources);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user