Polishing

This commit is contained in:
Juergen Hoeller
2020-08-27 15:33:08 +02:00
parent f7440884c9
commit 2891dc6409
21 changed files with 104 additions and 110 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2020 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.
@@ -63,7 +63,7 @@ public class MutablePersistenceUnitInfo implements SmartPersistenceUnitInfo {
private final List<String> mappingFileNames = new LinkedList<>();
private List<URL> jarFileUrls = new LinkedList<>();
private final List<URL> jarFileUrls = new LinkedList<>();
@Nullable
private URL persistenceUnitRootUrl;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2020 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.
@@ -23,7 +23,6 @@ import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -417,8 +416,7 @@ public class PersistenceAnnotationBeanPostProcessor
Class<?> targetClass = clazz;
do {
final LinkedList<InjectionMetadata.InjectedElement> currElements =
new LinkedList<>();
final List<InjectionMetadata.InjectedElement> currElements = new ArrayList<>();
ReflectionUtils.doWithLocalFields(targetClass, field -> {
if (field.isAnnotationPresent(PersistenceContext.class) ||
@@ -473,7 +471,7 @@ public class PersistenceAnnotationBeanPostProcessor
unitNameForLookup = this.defaultPersistenceUnitName;
}
String jndiName = this.persistenceUnits.get(unitNameForLookup);
if (jndiName == null && "".equals(unitNameForLookup) && this.persistenceUnits.size() == 1) {
if (jndiName == null && unitNameForLookup.isEmpty() && this.persistenceUnits.size() == 1) {
jndiName = this.persistenceUnits.values().iterator().next();
}
if (jndiName != null) {
@@ -506,7 +504,7 @@ public class PersistenceAnnotationBeanPostProcessor
unitNameForLookup = this.defaultPersistenceUnitName;
}
String jndiName = contexts.get(unitNameForLookup);
if (jndiName == null && "".equals(unitNameForLookup) && contexts.size() == 1) {
if (jndiName == null && unitNameForLookup.isEmpty() && contexts.size() == 1) {
jndiName = contexts.values().iterator().next();
}
if (jndiName != null) {