Minor change to code formatting
This commit is contained in:
@@ -138,7 +138,8 @@ class BeanDefinitionLoader {
|
||||
if (source instanceof CharSequence) {
|
||||
try {
|
||||
return load(Class.forName(source.toString()));
|
||||
} catch (ClassNotFoundException e) {
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
}
|
||||
|
||||
Resource loadedResource = (this.resourceLoader != null ? this.resourceLoader
|
||||
|
||||
@@ -270,7 +270,8 @@ public class SpringApplication {
|
||||
contextClass = Class
|
||||
.forName(this.webEnvironment ? DEFAULT_WEB_CONTEXT_CLASS
|
||||
: DEFAULT_CONTEXT_CLASS);
|
||||
} catch (ClassNotFoundException ex) {
|
||||
}
|
||||
catch (ClassNotFoundException ex) {
|
||||
throw new IllegalStateException(
|
||||
"Unable create a default ApplicationContext, "
|
||||
+ "please specify an ApplicationContextClass", ex);
|
||||
@@ -344,14 +345,16 @@ public class SpringApplication {
|
||||
for (String arg : defaults) {
|
||||
if (isOptionArg(arg)) {
|
||||
addOptionArg(options, arg);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
nonopts.add(arg);
|
||||
}
|
||||
}
|
||||
for (String arg : args) {
|
||||
if (isOptionArg(arg)) {
|
||||
addOptionArg(options, arg);
|
||||
} else if (!nonopts.contains(arg)) {
|
||||
}
|
||||
else if (!nonopts.contains(arg)) {
|
||||
nonopts.add(arg);
|
||||
}
|
||||
}
|
||||
@@ -376,7 +379,8 @@ public class SpringApplication {
|
||||
optionName = optionText.substring(0, optionText.indexOf("="));
|
||||
optionValue = optionText.substring(optionText.indexOf("=") + 1,
|
||||
optionText.length());
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
optionName = optionText;
|
||||
}
|
||||
if (optionName.isEmpty()) {
|
||||
@@ -434,7 +438,8 @@ public class SpringApplication {
|
||||
for (CommandLineRunner runner : runners) {
|
||||
try {
|
||||
runner.run(args);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new IllegalStateException("Failed to execute CommandLineRunner", e);
|
||||
}
|
||||
}
|
||||
@@ -606,11 +611,13 @@ public class SpringApplication {
|
||||
generators.addAll(context.getBeansOfType(ExitCodeGenerator.class)
|
||||
.values());
|
||||
exitCode = getExitCode(generators);
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
close(context);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
exitCode = (exitCode == 0 ? 1 : exitCode);
|
||||
}
|
||||
@@ -625,7 +632,8 @@ public class SpringApplication {
|
||||
if (value > 0 && value > exitCode || value < 0 && value < exitCode) {
|
||||
exitCode = value;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
exitCode = (exitCode == 0 ? 1 : exitCode);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -74,7 +74,8 @@ public class CustomPropertyConstructor extends Constructor {
|
||||
|
||||
try {
|
||||
typeMap.put(alias, this.propertyUtils.getProperty(type, name));
|
||||
} catch (IntrospectionException e) {
|
||||
}
|
||||
catch (IntrospectionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,8 @@ public class InetAddressEditor extends PropertyEditorSupport implements Property
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
try {
|
||||
setValue(InetAddress.getByName(text));
|
||||
} catch (UnknownHostException e) {
|
||||
}
|
||||
catch (UnknownHostException e) {
|
||||
throw new IllegalArgumentException("Cannot locate host", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +172,8 @@ public class PropertiesConfigurationFactory<T> implements FactoryBean<T>,
|
||||
try {
|
||||
if (this.properties != null) {
|
||||
logger.trace("Properties:\n" + this.properties);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
logger.trace("Property Sources: " + this.propertySources);
|
||||
}
|
||||
this.initialized = true;
|
||||
@@ -180,7 +181,8 @@ public class PropertiesConfigurationFactory<T> implements FactoryBean<T>,
|
||||
RelaxedDataBinder dataBinder;
|
||||
if (this.targetName != null) {
|
||||
dataBinder = new RelaxedDataBinder(this.configuration, this.targetName);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
dataBinder = new RelaxedDataBinder(this.configuration);
|
||||
}
|
||||
if (this.validator != null) {
|
||||
@@ -195,7 +197,8 @@ public class PropertiesConfigurationFactory<T> implements FactoryBean<T>,
|
||||
PropertyValues pvs;
|
||||
if (this.properties != null) {
|
||||
pvs = new MutablePropertyValues(this.properties);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
pvs = new PropertySourcesPropertyValues(this.propertySources);
|
||||
}
|
||||
dataBinder.bind(pvs);
|
||||
@@ -219,7 +222,8 @@ public class PropertiesConfigurationFactory<T> implements FactoryBean<T>,
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (BindException e) {
|
||||
}
|
||||
catch (BindException e) {
|
||||
if (this.exceptionIfInvalid) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,8 @@ public class PropertySourcesPropertyValues implements PropertyValues {
|
||||
PropertyValue pvOld = old.getPropertyValue(newPv.getName());
|
||||
if (pvOld == null) {
|
||||
changes.addPropertyValue(newPv);
|
||||
} else if (!pvOld.equals(newPv)) {
|
||||
}
|
||||
else if (!pvOld.equals(newPv)) {
|
||||
// it's changed
|
||||
changes.addPropertyValue(newPv);
|
||||
}
|
||||
|
||||
@@ -157,7 +157,8 @@ public class RelaxedDataBinder extends DataBinder {
|
||||
Map<String, Object> existing = (Map<String, Object>) target
|
||||
.getPropertyValue(base);
|
||||
nested = existing;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
target.setPropertyValue(base, nested);
|
||||
}
|
||||
modifyPopertiesForMap(nested, propertyValues, index, base);
|
||||
@@ -196,7 +197,8 @@ public class RelaxedDataBinder extends DataBinder {
|
||||
if (target.getPropertyType(prefix + candidate) != null) {
|
||||
return candidate;
|
||||
}
|
||||
} catch (InvalidPropertyException ex) {
|
||||
}
|
||||
catch (InvalidPropertyException ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +158,8 @@ public class YamlConfigurationFactory<T> implements FactoryBean<T>, MessageSourc
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (YAMLException e) {
|
||||
}
|
||||
catch (YAMLException e) {
|
||||
if (this.exceptionIfInvalid) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,8 @@ public class JacksonJsonParser implements JsonParser {
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> map = new ObjectMapper().readValue(json, Map.class);
|
||||
return map;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new IllegalArgumentException("Cannot parse JSON", e);
|
||||
}
|
||||
}
|
||||
@@ -45,7 +46,8 @@ public class JacksonJsonParser implements JsonParser {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Object> list = new ObjectMapper().readValue(json, List.class);
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new IllegalArgumentException("Cannot parse JSON", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,8 @@ public class SimpleJsonParser implements JsonParser {
|
||||
public Map<String, Object> parseMap(String json) {
|
||||
if (json.startsWith("{")) {
|
||||
return parseMapInternal(json);
|
||||
} else if (json.trim().equals("")) {
|
||||
}
|
||||
else if (json.trim().equals("")) {
|
||||
return new HashMap<String, Object>();
|
||||
}
|
||||
return null;
|
||||
@@ -49,7 +50,8 @@ public class SimpleJsonParser implements JsonParser {
|
||||
public List<Object> parseList(String json) {
|
||||
if (json.startsWith("[")) {
|
||||
return parseListInternal(json);
|
||||
} else if (json.trim().equals("")) {
|
||||
}
|
||||
else if (json.trim().equals("")) {
|
||||
return new ArrayList<Object>();
|
||||
}
|
||||
return null;
|
||||
@@ -104,7 +106,8 @@ public class SimpleJsonParser implements JsonParser {
|
||||
trimTrailingCharacter(values[1], '"'), '"');
|
||||
if (string.startsWith("{") && string.endsWith("}")) {
|
||||
value = parseInternal(string);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
value = string;
|
||||
}
|
||||
}
|
||||
@@ -129,7 +132,8 @@ public class SimpleJsonParser implements JsonParser {
|
||||
if (current == ',' && inObject == 0) {
|
||||
list.add(build.toString());
|
||||
build.setLength(0);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
build.append(current);
|
||||
}
|
||||
index++;
|
||||
|
||||
@@ -99,7 +99,8 @@ public class YamlMapFactoryBean extends YamlProcessor implements
|
||||
(Map) existing);
|
||||
merge(result, (Map) value);
|
||||
output.put(key, result);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
output.put(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,14 +179,16 @@ public class YamlProcessor {
|
||||
// No need to load any more resources
|
||||
break;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
}
|
||||
catch (IOException e) {
|
||||
if (this.resolutionMethod == ResolutionMethod.FIRST_FOUND
|
||||
|| this.resolutionMethod == ResolutionMethod.OVERRIDE_AND_IGNORE) {
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("Could not load map from " + resource + ": "
|
||||
+ e.getMessage());
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
@@ -199,7 +201,8 @@ public class YamlProcessor {
|
||||
if (this.documentMatchers.isEmpty()) {
|
||||
logger.debug("Merging document (no matchers set)" + map);
|
||||
callback.process(properties, map);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
boolean valueFound = false;
|
||||
MatchStatus result = MatchStatus.ABSTAIN;
|
||||
for (DocumentMatcher matcher : this.documentMatchers) {
|
||||
@@ -216,7 +219,8 @@ public class YamlProcessor {
|
||||
if (result == MatchStatus.ABSTAIN && this.matchDefault) {
|
||||
logger.debug("Matched document with default matcher: " + map);
|
||||
callback.process(properties, map);
|
||||
} else if (!valueFound) {
|
||||
}
|
||||
else if (!valueFound) {
|
||||
logger.debug("Unmatched document");
|
||||
return false;
|
||||
}
|
||||
@@ -231,19 +235,22 @@ public class YamlProcessor {
|
||||
if (StringUtils.hasText(path)) {
|
||||
if (key.startsWith("[")) {
|
||||
key = path + key;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
key = path + "." + key;
|
||||
}
|
||||
}
|
||||
Object value = entry.getValue();
|
||||
if (value instanceof String) {
|
||||
properties.put(key, value);
|
||||
} else if (value instanceof Map) {
|
||||
}
|
||||
else if (value instanceof Map) {
|
||||
// Need a compound key
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> map = (Map<String, Object>) value;
|
||||
assignProperties(properties, map, key);
|
||||
} else if (value instanceof Collection) {
|
||||
}
|
||||
else if (value instanceof Collection) {
|
||||
// Need a compound key
|
||||
@SuppressWarnings("unchecked")
|
||||
Collection<Object> collection = (Collection<Object>) value;
|
||||
@@ -254,7 +261,8 @@ public class YamlProcessor {
|
||||
assignProperties(properties,
|
||||
Collections.singletonMap("[" + (count++) + "]", object), key);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
properties.put(key, value == null ? "" : value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,8 @@ abstract class AbstractOnBeanCondition implements ConfigurationCondition {
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,7 +117,8 @@ abstract class AbstractOnBeanCondition implements ConfigurationCondition {
|
||||
if (beans.length != 0) {
|
||||
beanClassesFound.add(beanClass);
|
||||
}
|
||||
} catch (ClassNotFoundException ex) {
|
||||
}
|
||||
catch (ClassNotFoundException ex) {
|
||||
}
|
||||
}
|
||||
for (String beanName : beanNames) {
|
||||
@@ -142,7 +144,8 @@ abstract class AbstractOnBeanCondition implements ConfigurationCondition {
|
||||
+ candidates);
|
||||
if (found.isEmpty()) {
|
||||
this.logger.debug(prefix + "Found no beans");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.logger.debug(prefix + "Found beans with " + type + ": " + found);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,10 +77,12 @@ public class ConfigurationPropertiesBindingConfiguration {
|
||||
|
||||
if (this.configurer != null) {
|
||||
propertySources = extractPropertySources(this.configurer);
|
||||
} else if (this.environment instanceof ConfigurableEnvironment) {
|
||||
}
|
||||
else if (this.environment instanceof ConfigurableEnvironment) {
|
||||
propertySources = flattenPropertySources(((ConfigurableEnvironment) this.environment)
|
||||
.getPropertySources());
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// empty, so not very useful, but fulfils the contract
|
||||
propertySources = new MutablePropertySources();
|
||||
}
|
||||
@@ -121,7 +123,8 @@ public class ConfigurationPropertiesBindingConfiguration {
|
||||
for (PropertySource<?> childSource : environment.getPropertySources()) {
|
||||
flattenPropertySources(childSource, result);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
result.addLast(propertySource);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,9 +113,11 @@ public class PropertySourcesBindingPostProcessor implements BeanPostProcessor,
|
||||
factory.setTargetName(targetName);
|
||||
try {
|
||||
target = factory.getObject(); // throwaway
|
||||
} catch (BeansException e) {
|
||||
}
|
||||
catch (BeansException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new BeanCreationException(beanName, "Could not bind", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -378,7 +378,8 @@ public abstract class AbstractEmbeddedServletContainerFactory implements
|
||||
path = path.substring(0, path.indexOf("!/"));
|
||||
}
|
||||
return new File(path);
|
||||
} catch (IOException e) {
|
||||
}
|
||||
catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,10 +131,12 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext
|
||||
EmbeddedServletContainerFactory containerFactory = getEmbeddedServletContainerFactory();
|
||||
this.embeddedServletContainer = containerFactory
|
||||
.getEmbeddedServletContainer(getSelfInitializer());
|
||||
} else if (getServletContext() != null) {
|
||||
}
|
||||
else if (getServletContext() != null) {
|
||||
try {
|
||||
getSelfInitializer().onStartup(getServletContext());
|
||||
} catch (ServletException e) {
|
||||
}
|
||||
catch (ServletException e) {
|
||||
throw new ApplicationContextException(
|
||||
"Cannot initialize servlet context", e);
|
||||
}
|
||||
@@ -280,12 +282,14 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext
|
||||
logger.info("Root WebApplicationContext: initialization completed in "
|
||||
+ elapsedTime + " ms");
|
||||
}
|
||||
} catch (RuntimeException ex) {
|
||||
}
|
||||
catch (RuntimeException ex) {
|
||||
logger.error("Context initialization failed", ex);
|
||||
servletContext.setAttribute(
|
||||
WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ex);
|
||||
throw ex;
|
||||
} catch (Error err) {
|
||||
}
|
||||
catch (Error err) {
|
||||
logger.error("Context initialization failed", err);
|
||||
servletContext.setAttribute(
|
||||
WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, err);
|
||||
@@ -312,7 +316,8 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext
|
||||
try {
|
||||
this.embeddedServletContainer.stop();
|
||||
this.embeddedServletContainer = null;
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,7 +244,8 @@ public class FilterRegistrationBean extends RegistrationBean {
|
||||
if (servletNames.isEmpty() && this.urlPatterns.isEmpty()) {
|
||||
registration.addMappingForUrlPatterns(dispatcherTypes, this.matchAfter,
|
||||
DEFAULT_URL_MAPPINGS);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (servletNames.size() > 0) {
|
||||
registration.addMappingForServletNames(dispatcherTypes, this.matchAfter,
|
||||
servletNames.toArray(new String[servletNames.size()]));
|
||||
|
||||
@@ -46,7 +46,8 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer {
|
||||
private synchronized void start() {
|
||||
try {
|
||||
this.server.start();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new EmbeddedServletContainerException(
|
||||
"Unable to start embedded Jetty servlet container", ex);
|
||||
}
|
||||
@@ -56,10 +57,12 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer {
|
||||
public synchronized void stop() {
|
||||
try {
|
||||
this.server.stop();
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
catch (InterruptedException ex) {
|
||||
Thread.currentThread().interrupt();
|
||||
// No drama
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new EmbeddedServletContainerException(
|
||||
"Unable to stop embedded Jetty servlet container", ex);
|
||||
}
|
||||
|
||||
@@ -132,7 +132,8 @@ public class JettyEmbeddedServletContainerFactory extends
|
||||
if (root != null) {
|
||||
try {
|
||||
handler.setBaseResource(Resource.newResource(root));
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
}
|
||||
}
|
||||
@@ -270,11 +271,13 @@ public class JettyEmbeddedServletContainerFactory extends
|
||||
if (errorPage.isGlobal()) {
|
||||
handler.addErrorPage(ErrorPageErrorHandler.GLOBAL_ERROR_PAGE,
|
||||
errorPage.getPath());
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (errorPage.getExceptionName() != null) {
|
||||
handler.addErrorPage(errorPage.getExceptionName(),
|
||||
errorPage.getPath());
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
handler.addErrorPage(errorPage.getStatusCode(),
|
||||
errorPage.getPath());
|
||||
}
|
||||
|
||||
@@ -52,7 +52,8 @@ public class ServletContextInitializerLifecycleListener implements LifecycleList
|
||||
for (ServletContextInitializer initializer : this.initializers) {
|
||||
try {
|
||||
initializer.onStartup(standardContext.getServletContext());
|
||||
} catch (ServletException ex) {
|
||||
}
|
||||
catch (ServletException ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,8 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer
|
||||
};
|
||||
awaitThread.setDaemon(false);
|
||||
awaitThread.start();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new EmbeddedServletContainerException(
|
||||
"Unable to start embdedded Tomcat", ex);
|
||||
}
|
||||
@@ -68,10 +69,12 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer
|
||||
try {
|
||||
try {
|
||||
this.tomcat.stop();
|
||||
} catch (LifecycleException e) {
|
||||
}
|
||||
catch (LifecycleException e) {
|
||||
}
|
||||
this.tomcat.destroy();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new EmbeddedServletContainerException(
|
||||
"Unable to stop embdedded Tomcat", ex);
|
||||
}
|
||||
|
||||
@@ -118,7 +118,8 @@ public class TomcatEmbeddedServletContainerFactory extends
|
||||
this.connector.setPort(getPort());
|
||||
this.tomcat.getService().addConnector(this.connector);
|
||||
this.tomcat.setConnector(this.connector);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
Connector connector = new Connector(
|
||||
"org.apache.coyote.http11.Http11NioProtocol");
|
||||
customizeConnector(connector);
|
||||
@@ -246,7 +247,8 @@ public class TomcatEmbeddedServletContainerFactory extends
|
||||
tempFolder.mkdir();
|
||||
tempFolder.deleteOnExit();
|
||||
return tempFolder;
|
||||
} catch (IOException ex) {
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new EmbeddedServletContainerException(
|
||||
"Unable to create Tomcat tempdir", ex);
|
||||
}
|
||||
|
||||
@@ -194,11 +194,13 @@ public class ConfigFileApplicationContextInitializer implements
|
||||
new PropertiesPropertySource(resource.getDescription(),
|
||||
properties));
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
propertySources.addFirst(new PropertiesPropertySource(resource
|
||||
.getDescription(), properties));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new IllegalStateException("Could not load properties file from "
|
||||
+ resource, e);
|
||||
}
|
||||
@@ -252,7 +254,8 @@ public class ConfigFileApplicationContextInitializer implements
|
||||
}
|
||||
// matches default profile
|
||||
return MatchStatus.FOUND;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return MatchStatus.NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,8 @@ public class ContextIdApplicationContextInitializer implements
|
||||
index = environment.getProperty("spring.application.index", Integer.class, index);
|
||||
if (index >= 0) {
|
||||
name = name + ":" + index;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// FIXME do we want this
|
||||
String profiles = StringUtils.arrayToCommaDelimitedString(environment
|
||||
.getActiveProfiles());
|
||||
|
||||
@@ -95,7 +95,8 @@ public class EnvironmentDelegateApplicationContextInitializer implements
|
||||
"class [" + className
|
||||
+ "] must implement ApplicationContextInitializer");
|
||||
classes.add((Class<ApplicationContextInitializer<ConfigurableApplicationContext>>) clazz);
|
||||
} catch (ClassNotFoundException ex) {
|
||||
}
|
||||
catch (ClassNotFoundException ex) {
|
||||
throw new ApplicationContextException(
|
||||
"Failed to load context initializer class [" + className
|
||||
+ "]", ex);
|
||||
|
||||
@@ -170,9 +170,11 @@ public class LoggingApplicationContextInitializer implements
|
||||
String configLocation = getConfigLocation(applicationContext);
|
||||
try {
|
||||
doInit(applicationContext, configLocation);
|
||||
} catch (RuntimeException ex) {
|
||||
}
|
||||
catch (RuntimeException ex) {
|
||||
throw ex;
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new IllegalStateException("Cannot initialize logging from "
|
||||
+ configLocation, ex);
|
||||
}
|
||||
|
||||
@@ -121,7 +121,8 @@ public class VcapApplicationContextInitializer implements
|
||||
CommandLinePropertySource.COMMAND_LINE_PROPERTY_SOURCE_NAME,
|
||||
new PropertiesPropertySource("vcap", properties));
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
propertySources.addFirst(new PropertiesPropertySource("vcap", properties));
|
||||
}
|
||||
|
||||
@@ -168,19 +169,22 @@ public class VcapApplicationContextInitializer implements
|
||||
if (StringUtils.hasText(path)) {
|
||||
if (key.startsWith("[")) {
|
||||
key = path + key;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
key = path + "." + key;
|
||||
}
|
||||
}
|
||||
Object value = entry.getValue();
|
||||
if (value instanceof String) {
|
||||
properties.put(key, value);
|
||||
} else if (value instanceof Map) {
|
||||
}
|
||||
else if (value instanceof Map) {
|
||||
// Need a compound key
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> map = (Map<String, Object>) value;
|
||||
flatten(properties, map, key);
|
||||
} else if (value instanceof Collection) {
|
||||
}
|
||||
else if (value instanceof Collection) {
|
||||
// Need a compound key
|
||||
@SuppressWarnings("unchecked")
|
||||
Collection<Object> collection = (Collection<Object>) value;
|
||||
@@ -191,7 +195,8 @@ public class VcapApplicationContextInitializer implements
|
||||
flatten(properties,
|
||||
Collections.singletonMap("[" + (count++) + "]", object), key);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
properties.put(key, value == null ? "" : value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,11 +40,14 @@ public abstract class JavaLoggerConfigurer {
|
||||
try {
|
||||
LogManager.getLogManager().readConfiguration(
|
||||
ResourceUtils.getURL(resolvedLocation).openStream());
|
||||
} catch (FileNotFoundException e) {
|
||||
}
|
||||
catch (FileNotFoundException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new IllegalArgumentException("Could not initialize logging from "
|
||||
+ location, e);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,8 @@ public abstract class LogbackConfigurer {
|
||||
context.stop();
|
||||
try {
|
||||
new ContextInitializer(context).configureByResource(url);
|
||||
} catch (JoranException e) {
|
||||
}
|
||||
catch (JoranException e) {
|
||||
throw new IllegalArgumentException("Could not initialize logging from "
|
||||
+ location, e);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,8 @@ public abstract class SpringServletInitializer implements WebApplicationInitiali
|
||||
// no-op because the application context is already initialized
|
||||
}
|
||||
});
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.logger
|
||||
.debug("No ContextLoaderListener registered, as "
|
||||
+ "createRootApplicationContext() did not return an application context");
|
||||
|
||||
@@ -361,7 +361,8 @@ public class SpringApplicationTests {
|
||||
this.sources = sources;
|
||||
if (this.useMockLoader) {
|
||||
this.loader = mock(BeanDefinitionLoader.class);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.loader = spy(super.createBeanDefinitionLoader(registry, sources));
|
||||
}
|
||||
return this.loader;
|
||||
|
||||
@@ -79,7 +79,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
|
||||
if (this.container != null) {
|
||||
try {
|
||||
this.container.stop();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -156,7 +157,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
date[0] = new Date();
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
catch (InterruptedException ex) {
|
||||
throw new ServletException(ex);
|
||||
}
|
||||
}
|
||||
@@ -249,7 +251,8 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
|
||||
ClientHttpResponse response = request.execute();
|
||||
try {
|
||||
return StreamUtils.copyToString(response.getBody(), Charset.forName("UTF-8"));
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
response.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,8 @@ public class EmbeddedServletContainerMvcIntegrationTests {
|
||||
public void closeContext() {
|
||||
try {
|
||||
this.context.close();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +91,8 @@ public class EmbeddedServletContainerMvcIntegrationTests {
|
||||
String actual = StreamUtils.copyToString(response.getBody(),
|
||||
Charset.forName("UTF-8"));
|
||||
assertThat(actual, equalTo("Hello World"));
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
response.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +132,8 @@ public class MockEmbeddedServletContainerFactory extends
|
||||
for (ServletContextInitializer initializer : this.initializers) {
|
||||
initializer.onStartup(this.servletContext);
|
||||
}
|
||||
} catch (ServletException ex) {
|
||||
}
|
||||
catch (ServletException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user