polishing
This commit is contained in:
@@ -16,10 +16,7 @@
|
||||
|
||||
package org.springframework.core.env;
|
||||
|
||||
import static java.lang.String.format;
|
||||
import static org.springframework.util.StringUtils.commaDelimitedListToSet;
|
||||
import static org.springframework.util.StringUtils.trimAllWhitespace;
|
||||
|
||||
import static java.lang.String.*;
|
||||
import java.security.AccessControlException;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashSet;
|
||||
@@ -28,9 +25,11 @@ import java.util.Set;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
import static org.springframework.util.StringUtils.*;
|
||||
|
||||
/**
|
||||
* Abstract base class for {@link Environment} implementations.
|
||||
@@ -67,7 +66,7 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment {
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
public String[] getActiveProfiles() {
|
||||
return this.doGetActiveProfiles().toArray(new String[]{});
|
||||
return StringUtils.toStringArray(doGetActiveProfiles());
|
||||
}
|
||||
|
||||
protected Set<String> doGetActiveProfiles() {
|
||||
@@ -86,7 +85,7 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment {
|
||||
}
|
||||
|
||||
public String[] getDefaultProfiles() {
|
||||
return this.doGetDefaultProfiles().toArray(new String[]{});
|
||||
return StringUtils.toStringArray(doGetDefaultProfiles());
|
||||
}
|
||||
|
||||
protected Set<String> doGetDefaultProfiles() {
|
||||
|
||||
@@ -87,16 +87,15 @@ public class DefaultEnvironment extends AbstractEnvironment {
|
||||
/**
|
||||
* Create a new {@code Environment} populated with property sources in the following order:
|
||||
* <ul>
|
||||
* <li>{@value #SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME}
|
||||
* <li>{@value #SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME}
|
||||
* <li>{@value #SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME}
|
||||
* <li>{@value #SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME}
|
||||
* </ul>
|
||||
*
|
||||
* <p>Properties present in {@value #SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME} will
|
||||
* take precedence over those in {@value #SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME}.
|
||||
*/
|
||||
public DefaultEnvironment() {
|
||||
this.getPropertySources().addFirst(new MapPropertySource(SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, this.getSystemEnvironment()));
|
||||
this.getPropertySources().addFirst(new MapPropertySource(SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME, this.getSystemProperties()));
|
||||
getPropertySources().addFirst(new MapPropertySource(SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, getSystemEnvironment()));
|
||||
getPropertySources().addFirst(new MapPropertySource(SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME, getSystemProperties()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.springframework.core.env;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Interface for resolving properties against any underlying source.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,6 +27,9 @@ package org.springframework.util;
|
||||
*/
|
||||
public interface ErrorHandler {
|
||||
|
||||
/**
|
||||
* Handle the given error, possibly rethrowing it as a fatal exception
|
||||
*/
|
||||
void handleError(Throwable t);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user