Polishing
This commit is contained in:
parent
be187babf9
commit
3726c6f18d
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2012 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.
|
||||
|
@ -71,7 +71,7 @@ public abstract class AbstractInterceptorDrivenBeanDefinitionDecorator implement
|
|||
BeanDefinition interceptorDefinition = createInterceptorDefinition(node);
|
||||
|
||||
// generate name and register the interceptor
|
||||
String interceptorName = existingBeanName + "." + getInterceptorNameSuffix(interceptorDefinition);
|
||||
String interceptorName = existingBeanName + '.' + getInterceptorNameSuffix(interceptorDefinition);
|
||||
BeanDefinitionReaderUtils.registerBeanDefinition(
|
||||
new BeanDefinitionHolder(interceptorDefinition, interceptorName), registry);
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
@ -246,7 +246,7 @@ public class CustomizableTraceInterceptor extends AbstractTraceInterceptor {
|
|||
*/
|
||||
@Override
|
||||
protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable {
|
||||
String name = invocation.getMethod().getDeclaringClass().getName() + "." + invocation.getMethod().getName();
|
||||
String name = ClassUtils.getQualifiedMethodName(invocation.getMethod());
|
||||
StopWatch stopWatch = new StopWatch(name);
|
||||
Object returnValue = null;
|
||||
boolean exitThroughException = false;
|
||||
|
|
|
@ -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.
|
||||
|
@ -21,6 +21,7 @@ import java.lang.reflect.Method;
|
|||
import java.util.Arrays;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
@ -129,8 +130,8 @@ public abstract class AbstractRegexpMethodPointcut extends StaticMethodMatcherPo
|
|||
*/
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
return ((targetClass != null && matchesPattern(targetClass.getName() + "." + method.getName())) ||
|
||||
matchesPattern(method.getDeclaringClass().getName() + "." + method.getName()));
|
||||
return ((targetClass != null && matchesPattern(ClassUtils.getQualifiedMethodName(method, targetClass))) ||
|
||||
matchesPattern(ClassUtils.getQualifiedMethodName(method)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,6 +40,7 @@ import org.springframework.beans.factory.support.MergedBeanDefinitionPostProcess
|
|||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.PriorityOrdered;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
/**
|
||||
|
@ -349,7 +350,7 @@ public class InitDestroyAnnotationBeanPostProcessor
|
|||
}
|
||||
this.method = method;
|
||||
this.identifier = (Modifier.isPrivate(method.getModifiers()) ?
|
||||
method.getDeclaringClass() + "." + method.getName() : method.getName());
|
||||
ClassUtils.getQualifiedMethodName(method) : method.getName());
|
||||
}
|
||||
|
||||
public Method getMethod() {
|
||||
|
|
|
@ -280,7 +280,7 @@ public abstract class YamlProcessor {
|
|||
key = path + key;
|
||||
}
|
||||
else {
|
||||
key = path + "." + key;
|
||||
key = path + '.' + key;
|
||||
}
|
||||
}
|
||||
Object value = entry.getValue();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2015 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.
|
||||
|
@ -98,7 +98,7 @@ public class EhCacheCache implements Cache {
|
|||
try {
|
||||
value = valueLoader.call();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
catch (Throwable ex) {
|
||||
throw new ValueRetrievalException(key, valueLoader, ex);
|
||||
}
|
||||
put(key, value);
|
||||
|
|
|
@ -652,6 +652,8 @@ public class SchedulerFactoryBean extends SchedulerAccessor implements FactoryBe
|
|||
logger.info("Will start Quartz Scheduler [" + scheduler.getSchedulerName() +
|
||||
"] in " + startupDelay + " seconds");
|
||||
}
|
||||
// Not using the Quartz startDelayed method since we explicitly want a daemon
|
||||
// thread here, not keeping the JVM alive in case of all other threads ending.
|
||||
Thread schedulerThread = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}));
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 + "]");
|
||||
}
|
||||
|
|
|
@ -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">
|
||||
* @Configuration
|
||||
* @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">
|
||||
* @Configuration
|
||||
* public class AnotherAppConfig {
|
||||
|
|
|
@ -241,7 +241,7 @@ public abstract class Conventions {
|
|||
public static String getQualifiedAttributeName(Class<?> enclosingClass, String attributeName) {
|
||||
Assert.notNull(enclosingClass, "'enclosingClass' must not be null");
|
||||
Assert.notNull(attributeName, "'attributeName' must not be null");
|
||||
return enclosingClass.getName() + "." + attributeName;
|
||||
return enclosingClass.getName() + '.' + attributeName;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ import org.springframework.core.io.support.ResourceRegion;
|
|||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.MimeType;
|
||||
import org.springframework.util.MimeTypeUtils;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
import org.springframework.util.StreamUtils;
|
||||
|
||||
/**
|
||||
|
@ -73,6 +72,7 @@ public class ResourceRegionEncoder extends AbstractEncoder<ResourceRegion> {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Flux<DataBuffer> encode(Publisher<? extends ResourceRegion> inputStream,
|
||||
DataBufferFactory bufferFactory, ResolvableType elementType, MimeType mimeType, Map<String, Object> hints) {
|
||||
|
||||
|
@ -138,10 +138,10 @@ public class ResourceRegionEncoder extends AbstractEncoder<ResourceRegion> {
|
|||
long end = start + region.getCount() - 1;
|
||||
OptionalLong contentLength = contentLength(region.getResource());
|
||||
if (contentLength.isPresent()) {
|
||||
return getAsciiBytes("Content-Range: bytes " + start + "-" + end + "/" + contentLength.getAsLong() + "\r\n\r\n");
|
||||
return getAsciiBytes("Content-Range: bytes " + start + '-' + end + '/' + contentLength.getAsLong() + "\r\n\r\n");
|
||||
}
|
||||
else {
|
||||
return getAsciiBytes("Content-Range: bytes " + start + "-" + end + "\r\n\r\n");
|
||||
return getAsciiBytes("Content-Range: bytes " + start + '-' + end + "\r\n\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2015 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.
|
||||
|
@ -30,6 +30,7 @@ import org.springframework.expression.spel.ExpressionState;
|
|||
import org.springframework.expression.spel.SpelEvaluationException;
|
||||
import org.springframework.expression.spel.SpelMessage;
|
||||
import org.springframework.expression.spel.support.ReflectionHelper;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
/**
|
||||
|
@ -103,8 +104,7 @@ public class FunctionReference extends SpelNodeImpl {
|
|||
// Only static methods can be called in this way
|
||||
if (!Modifier.isStatic(method.getModifiers())) {
|
||||
throw new SpelEvaluationException(getStartPosition(),
|
||||
SpelMessage.FUNCTION_MUST_BE_STATIC,
|
||||
method.getDeclaringClass().getName() + "." + method.getName(), this.name);
|
||||
SpelMessage.FUNCTION_MUST_BE_STATIC, ClassUtils.getQualifiedMethodName(method), this.name);
|
||||
}
|
||||
|
||||
argumentConversionOccurred = false;
|
||||
|
|
|
@ -105,7 +105,7 @@ public class StandardTypeLocator implements TypeLocator {
|
|||
}
|
||||
for (String prefix : this.knownPackagePrefixes) {
|
||||
try {
|
||||
nameToLookup = prefix + "." + typeName;
|
||||
nameToLookup = prefix + '.' + typeName;
|
||||
return ClassUtils.forName(nameToLookup, this.classLoader);
|
||||
}
|
||||
catch (ClassNotFoundException ex) {
|
||||
|
|
|
@ -316,8 +316,8 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
|
|||
String metaDataSchemaName = metaDataSchemaNameToUse(schemaName);
|
||||
String metaDataProcedureName = procedureNameToUse(procedureName);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Retrieving metadata for " + metaDataCatalogName + "/" +
|
||||
metaDataSchemaName + "/" + metaDataProcedureName);
|
||||
logger.debug("Retrieving metadata for " + metaDataCatalogName + '/' +
|
||||
metaDataSchemaName + '/' + metaDataProcedureName);
|
||||
}
|
||||
|
||||
ResultSet procs = null;
|
||||
|
@ -325,8 +325,8 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
|
|||
procs = databaseMetaData.getProcedures(metaDataCatalogName, metaDataSchemaName, metaDataProcedureName);
|
||||
List<String> found = new ArrayList<>();
|
||||
while (procs.next()) {
|
||||
found.add(procs.getString("PROCEDURE_CAT") + "." + procs.getString("PROCEDURE_SCHEM") +
|
||||
"." + procs.getString("PROCEDURE_NAME"));
|
||||
found.add(procs.getString("PROCEDURE_CAT") + '.' + procs.getString("PROCEDURE_SCHEM") +
|
||||
'.' + procs.getString("PROCEDURE_NAME"));
|
||||
}
|
||||
procs.close();
|
||||
|
||||
|
|
|
@ -371,8 +371,8 @@ public class GenericTableMetaDataProvider implements TableMetaDataProvider {
|
|||
String metaDataSchemaName = metaDataSchemaNameToUse(tmd.getSchemaName());
|
||||
String metaDataTableName = tableNameToUse(tmd.getTableName());
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Retrieving metadata for " + metaDataCatalogName + "/" +
|
||||
metaDataSchemaName + "/" + metaDataTableName);
|
||||
logger.debug("Retrieving metadata for " + metaDataCatalogName + '/' +
|
||||
metaDataSchemaName + '/' + metaDataTableName);
|
||||
}
|
||||
try {
|
||||
tableColumns = databaseMetaData.getColumns(
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2012 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.
|
||||
|
@ -112,7 +112,7 @@ public class JdbcBeanDefinitionReader {
|
|||
String property = rs.getString(2);
|
||||
String value = rs.getString(3);
|
||||
// Make a properties entry by combining bean name and property.
|
||||
props.setProperty(beanName + "." + property, value);
|
||||
props.setProperty(beanName + '.' + property, value);
|
||||
}
|
||||
});
|
||||
this.propReader.registerBeanDefinitions(props);
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.springframework.core.ParameterNameDiscoverer;
|
|||
import org.springframework.core.ResolvableType;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.handler.HandlerMethod;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
/**
|
||||
|
@ -106,15 +107,13 @@ public class InvocableHandlerMethod extends HandlerMethod {
|
|||
public Object invoke(Message<?> message, Object... providedArgs) throws Exception {
|
||||
Object[] args = getMethodArgumentValues(message, providedArgs);
|
||||
if (logger.isTraceEnabled()) {
|
||||
StringBuilder sb = new StringBuilder("Invoking [");
|
||||
sb.append(getBeanType().getSimpleName()).append(".");
|
||||
sb.append(getMethod().getName()).append("] method with arguments ");
|
||||
sb.append(Arrays.asList(args));
|
||||
logger.trace(sb.toString());
|
||||
logger.trace("Invoking '" + ClassUtils.getQualifiedMethodName(getMethod(), getBeanType()) +
|
||||
"' with arguments " + Arrays.toString(args));
|
||||
}
|
||||
Object returnValue = doInvoke(args);
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Method [" + getMethod().getName() + "] returned [" + returnValue + "]");
|
||||
logger.trace("Method [" + ClassUtils.getQualifiedMethodName(getMethod(), getBeanType()) +
|
||||
"] returned [" + returnValue + "]");
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
|
|
@ -133,13 +133,11 @@ public class SendToMethodReturnValueHandler implements HandlerMethodReturnValueH
|
|||
|
||||
@Override
|
||||
public boolean supportsReturnType(MethodParameter returnType) {
|
||||
if (returnType.hasMethodAnnotation(SendTo.class) ||
|
||||
return (returnType.hasMethodAnnotation(SendTo.class) ||
|
||||
AnnotatedElementUtils.hasAnnotation(returnType.getDeclaringClass(), SendTo.class) ||
|
||||
returnType.hasMethodAnnotation(SendToUser.class) ||
|
||||
AnnotatedElementUtils.hasAnnotation(returnType.getDeclaringClass(), SendToUser.class)) {
|
||||
return true;
|
||||
}
|
||||
return !this.annotationRequired;
|
||||
AnnotatedElementUtils.hasAnnotation(returnType.getDeclaringClass(), SendToUser.class) ||
|
||||
!this.annotationRequired);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -188,56 +186,34 @@ public class SendToMethodReturnValueHandler implements HandlerMethodReturnValueH
|
|||
}
|
||||
|
||||
private Object findAnnotation(MethodParameter returnType) {
|
||||
Annotation[] annot = new Annotation[4];
|
||||
annot[0] = AnnotatedElementUtils.findMergedAnnotation(returnType.getMethod(), SendToUser.class);
|
||||
annot[1] = AnnotatedElementUtils.findMergedAnnotation(returnType.getMethod(), SendTo.class);
|
||||
annot[2] = AnnotatedElementUtils.findMergedAnnotation(returnType.getDeclaringClass(), SendToUser.class);
|
||||
annot[3] = AnnotatedElementUtils.findMergedAnnotation(returnType.getDeclaringClass(), SendTo.class);
|
||||
Annotation[] anns = new Annotation[4];
|
||||
anns[0] = AnnotatedElementUtils.findMergedAnnotation(returnType.getMethod(), SendToUser.class);
|
||||
anns[1] = AnnotatedElementUtils.findMergedAnnotation(returnType.getMethod(), SendTo.class);
|
||||
anns[2] = AnnotatedElementUtils.findMergedAnnotation(returnType.getDeclaringClass(), SendToUser.class);
|
||||
anns[3] = AnnotatedElementUtils.findMergedAnnotation(returnType.getDeclaringClass(), SendTo.class);
|
||||
|
||||
if (annot[0] != null && !ObjectUtils.isEmpty(((SendToUser) annot[0]).value())) {
|
||||
return annot[0];
|
||||
if (anns[0] != null && !ObjectUtils.isEmpty(((SendToUser) anns[0]).value())) {
|
||||
return anns[0];
|
||||
}
|
||||
if (annot[1] != null && !ObjectUtils.isEmpty(((SendTo) annot[1]).value())) {
|
||||
return annot[1];
|
||||
if (anns[1] != null && !ObjectUtils.isEmpty(((SendTo) anns[1]).value())) {
|
||||
return anns[1];
|
||||
}
|
||||
if (annot[2] != null && !ObjectUtils.isEmpty(((SendToUser) annot[2]).value())) {
|
||||
return annot[2];
|
||||
if (anns[2] != null && !ObjectUtils.isEmpty(((SendToUser) anns[2]).value())) {
|
||||
return anns[2];
|
||||
}
|
||||
if (annot[3] != null && !ObjectUtils.isEmpty(((SendTo) annot[3]).value())) {
|
||||
return annot[3];
|
||||
if (anns[3] != null && !ObjectUtils.isEmpty(((SendTo) anns[3]).value())) {
|
||||
return anns[3];
|
||||
}
|
||||
|
||||
for (int i=0; i < 4; i++) {
|
||||
if (annot[i] != null) {
|
||||
return annot[i];
|
||||
if (anns[i] != null) {
|
||||
return anns[i];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private SendToUser getSendToUser(MethodParameter returnType) {
|
||||
SendToUser annot = AnnotatedElementUtils.findMergedAnnotation(returnType.getMethod(), SendToUser.class);
|
||||
if (annot != null && !ObjectUtils.isEmpty(annot.value())) {
|
||||
return annot;
|
||||
}
|
||||
SendToUser typeAnnot = AnnotatedElementUtils.findMergedAnnotation(returnType.getDeclaringClass(), SendToUser.class);
|
||||
if (typeAnnot != null && !ObjectUtils.isEmpty(typeAnnot.value())) {
|
||||
return typeAnnot;
|
||||
}
|
||||
return (annot != null ? annot : typeAnnot);
|
||||
}
|
||||
|
||||
private SendTo getSendTo(MethodParameter returnType) {
|
||||
SendTo sendTo = AnnotatedElementUtils.findMergedAnnotation(returnType.getMethod(), SendTo.class);
|
||||
if (sendTo != null && !ObjectUtils.isEmpty(sendTo.value())) {
|
||||
return sendTo;
|
||||
}
|
||||
else {
|
||||
return AnnotatedElementUtils.findMergedAnnotation(returnType.getDeclaringClass(), SendTo.class);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private PlaceholderResolver initVarResolver(MessageHeaders headers) {
|
||||
String name = DestinationVariableMethodArgumentResolver.DESTINATION_TEMPLATE_VARIABLES_HEADER;
|
||||
|
@ -268,7 +244,7 @@ public class SendToMethodReturnValueHandler implements HandlerMethodReturnValueH
|
|||
}
|
||||
|
||||
return (destination.startsWith("/") ?
|
||||
new String[] {defaultPrefix + destination} : new String[] {defaultPrefix + "/" + destination});
|
||||
new String[] {defaultPrefix + destination} : new String[] {defaultPrefix + '/' + destination});
|
||||
}
|
||||
|
||||
private MessageHeaders createHeaders(String sessionId, MethodParameter returnType) {
|
||||
|
|
|
@ -211,7 +211,7 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
|
|||
}
|
||||
trySetStompHeaderForSubscriptionId();
|
||||
if (getMessageId() == null) {
|
||||
String messageId = getSessionId() + "-" + messageIdCounter.getAndIncrement();
|
||||
String messageId = getSessionId() + '-' + messageIdCounter.getAndIncrement();
|
||||
setNativeHeader(STOMP_MESSAGE_ID_HEADER, messageId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public class MultiServerUserRegistry implements SimpUserRegistry, SmartApplicati
|
|||
catch (UnknownHostException ex) {
|
||||
host = "unknown";
|
||||
}
|
||||
return host + "-" + UUID.randomUUID();
|
||||
return host + '-' + UUID.randomUUID();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package org.springframework.test.context.transaction;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
@ -33,6 +32,7 @@ import org.springframework.transaction.annotation.TransactionManagementConfigure
|
|||
import org.springframework.transaction.interceptor.DelegatingTransactionAttribute;
|
||||
import org.springframework.transaction.interceptor.TransactionAttribute;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
|
@ -241,10 +241,9 @@ public abstract class TestContextTransactionUtils {
|
|||
|
||||
private final String name;
|
||||
|
||||
|
||||
public TestContextTransactionAttribute(TransactionAttribute targetAttribute, TestContext testContext) {
|
||||
super(targetAttribute);
|
||||
this.name = testContext.getTestClass().getName() + "." + testContext.getTestMethod().getName();
|
||||
this.name = ClassUtils.getQualifiedMethodName(testContext.getTestMethod(), testContext.getTestClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -105,7 +105,7 @@ public abstract class AbstractVersionStrategy implements VersionStrategy {
|
|||
}
|
||||
else {
|
||||
return (this.prefix.endsWith("/") || path.startsWith("/") ?
|
||||
this.prefix + path : this.prefix + "/" + path);
|
||||
this.prefix + path : this.prefix + '/' + path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ public abstract class AbstractVersionStrategy implements VersionStrategy {
|
|||
Matcher matcher = pattern.matcher(requestPath);
|
||||
if (matcher.find()) {
|
||||
String match = matcher.group(1);
|
||||
return (match.contains("-") ? match.substring(match.lastIndexOf("-") + 1) : match);
|
||||
return (match.contains("-") ? match.substring(match.lastIndexOf('-') + 1) : match);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
|
@ -140,7 +140,7 @@ public abstract class AbstractVersionStrategy implements VersionStrategy {
|
|||
public String addVersion(String requestPath, String version) {
|
||||
String baseFilename = StringUtils.stripFilenameExtension(requestPath);
|
||||
String extension = StringUtils.getFilenameExtension(requestPath);
|
||||
return (baseFilename + "-" + version + "." + extension);
|
||||
return (baseFilename + '-' + version + '.' + extension);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,13 +32,13 @@ import org.springframework.core.GenericTypeResolver;
|
|||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.core.ParameterNameDiscoverer;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.reactive.HandlerResult;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
|
||||
|
||||
/**
|
||||
* Extension of HandlerMethod that can invoke the target method after resolving
|
||||
* its method arguments.
|
||||
|
@ -160,22 +160,22 @@ public class InvocableHandlerMethod extends HandlerMethod {
|
|||
|
||||
private String getDetailedErrorMessage(String message, MethodParameter param) {
|
||||
StringBuilder sb = new StringBuilder(message);
|
||||
sb.append("argument [" + param.getParameterIndex() + "] ");
|
||||
sb.append("of type [" + param.getParameterType().getName() + "] ");
|
||||
sb.append("on method [" + getBridgedMethod().toGenericString() + "]");
|
||||
sb.append("argument [").append(param.getParameterIndex()).append("] ");
|
||||
sb.append("of type [").append(param.getParameterType().getName()).append("] ");
|
||||
sb.append("on method [").append(getBridgedMethod().toGenericString()).append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private Object doInvoke(Object[] args) throws Exception {
|
||||
if (logger.isTraceEnabled()) {
|
||||
String target = getBeanType().getSimpleName() + "." + getMethod().getName();
|
||||
logger.trace("Invoking [" + target + "] method with arguments " + Arrays.toString(args));
|
||||
logger.trace("Invoking '" + ClassUtils.getQualifiedMethodName(getMethod(), getBeanType()) +
|
||||
"' with arguments " + Arrays.toString(args));
|
||||
}
|
||||
ReflectionUtils.makeAccessible(getBridgedMethod());
|
||||
Object returnValue = getBridgedMethod().invoke(getBean(), args);
|
||||
if (logger.isTraceEnabled()) {
|
||||
String target = getBeanType().getSimpleName() + "." + getMethod().getName();
|
||||
logger.trace("Method [" + target + "] returned [" + returnValue + "]");
|
||||
logger.trace("Method [" + ClassUtils.getQualifiedMethodName(getMethod(), getBeanType()) +
|
||||
"] returned [" + returnValue + "]");
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ class ResourceRegionHttpMessageWriter extends EncoderHttpMessageWriter<ResourceR
|
|||
long start = region.getPosition();
|
||||
long end = start + region.getCount() - 1;
|
||||
end = Math.min(end, length - 1);
|
||||
outputMessage.getHeaders().add("Content-Range", "bytes " + start + "-" + end + "/" + length);
|
||||
outputMessage.getHeaders().add("Content-Range", "bytes " + start + '-' + end + '/' + length);
|
||||
outputMessage.getHeaders().setContentLength(end - start + 1);
|
||||
});
|
||||
outputMessage.getHeaders().setContentType(contentType);
|
||||
|
|
|
@ -128,7 +128,7 @@ public class ResourceRegionHttpMessageConverter extends AbstractGenericHttpMessa
|
|||
Long resourceLength = region.getResource().contentLength();
|
||||
end = Math.min(end, resourceLength - 1);
|
||||
long rangeLength = end - start + 1;
|
||||
responseHeaders.add("Content-Range", "bytes " + start + "-" + end + "/" + resourceLength);
|
||||
responseHeaders.add("Content-Range", "bytes " + start + '-' + end + '/' + resourceLength);
|
||||
responseHeaders.setContentLength(rangeLength);
|
||||
InputStream in = region.getResource().getInputStream();
|
||||
try {
|
||||
|
@ -167,7 +167,7 @@ public class ResourceRegionHttpMessageConverter extends AbstractGenericHttpMessa
|
|||
}
|
||||
Long resourceLength = region.getResource().contentLength();
|
||||
end = Math.min(end, resourceLength - 1);
|
||||
print(out, "Content-Range: bytes " + start + "-" + end + "/" + resourceLength);
|
||||
print(out, "Content-Range: bytes " + start + '-' + end + '/' + resourceLength);
|
||||
println(out);
|
||||
println(out);
|
||||
// Printing content
|
||||
|
|
|
@ -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.
|
||||
|
@ -182,7 +182,7 @@ public class HessianExporter extends RemoteExporter implements InitializingBean
|
|||
major = isToUse.read();
|
||||
minor = isToUse.read();
|
||||
if (major != 0x02) {
|
||||
throw new IOException("Version " + major + "." + minor + " is not understood");
|
||||
throw new IOException("Version " + major + '.' + minor + " is not understood");
|
||||
}
|
||||
in = new Hessian2Input(isToUse);
|
||||
out = new Hessian2Output(osToUse);
|
||||
|
|
|
@ -144,6 +144,7 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
|
|||
* Set whether the request payload (body) should be included in the log message.
|
||||
* <p>Should be configured using an {@code <init-param>} for parameter name
|
||||
* "includePayload" in the filter definition in {@code web.xml}.
|
||||
* @since 3.0
|
||||
*/
|
||||
public void setIncludePayload(boolean includePayload) {
|
||||
this.includePayload = includePayload;
|
||||
|
@ -151,6 +152,7 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
|
|||
|
||||
/**
|
||||
* Return whether the request payload (body) should be included in the log message.
|
||||
* @since 3.0
|
||||
*/
|
||||
protected boolean isIncludePayload() {
|
||||
return this.includePayload;
|
||||
|
@ -159,6 +161,7 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
|
|||
/**
|
||||
* Sets the maximum length of the payload body to be included in the log message.
|
||||
* Default is 50 characters.
|
||||
* @since 3.0
|
||||
*/
|
||||
public void setMaxPayloadLength(int maxPayloadLength) {
|
||||
Assert.isTrue(maxPayloadLength >= 0, "'maxPayloadLength' should be larger than or equal to 0");
|
||||
|
@ -167,6 +170,7 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
|
|||
|
||||
/**
|
||||
* Return the maximum length of the payload body to be included in the log message.
|
||||
* @since 3.0
|
||||
*/
|
||||
protected int getMaxPayloadLength() {
|
||||
return this.maxPayloadLength;
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.springframework.core.DefaultParameterNameDiscoverer;
|
|||
import org.springframework.core.GenericTypeResolver;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.core.ParameterNameDiscoverer;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.web.bind.WebDataBinder;
|
||||
import org.springframework.web.bind.support.SessionStatus;
|
||||
|
@ -127,15 +128,13 @@ public class InvocableHandlerMethod extends HandlerMethod {
|
|||
|
||||
Object[] args = getMethodArgumentValues(request, mavContainer, providedArgs);
|
||||
if (logger.isTraceEnabled()) {
|
||||
StringBuilder sb = new StringBuilder("Invoking [");
|
||||
sb.append(getBeanType().getSimpleName()).append(".");
|
||||
sb.append(getMethod().getName()).append("] method with arguments ");
|
||||
sb.append(Arrays.asList(args));
|
||||
logger.trace(sb.toString());
|
||||
logger.trace("Invoking '" + ClassUtils.getQualifiedMethodName(getMethod(), getBeanType()) +
|
||||
"' with arguments " + Arrays.toString(args));
|
||||
}
|
||||
Object returnValue = doInvoke(args);
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Method [" + getMethod().getName() + "] returned [" + returnValue + "]");
|
||||
logger.trace("Method [" + ClassUtils.getQualifiedMethodName(getMethod(), getBeanType()) +
|
||||
"] returned [" + returnValue + "]");
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
|
|
@ -641,7 +641,7 @@ public abstract class FrameworkServlet extends HttpServletBean implements Applic
|
|||
else {
|
||||
// Generate default id...
|
||||
wac.setId(ConfigurableWebApplicationContext.APPLICATION_CONTEXT_ID_PREFIX +
|
||||
ObjectUtils.getDisplayString(getServletContext().getContextPath()) + "/" + getServletName());
|
||||
ObjectUtils.getDisplayString(getServletContext().getContextPath()) + '/' + getServletName());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2015 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.
|
||||
|
@ -105,7 +105,7 @@ public abstract class AbstractVersionStrategy implements VersionStrategy {
|
|||
}
|
||||
else {
|
||||
return (this.prefix.endsWith("/") || path.startsWith("/") ?
|
||||
this.prefix + path : this.prefix + "/" + path);
|
||||
this.prefix + path : this.prefix + '/' + path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ public abstract class AbstractVersionStrategy implements VersionStrategy {
|
|||
Matcher matcher = pattern.matcher(requestPath);
|
||||
if (matcher.find()) {
|
||||
String match = matcher.group(1);
|
||||
return (match.contains("-") ? match.substring(match.lastIndexOf("-") + 1) : match);
|
||||
return (match.contains("-") ? match.substring(match.lastIndexOf('-') + 1) : match);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
|
@ -140,7 +140,7 @@ public abstract class AbstractVersionStrategy implements VersionStrategy {
|
|||
public String addVersion(String requestPath, String version) {
|
||||
String baseFilename = StringUtils.stripFilenameExtension(requestPath);
|
||||
String extension = StringUtils.getFilenameExtension(requestPath);
|
||||
return (baseFilename + "-" + version + "." + extension);
|
||||
return (baseFilename + '-' + version + '.' + extension);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -300,7 +300,7 @@ public class UrlTag extends HtmlEscapingAwareTag implements ParamAware {
|
|||
}
|
||||
}
|
||||
else {
|
||||
template = URL_TEMPLATE_DELIMITER_PREFIX + "/" + param.getName() + URL_TEMPLATE_DELIMITER_SUFFIX;
|
||||
template = URL_TEMPLATE_DELIMITER_PREFIX + '/' + param.getName() + URL_TEMPLATE_DELIMITER_SUFFIX;
|
||||
if (uri.contains(template)) {
|
||||
usedParams.add(param.getName());
|
||||
try {
|
||||
|
|
|
@ -179,7 +179,7 @@ public abstract class AbstractCachingViewResolver extends WebApplicationObjectSu
|
|||
* lead to a different view resource.
|
||||
*/
|
||||
protected Object getCacheKey(String viewName, Locale locale) {
|
||||
return viewName + "_" + locale;
|
||||
return viewName + '_' + locale;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -303,7 +303,7 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport
|
|||
for (MediaType requestedMediaType : requestedMediaTypes) {
|
||||
List<String> extensions = this.contentNegotiationManager.resolveFileExtensions(requestedMediaType);
|
||||
for (String extension : extensions) {
|
||||
String viewNameWithExtension = viewName + "." + extension;
|
||||
String viewNameWithExtension = viewName + '.' + extension;
|
||||
view = viewResolver.resolveViewName(viewNameWithExtension, locale);
|
||||
if (view != null) {
|
||||
candidateViews.add(view);
|
||||
|
|
|
@ -70,7 +70,7 @@ public class GroovyMarkupViewResolver extends AbstractTemplateViewResolver {
|
|||
*/
|
||||
@Override
|
||||
protected Object getCacheKey(String viewName, Locale locale) {
|
||||
return viewName + "_" + locale;
|
||||
return viewName + '_' + locale;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue