Nullability fine-tuning around declaration inconsistencies
Issue: SPR-15720 Issue: SPR-15792
This commit is contained in:
@@ -68,6 +68,7 @@ import org.springframework.util.Assert;
|
||||
@SuppressWarnings("serial")
|
||||
public class ConnectionSpecConnectionFactoryAdapter extends DelegatingConnectionFactory {
|
||||
|
||||
@Nullable
|
||||
private ConnectionSpec connectionSpec;
|
||||
|
||||
private final ThreadLocal<ConnectionSpec> threadBoundSpec =
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -35,11 +35,11 @@ import org.springframework.util.FileCopyUtils;
|
||||
@SuppressWarnings("serial")
|
||||
public class CommAreaRecord implements Record, Streamable {
|
||||
|
||||
private byte[] bytes;
|
||||
private byte[] bytes = new byte[0];
|
||||
|
||||
private String recordName;
|
||||
private String recordName = "";
|
||||
|
||||
private String recordShortDescription;
|
||||
private String recordShortDescription = "";
|
||||
|
||||
|
||||
/**
|
||||
@@ -60,22 +60,22 @@ public class CommAreaRecord implements Record, Streamable {
|
||||
|
||||
@Override
|
||||
public void setRecordName(String recordName) {
|
||||
this.recordName=recordName;
|
||||
this.recordName = recordName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecordName() {
|
||||
return recordName;
|
||||
return this.recordName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecordShortDescription(String recordShortDescription) {
|
||||
this.recordShortDescription=recordShortDescription;
|
||||
this.recordShortDescription = recordShortDescription;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecordShortDescription() {
|
||||
return recordShortDescription;
|
||||
return this.recordShortDescription;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -122,6 +122,7 @@ public class SpringContextResourceAdapter implements ResourceAdapter {
|
||||
|
||||
private String contextConfigLocation = DEFAULT_CONTEXT_CONFIG_LOCATION;
|
||||
|
||||
@Nullable
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
|
||||
@@ -208,7 +209,9 @@ public class SpringContextResourceAdapter implements ResourceAdapter {
|
||||
@Override
|
||||
public void stop() {
|
||||
logger.info("Stopping SpringContextResourceAdapter");
|
||||
this.applicationContext.close();
|
||||
if (this.applicationContext != null) {
|
||||
this.applicationContext.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -26,6 +26,8 @@ import org.aopalliance.intercept.MethodInvocation;
|
||||
|
||||
import org.springframework.aop.framework.ProxyFactory;
|
||||
import org.springframework.aop.support.DelegatingIntroductionInterceptor;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
/**
|
||||
@@ -52,6 +54,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
*/
|
||||
public class GenericMessageEndpointFactory extends AbstractMessageEndpointFactory {
|
||||
|
||||
@Nullable
|
||||
private Object messageListener;
|
||||
|
||||
|
||||
@@ -64,6 +67,15 @@ public class GenericMessageEndpointFactory extends AbstractMessageEndpointFactor
|
||||
this.messageListener = messageListener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the message listener object for this endpoint.
|
||||
* @since 5.0
|
||||
*/
|
||||
protected Object getMessageListener() {
|
||||
Assert.state(this.messageListener != null, "No message listener set");
|
||||
return this.messageListener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap each concrete endpoint instance with an AOP proxy,
|
||||
* exposing the message listener's interfaces as well as the
|
||||
@@ -72,7 +84,7 @@ public class GenericMessageEndpointFactory extends AbstractMessageEndpointFactor
|
||||
@Override
|
||||
public MessageEndpoint createEndpoint(XAResource xaResource) throws UnavailableException {
|
||||
GenericMessageEndpoint endpoint = (GenericMessageEndpoint) super.createEndpoint(xaResource);
|
||||
ProxyFactory proxyFactory = new ProxyFactory(this.messageListener);
|
||||
ProxyFactory proxyFactory = new ProxyFactory(getMessageListener());
|
||||
DelegatingIntroductionInterceptor introduction = new DelegatingIntroductionInterceptor(endpoint);
|
||||
introduction.suppressInterface(MethodInterceptor.class);
|
||||
proxyFactory.addAdvice(introduction);
|
||||
@@ -136,7 +148,7 @@ public class GenericMessageEndpointFactory extends AbstractMessageEndpointFactor
|
||||
|
||||
@Override
|
||||
protected ClassLoader getEndpointClassLoader() {
|
||||
return messageListener.getClass().getClassLoader();
|
||||
return getMessageListener().getClass().getClassLoader();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -19,6 +19,7 @@ package org.springframework.transaction.interceptor;
|
||||
import org.springframework.aop.ClassFilter;
|
||||
import org.springframework.aop.Pointcut;
|
||||
import org.springframework.aop.support.AbstractBeanFactoryPointcutAdvisor;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Advisor driven by a {@link TransactionAttributeSource}, used to include
|
||||
@@ -33,6 +34,7 @@ import org.springframework.aop.support.AbstractBeanFactoryPointcutAdvisor;
|
||||
@SuppressWarnings("serial")
|
||||
public class BeanFactoryTransactionAttributeSourceAdvisor extends AbstractBeanFactoryPointcutAdvisor {
|
||||
|
||||
@Nullable
|
||||
private TransactionAttributeSource transactionAttributeSource;
|
||||
|
||||
private final TransactionAttributeSourcePointcut pointcut = new TransactionAttributeSourcePointcut() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -91,6 +91,7 @@ public class DefaultTransactionAttribute extends DefaultTransactionDefinition im
|
||||
* @since 3.0
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public String getQualifier() {
|
||||
return this.qualifier;
|
||||
}
|
||||
|
||||
@@ -216,6 +216,7 @@ public class DefaultTransactionDefinition implements TransactionDefinition, Seri
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public final String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user