Polishing

This commit is contained in:
Juergen Hoeller
2016-10-21 12:26:27 +02:00
parent be187babf9
commit 3726c6f18d
37 changed files with 104 additions and 120 deletions

View File

@@ -145,7 +145,7 @@ public class ConcurrentMapCache extends AbstractValueAdaptingCache {
try {
return toStoreValue(valueLoader.call());
}
catch (Exception ex) {
catch (Throwable ex) {
throw new ValueRetrievalException(key, valueLoader, ex);
}
}));

View File

@@ -335,7 +335,7 @@ public class ClassPathScanningCandidateComponentProvider implements EnvironmentC
Set<BeanDefinition> candidates = new LinkedHashSet<>();
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

@@ -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<>(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<>(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 + "]");
}

View File

@@ -32,7 +32,9 @@ import org.springframework.core.Ordered;
* Enables Spring's asynchronous method execution capability, similar to functionality
* found in Spring's {@code <task:*>} XML namespace.
*
* <p>To be used together with @{@link Configuration Configuration} classes as follows:
* <p>To be used together with @{@link Configuration Configuration} classes as follows,
* enabling annotation-driven async processing for an entire Spring application context:
*
* <pre class="code">
* &#064;Configuration
* &#064;EnableAsync
@@ -45,6 +47,7 @@ import org.springframework.core.Ordered;
* annotation, or any custom annotation specified via the {@link #annotation} attribute.
* The aspect is added transparently for any registered bean, for instance via this
* configuration:
*
* <pre class="code">
* &#064;Configuration
* public class AnotherAppConfig {