Consistent formatting

This commit is contained in:
Juergen Hoeller
2016-03-24 19:54:28 +01:00
parent 2ea7fcde3e
commit 0891fbaf97
14 changed files with 40 additions and 37 deletions

View File

@@ -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 AspectJAfterReturningAdvice extends AbstractAspectJAdvice implement
else if (Object.class == type && void.class == method.getReturnType()) {
return true;
}
else{
else {
return ClassUtils.isAssignable(type, method.getReturnType());
}
}

View File

@@ -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.
@@ -204,7 +204,7 @@ public class FieldRetrievingFactoryBean
// instance field
return this.fieldObject.get(this.targetObject);
}
else{
else {
// class field
return this.fieldObject.get(null);
}

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.
@@ -36,20 +36,21 @@ import org.springframework.beans.factory.parsing.ReaderEventListener;
*/
public class CollectingReaderEventListener implements ReaderEventListener {
private final List defaults = new LinkedList();
private final List<DefaultsDefinition> defaults = new LinkedList<>();
private final Map componentDefinitions = new LinkedHashMap<>(8);
private final Map<String, ComponentDefinition> componentDefinitions = new LinkedHashMap<>(8);
private final Map aliasMap = new LinkedHashMap<>(8);
private final Map<String, List<AliasDefinition>> aliasMap = new LinkedHashMap<>(8);
private final List<ImportDefinition> imports = new LinkedList<>();
private final List imports = new LinkedList();
@Override
public void defaultsRegistered(DefaultsDefinition defaultsDefinition) {
this.defaults.add(defaultsDefinition);
}
public List getDefaults() {
public List<DefaultsDefinition> getDefaults() {
return Collections.unmodifiableList(this.defaults);
}
@@ -59,27 +60,27 @@ public class CollectingReaderEventListener implements ReaderEventListener {
}
public ComponentDefinition getComponentDefinition(String name) {
return (ComponentDefinition) this.componentDefinitions.get(name);
return this.componentDefinitions.get(name);
}
public ComponentDefinition[] getComponentDefinitions() {
Collection collection = this.componentDefinitions.values();
return (ComponentDefinition[]) collection.toArray(new ComponentDefinition[collection.size()]);
Collection<ComponentDefinition> collection = this.componentDefinitions.values();
return collection.toArray(new ComponentDefinition[collection.size()]);
}
@Override
public void aliasRegistered(AliasDefinition aliasDefinition) {
List aliases = (List) this.aliasMap.get(aliasDefinition.getBeanName());
if(aliases == null) {
aliases = new ArrayList();
List<AliasDefinition> aliases = this.aliasMap.get(aliasDefinition.getBeanName());
if (aliases == null) {
aliases = new ArrayList<>();
this.aliasMap.put(aliasDefinition.getBeanName(), aliases);
}
aliases.add(aliasDefinition);
}
public List getAliases(String beanName) {
List aliases = (List) this.aliasMap.get(beanName);
return aliases == null ? null : Collections.unmodifiableList(aliases);
public List<AliasDefinition> getAliases(String beanName) {
List<AliasDefinition> aliases = this.aliasMap.get(beanName);
return (aliases != null ? Collections.unmodifiableList(aliases) : null);
}
@Override
@@ -87,7 +88,7 @@ public class CollectingReaderEventListener implements ReaderEventListener {
this.imports.add(importDefinition);
}
public List getImports() {
public List<ImportDefinition> getImports() {
return Collections.unmodifiableList(this.imports);
}

View File

@@ -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.
@@ -127,7 +127,7 @@ public abstract class DigestUtils {
((UpdateMessageDigestInputStream) inputStream).updateMessageDigest(messageDigest);
return messageDigest.digest();
}
else{
else {
return messageDigest.digest(StreamUtils.copyToByteArray(inputStream));
}
}

View File

@@ -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.
@@ -180,7 +180,7 @@ public class MimeType implements Comparable<MimeType>, Serializable {
* @see <a href="http://tools.ietf.org/html/rfc2616#section-2.2">HTTP 1.1, section 2.2</a>
*/
private void checkToken(String token) {
for (int i=0; i < token.length(); i++ ) {
for (int i = 0; i < token.length(); i++ ) {
char ch = token.charAt(i);
if (!TOKEN.get(ch)) {
throw new IllegalArgumentException("Invalid token character '" + ch + "' in token \"" + token + "\"");

View File

@@ -51,7 +51,7 @@ public class Matchers {
@Override
public boolean matches(Object item) {
Throwable cause = null;
if(item != null && item instanceof Throwable) {
if (item != null && item instanceof Throwable) {
cause = ((Throwable)item).getCause();
}
return matcher.matches(cause);

View File

@@ -93,7 +93,8 @@ public enum TestGroup {
for (String group : value.split(",")) {
try {
groups.add(valueOf(group.trim().toUpperCase()));
} catch (IllegalArgumentException e) {
}
catch (IllegalArgumentException ex) {
throw new IllegalArgumentException(format(
"Unable to find test group '%s' when parsing testGroups value: '%s'. " +
"Available groups include: [%s]", group.trim(), value,

View File

@@ -918,7 +918,7 @@ public class CodeFlow implements Opcodes {
*/
public static boolean isReferenceTypeArray(String arraytype) {
int length = arraytype.length();
for (int i=0;i<length;i++) {
for (int i = 0; i < length; i++) {
char ch = arraytype.charAt(i);
if (ch == '[') continue;
return ch=='L';

View File

@@ -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.
@@ -1038,7 +1038,8 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
result[i] = rowsAffected.get(i);
}
return result;
} finally {
}
finally {
if (pss instanceof ParameterDisposer) {
((ParameterDisposer) pss).cleanupParameters();
}

View File

@@ -123,7 +123,7 @@ public class UrlBasedCorsConfigurationSource implements CorsConfigurationSource
@Override
public CorsConfiguration getCorsConfiguration(HttpServletRequest request) {
String lookupPath = this.urlPathHelper.getLookupPathForRequest(request);
for(Map.Entry<String, CorsConfiguration> entry : this.corsConfigurations.entrySet()) {
for (Map.Entry<String, CorsConfiguration> entry : this.corsConfigurations.entrySet()) {
if (this.pathMatcher.match(entry.getKey(), lookupPath)) {
return entry.getValue();
}

View File

@@ -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.
@@ -288,7 +288,7 @@ final class HierarchicalUriComponents extends UriComponents {
return;
}
int length = source.length();
for (int i=0; i < length; i++) {
for (int i = 0; i < length; i++) {
char ch = source.charAt(i);
if (ch == '%') {
if ((i + 2) < length) {
@@ -701,9 +701,9 @@ final class HierarchicalUriComponents extends UriComponents {
public int hashCode() {
return getPath().hashCode();
}
}
/**
* Represents a path backed by a string list (i.e. path segments).
*/

View File

@@ -218,7 +218,7 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
if (!matchingPatterns.isEmpty()) {
Comparator<String> patternComparator = getPathMatcher().getPatternComparator(lookupPath);
Collections.sort(matchingPatterns, patternComparator);
for(String pattern : matchingPatterns) {
for (String pattern : matchingPatterns) {
String pathWithinMapping = getPathMatcher().extractPathWithinPattern(pattern, lookupPath);
String pathMapping = lookupPath.substring(0, lookupPath.indexOf(pathWithinMapping));
if (logger.isTraceEnabled()) {

View File

@@ -123,9 +123,9 @@ public class VersionResourceResolver extends AbstractResourceResolver {
List<String> patternsList = Arrays.asList(pathPatterns);
List<String> prefixedPatterns = new ArrayList<String>(pathPatterns.length);
String versionPrefix = "/" + version;
for(String pattern : patternsList) {
for (String pattern : patternsList) {
prefixedPatterns.add(pattern);
if(!pattern.startsWith(versionPrefix) && !patternsList.contains(versionPrefix + pattern)) {
if (!pattern.startsWith(versionPrefix) && !patternsList.contains(versionPrefix + pattern)) {
prefixedPatterns.add(versionPrefix + pattern);
}
}

View File

@@ -32,7 +32,7 @@ public abstract class AbstractSockJsMessageCodec implements SockJsMessageCodec {
Assert.notNull(messages, "messages must not be null");
StringBuilder sb = new StringBuilder();
sb.append("a[");
for (int i=0; i < messages.length; i++) {
for (int i = 0; i < messages.length; i++) {
sb.append('"');
char[] quotedChars = applyJsonQuoting(messages[i]);
sb.append(escapeSockJsSpecialChars(quotedChars));