Polishing

(cherry picked from commit 3726c6f)
This commit is contained in:
Juergen Hoeller
2016-10-21 12:26:27 +02:00
parent adb9dc7ede
commit 9de28d640e
32 changed files with 86 additions and 105 deletions

View File

@@ -149,7 +149,7 @@ public class ConcurrentMapCache extends AbstractValueAdaptingCache {
try {
value = valueLoader.call();
}
catch (Exception ex) {
catch (Throwable ex) {
throw new ValueRetrievalException(key, valueLoader, ex);
}
put(key, value);

View File

@@ -266,7 +266,7 @@ public class ClassPathScanningCandidateComponentProvider implements EnvironmentC
Set<BeanDefinition> candidates = new LinkedHashSet<BeanDefinition>();
try {
String packageSearchPath = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX +
resolveBasePackage(basePackage) + "/" + this.resourcePattern;
resolveBasePackage(basePackage) + '/' + this.resourcePattern;
Resource[] resources = this.resourcePatternResolver.getResources(packageSearchPath);
boolean traceEnabled = logger.isTraceEnabled();
boolean debugEnabled = logger.isDebugEnabled();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2016 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.
@@ -142,7 +142,7 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor
group.add(entry.getKey(), bean);
}
}
if (phases.size() > 0) {
if (!phases.isEmpty()) {
List<Integer> keys = new ArrayList<Integer>(phases.keySet());
Collections.sort(keys);
for (Integer key : keys) {
@@ -195,7 +195,7 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor
}
group.add(entry.getKey(), bean);
}
if (phases.size() > 0) {
if (!phases.isEmpty()) {
List<Integer> keys = new ArrayList<Integer>(phases.keySet());
Collections.sort(keys, Collections.reverseOrder());
for (Integer key : keys) {

View File

@@ -43,12 +43,12 @@ public class StaticMessageSource extends AbstractMessageSource {
@Override
protected String resolveCodeWithoutArguments(String code, Locale locale) {
return this.messages.get(code + "_" + locale.toString());
return this.messages.get(code + '_' + locale.toString());
}
@Override
protected MessageFormat resolveCode(String code, Locale locale) {
String key = code + "_" + locale.toString();
String key = code + '_' + locale.toString();
String msg = this.messages.get(key);
if (msg == null) {
return null;
@@ -73,7 +73,7 @@ public class StaticMessageSource extends AbstractMessageSource {
Assert.notNull(code, "Code must not be null");
Assert.notNull(locale, "Locale must not be null");
Assert.notNull(msg, "Message must not be null");
this.messages.put(code + "_" + locale.toString(), msg);
this.messages.put(code + '_' + locale.toString(), msg);
if (logger.isDebugEnabled()) {
logger.debug("Added message [" + msg + "] for code [" + code + "] and Locale [" + locale + "]");
}