Use consistent block style

Update all code to use a consistent block style.

Issue: SPR-16968
This commit is contained in:
Phillip Webb 2018-06-20 17:22:42 -07:00 committed by Juergen Hoeller
parent 04a8c285df
commit 866e9d702e
14 changed files with 111 additions and 44 deletions

View File

@ -69,11 +69,12 @@ public class ExposeInvocationInterceptor implements MethodInterceptor, PriorityO
*/
public static MethodInvocation currentInvocation() throws IllegalStateException {
MethodInvocation mi = invocation.get();
if (mi == null)
if (mi == null) {
throw new IllegalStateException(
"No MethodInvocation found: Check that an AOP invocation is in progress, and that the " +
"ExposeInvocationInterceptor is upfront in the interceptor chain. Specifically, note that " +
"advices with order HIGHEST_PRECEDENCE will execute before ExposeInvocationInterceptor!");
}
return mi;
}

View File

@ -371,8 +371,9 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
}
else if ("ref".equals(name)) {
String refName;
if (args[0] == null)
if (args[0] == null) {
throw new IllegalArgumentException("Argument to ref() is not a valid bean or was not found");
}
if (args[0] instanceof RuntimeBeanReference) {
refName = ((RuntimeBeanReference) args[0]).getBeanName();

View File

@ -211,8 +211,9 @@ class GroovyBeanDefinitionWrapper extends GroovyObjectSupport {
}
// factoryMethod
else if (FACTORY_METHOD.equals(property)) {
if (newValue != null)
if (newValue != null) {
bd.setFactoryMethodName(newValue.toString());
}
}
// initMethod
else if (INIT_METHOD.equals(property)) {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
@ -1124,33 +1124,79 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
AbstractBeanDefinition that = (AbstractBeanDefinition) other;
if (!ObjectUtils.nullSafeEquals(getBeanClassName(), that.getBeanClassName())) return false;
if (!ObjectUtils.nullSafeEquals(this.scope, that.scope)) return false;
if (this.abstractFlag != that.abstractFlag) return false;
if (this.lazyInit != that.lazyInit) return false;
if (!ObjectUtils.nullSafeEquals(getBeanClassName(), that.getBeanClassName())) {
return false;
}
if (!ObjectUtils.nullSafeEquals(this.scope, that.scope)) {
return false;
}
if (this.abstractFlag != that.abstractFlag) {
return false;
}
if (this.lazyInit != that.lazyInit) {
return false;
}
if (this.autowireMode != that.autowireMode) return false;
if (this.dependencyCheck != that.dependencyCheck) return false;
if (!Arrays.equals(this.dependsOn, that.dependsOn)) return false;
if (this.autowireCandidate != that.autowireCandidate) return false;
if (!ObjectUtils.nullSafeEquals(this.qualifiers, that.qualifiers)) return false;
if (this.primary != that.primary) return false;
if (this.autowireMode != that.autowireMode) {
return false;
}
if (this.dependencyCheck != that.dependencyCheck) {
return false;
}
if (!Arrays.equals(this.dependsOn, that.dependsOn)) {
return false;
}
if (this.autowireCandidate != that.autowireCandidate) {
return false;
}
if (!ObjectUtils.nullSafeEquals(this.qualifiers, that.qualifiers)) {
return false;
}
if (this.primary != that.primary) {
return false;
}
if (this.nonPublicAccessAllowed != that.nonPublicAccessAllowed) return false;
if (this.lenientConstructorResolution != that.lenientConstructorResolution) return false;
if (!ObjectUtils.nullSafeEquals(this.constructorArgumentValues, that.constructorArgumentValues)) return false;
if (!ObjectUtils.nullSafeEquals(this.propertyValues, that.propertyValues)) return false;
if (!ObjectUtils.nullSafeEquals(this.methodOverrides, that.methodOverrides)) return false;
if (this.nonPublicAccessAllowed != that.nonPublicAccessAllowed) {
return false;
}
if (this.lenientConstructorResolution != that.lenientConstructorResolution) {
return false;
}
if (!ObjectUtils.nullSafeEquals(this.constructorArgumentValues, that.constructorArgumentValues)) {
return false;
}
if (!ObjectUtils.nullSafeEquals(this.propertyValues, that.propertyValues)) {
return false;
}
if (!ObjectUtils.nullSafeEquals(this.methodOverrides, that.methodOverrides)) {
return false;
}
if (!ObjectUtils.nullSafeEquals(this.factoryBeanName, that.factoryBeanName)) return false;
if (!ObjectUtils.nullSafeEquals(this.factoryMethodName, that.factoryMethodName)) return false;
if (!ObjectUtils.nullSafeEquals(this.initMethodName, that.initMethodName)) return false;
if (this.enforceInitMethod != that.enforceInitMethod) return false;
if (!ObjectUtils.nullSafeEquals(this.destroyMethodName, that.destroyMethodName)) return false;
if (this.enforceDestroyMethod != that.enforceDestroyMethod) return false;
if (!ObjectUtils.nullSafeEquals(this.factoryBeanName, that.factoryBeanName)) {
return false;
}
if (!ObjectUtils.nullSafeEquals(this.factoryMethodName, that.factoryMethodName)) {
return false;
}
if (!ObjectUtils.nullSafeEquals(this.initMethodName, that.initMethodName)) {
return false;
}
if (this.enforceInitMethod != that.enforceInitMethod) {
return false;
}
if (!ObjectUtils.nullSafeEquals(this.destroyMethodName, that.destroyMethodName)) {
return false;
}
if (this.enforceDestroyMethod != that.enforceDestroyMethod) {
return false;
}
if (this.synthetic != that.synthetic) return false;
if (this.role != that.role) return false;
if (this.synthetic != that.synthetic) {
return false;
}
if (this.role != that.role) {
return false;
}
return super.equals(other);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
@ -137,8 +137,9 @@ public class CandidateComponentsIndexer implements Processor {
List<TypeElement> list = new ArrayList<>();
for (Element e : elements) {
if (TYPE_KINDS.contains(e.getKind())
&& e.getModifiers().contains(Modifier.STATIC))
&& e.getModifiers().contains(Modifier.STATIC)) {
list.add(TypeElement.class.cast(e));
}
}
return list;
}

View File

@ -143,8 +143,9 @@ public abstract class AbstractRefreshableApplicationContext extends AbstractAppl
@Override
protected void cancelRefresh(BeansException ex) {
synchronized (this.beanFactoryMonitor) {
if (this.beanFactory != null)
if (this.beanFactory != null) {
this.beanFactory.setSerializationId(null);
}
}
super.cancelRefresh(ex);
}

View File

@ -951,7 +951,9 @@ public class CodeFlow implements Opcodes {
int length = arraytype.length();
for (int i = 0; i < length; i++) {
char ch = arraytype.charAt(i);
if (ch == '[') continue;
if (ch == '[') {
continue;
}
return ch=='L';
}
return false;

View File

@ -92,10 +92,11 @@ public class GeneratedKeyHolder implements KeyHolder {
if (this.keyList.isEmpty()) {
return null;
}
if (this.keyList.size() > 1)
if (this.keyList.size() > 1) {
throw new InvalidDataAccessApiUsageException(
"The getKeys method should only be used when keys for a single row are returned. " +
"The current key list contains keys for multiple rows: " + this.keyList);
}
return this.keyList.get(0);
}

View File

@ -276,8 +276,9 @@ final class PersistenceUnitReader {
List<Element> classes = DomUtils.getChildElementsByTagName(persistenceUnit, MANAGED_CLASS_NAME);
for (Element element : classes) {
String value = DomUtils.getTextValue(element).trim();
if (StringUtils.hasText(value))
if (StringUtils.hasText(value)) {
unitInfo.addManagedClassName(value);
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2018 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.
@ -81,8 +81,12 @@ public enum Isolation {
private final int value;
Isolation(int value) { this.value = value; }
Isolation(int value) {
this.value = value;
}
public int value() { return this.value; }
public int value() {
return this.value;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2018 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.
@ -100,8 +100,12 @@ public enum Propagation {
private final int value;
Propagation(int value) { this.value = value; }
Propagation(int value) {
this.value = value;
}
public int value() { return this.value; }
public int value() {
return this.value;
}
}

View File

@ -507,9 +507,10 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
else {
// The TransactionInfo.hasTransaction() method will return false. We created it only
// to preserve the integrity of the ThreadLocal stack maintained in this class.
if (logger.isTraceEnabled())
if (logger.isTraceEnabled()) {
logger.trace("Don't need to create transaction for [" + joinpointIdentification +
"]: This method isn't transactional.");
}
}
// We always bind the TransactionInfo to the thread, even if we didn't create

View File

@ -187,7 +187,8 @@ class UndertowServerHttpRequest extends AbstractServerHttpRequest {
onAllDataRead();
}
return null;
} finally {
}
finally {
if (release && pooledByteBuffer.isOpen()) {
pooledByteBuffer.close();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
@ -66,8 +66,9 @@ class HtmlCharacterEntityDecoder {
this.originalMessage.indexOf('&', this.nextPotentialReferencePosition);
if (this.nextSemicolonPosition != -1 &&
this.nextSemicolonPosition < this.nextPotentialReferencePosition)
this.nextSemicolonPosition < this.nextPotentialReferencePosition) {
this.nextSemicolonPosition = this.originalMessage.indexOf(';', this.nextPotentialReferencePosition + 1);
}
boolean isPotentialReference = (this.nextPotentialReferencePosition != -1 &&
this.nextSemicolonPosition != -1 &&
@ -98,8 +99,9 @@ class HtmlCharacterEntityDecoder {
this.currentPosition = skipUntilIndex;
}
else {
while (this.currentPosition < skipUntilIndex)
while (this.currentPosition < skipUntilIndex) {
this.decodedMessage.append(this.originalMessage.charAt(this.currentPosition++));
}
}
}
}