Add missing @Nullable annotations on parameters
Issue: SPR-15540
This commit is contained in:
@@ -25,6 +25,7 @@ import org.hibernate.SessionFactory;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.dao.DataAccessResourceFailureException;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.orm.hibernate5.SessionFactoryUtils;
|
||||
import org.springframework.orm.hibernate5.SessionHolder;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
@@ -130,7 +131,7 @@ public class OpenSessionInViewInterceptor implements AsyncWebRequestInterceptor
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postHandle(WebRequest request, ModelMap model) {
|
||||
public void postHandle(WebRequest request, @Nullable ModelMap model) {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -138,7 +139,7 @@ public class OpenSessionInViewInterceptor implements AsyncWebRequestInterceptor
|
||||
* @see TransactionSynchronizationManager
|
||||
*/
|
||||
@Override
|
||||
public void afterCompletion(WebRequest request, Exception ex) throws DataAccessException {
|
||||
public void afterCompletion(WebRequest request, @Nullable Exception ex) throws DataAccessException {
|
||||
if (!decrementParticipateCount(request)) {
|
||||
SessionHolder sessionHolder =
|
||||
(SessionHolder) TransactionSynchronizationManager.unbindResource(getSessionFactory());
|
||||
|
||||
@@ -300,7 +300,7 @@ public abstract class AbstractEntityManagerFactoryBean implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
public void setBeanClassLoader(@Nullable ClassLoader classLoader) {
|
||||
this.beanClassLoader = classLoader;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import javax.persistence.PersistenceException;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.jdbc.datasource.ConnectionHandle;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.InvalidIsolationLevelException;
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
import org.springframework.transaction.TransactionException;
|
||||
@@ -81,7 +82,7 @@ public class DefaultJpaDialect implements JpaDialect, Serializable {
|
||||
* @see #beginTransaction
|
||||
*/
|
||||
@Override
|
||||
public void cleanupTransaction(Object transactionData) {
|
||||
public void cleanupTransaction(@Nullable Object transactionData) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,6 +21,7 @@ import javax.persistence.PersistenceException;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.dao.DataAccessResourceFailureException;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.orm.jpa.EntityManagerFactoryAccessor;
|
||||
import org.springframework.orm.jpa.EntityManagerFactoryUtils;
|
||||
import org.springframework.orm.jpa.EntityManagerHolder;
|
||||
@@ -99,11 +100,11 @@ public class OpenEntityManagerInViewInterceptor extends EntityManagerFactoryAcce
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postHandle(WebRequest request, ModelMap model) {
|
||||
public void postHandle(WebRequest request, @Nullable ModelMap model) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(WebRequest request, Exception ex) throws DataAccessException {
|
||||
public void afterCompletion(WebRequest request, @Nullable Exception ex) throws DataAccessException {
|
||||
if (!decrementParticipateCount(request)) {
|
||||
EntityManagerHolder emHolder = (EntityManagerHolder)
|
||||
TransactionSynchronizationManager.unbindResource(getEntityManagerFactory());
|
||||
|
||||
@@ -200,7 +200,7 @@ public class HibernateJpaDialect extends DefaultJpaDialect {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanupTransaction(Object transactionData) {
|
||||
public void cleanupTransaction(@Nullable Object transactionData) {
|
||||
((SessionTransactionData) transactionData).resetSessionState();
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
@@ -69,7 +70,7 @@ public class PersistenceContextTransactionTests {
|
||||
@SuppressWarnings("serial")
|
||||
PersistenceAnnotationBeanPostProcessor pabpp = new PersistenceAnnotationBeanPostProcessor() {
|
||||
@Override
|
||||
protected EntityManagerFactory findEntityManagerFactory(String unitName, String requestingBeanName) {
|
||||
protected EntityManagerFactory findEntityManagerFactory(@Nullable String unitName, String requestingBeanName) {
|
||||
return factory;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.orm.jpa.AbstractEntityManagerFactoryBeanTests;
|
||||
import org.springframework.orm.jpa.DefaultJpaDialect;
|
||||
import org.springframework.orm.jpa.EntityManagerFactoryInfo;
|
||||
@@ -697,7 +698,7 @@ public class PersistenceInjectionTests extends AbstractEntityManagerFactoryBeanT
|
||||
private static class MockPersistenceAnnotationBeanPostProcessor extends PersistenceAnnotationBeanPostProcessor {
|
||||
|
||||
@Override
|
||||
protected EntityManagerFactory findEntityManagerFactory(String emfName, String requestingBeanName) {
|
||||
protected EntityManagerFactory findEntityManagerFactory(@Nullable String emfName, String requestingBeanName) {
|
||||
return mockEmf;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user