Commit 56544c8d authored by Phillip Webb's avatar Phillip Webb

Polish

parent a3c63b9c
...@@ -69,7 +69,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter ...@@ -69,7 +69,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
@Import(DataSourceInitializedPublisher.Registrar.class) @Import(DataSourceInitializedPublisher.Registrar.class)
public abstract class JpaBaseConfiguration implements BeanFactoryAware { public abstract class JpaBaseConfiguration implements BeanFactoryAware {
private final Log logger = LogFactory.getLog(getClass()); private static final Log logger = LogFactory.getLog(JpaBaseConfiguration.class);
private final DataSource dataSource; private final DataSource dataSource;
...@@ -197,8 +197,8 @@ public abstract class JpaBaseConfiguration implements BeanFactoryAware { ...@@ -197,8 +197,8 @@ public abstract class JpaBaseConfiguration implements BeanFactoryAware {
return ResourceUtils.extractJarFileURL(url); return ResourceUtils.extractJarFileURL(url);
} }
catch (Exception ex) { catch (Exception ex) {
logger.info("Could not determine persistence " logger.info("Could not determine persistence " + "unit root location from "
+ "unit root location from " + source + " : " + ex); + source + " : " + ex);
} }
return null; return null;
} }
......
...@@ -37,7 +37,7 @@ abstract class AbstractTemplateResolverConfiguration { ...@@ -37,7 +37,7 @@ abstract class AbstractTemplateResolverConfiguration {
private static final Log logger = LogFactory private static final Log logger = LogFactory
.getLog(AbstractTemplateResolverConfiguration.class); .getLog(AbstractTemplateResolverConfiguration.class);
protected final ThymeleafProperties properties; private final ThymeleafProperties properties;
private final ApplicationContext applicationContext; private final ApplicationContext applicationContext;
...@@ -47,6 +47,10 @@ abstract class AbstractTemplateResolverConfiguration { ...@@ -47,6 +47,10 @@ abstract class AbstractTemplateResolverConfiguration {
this.applicationContext = applicationContext; this.applicationContext = applicationContext;
} }
protected final ThymeleafProperties getProperties() {
return this.properties;
}
@PostConstruct @PostConstruct
public void checkTemplateLocationExists() { public void checkTemplateLocationExists() {
boolean checkTemplateLocation = this.properties.isCheckTemplateLocation(); boolean checkTemplateLocation = this.properties.isCheckTemplateLocation();
......
...@@ -137,9 +137,10 @@ public class ThymeleafAutoConfiguration { ...@@ -137,9 +137,10 @@ public class ThymeleafAutoConfiguration {
@Override @Override
public SpringResourceTemplateResolver defaultTemplateResolver() { public SpringResourceTemplateResolver defaultTemplateResolver() {
SpringResourceTemplateResolver resolver = super.defaultTemplateResolver(); SpringResourceTemplateResolver resolver = super.defaultTemplateResolver();
Method setCheckExistence = ReflectionUtils Method setCheckExistence = ReflectionUtils.findMethod(resolver.getClass(),
.findMethod(resolver.getClass(), "setCheckExistence", boolean.class); "setCheckExistence", boolean.class);
ReflectionUtils.invokeMethod(setCheckExistence, resolver, this.properties.isCheckTemplate()); ReflectionUtils.invokeMethod(setCheckExistence, resolver,
getProperties().isCheckTemplate());
return resolver; return resolver;
} }
......
...@@ -109,7 +109,7 @@ public class ThymeleafProperties { ...@@ -109,7 +109,7 @@ public class ThymeleafProperties {
} }
public boolean isCheckTemplate() { public boolean isCheckTemplate() {
return checkTemplate; return this.checkTemplate;
} }
public void setCheckTemplate(boolean checkTemplate) { public void setCheckTemplate(boolean checkTemplate) {
......
...@@ -68,7 +68,7 @@ public class MultipartAutoConfiguration { ...@@ -68,7 +68,7 @@ public class MultipartAutoConfiguration {
@ConditionalOnMissingBean(MultipartResolver.class) @ConditionalOnMissingBean(MultipartResolver.class)
public StandardServletMultipartResolver multipartResolver() { public StandardServletMultipartResolver multipartResolver() {
StandardServletMultipartResolver multipartResolver = new StandardServletMultipartResolver(); StandardServletMultipartResolver multipartResolver = new StandardServletMultipartResolver();
multipartResolver.setResolveLazily(multipartProperties.isResolveLazily()); multipartResolver.setResolveLazily(this.multipartProperties.isResolveLazily());
return multipartResolver; return multipartResolver;
} }
......
...@@ -123,7 +123,7 @@ public class MultipartProperties { ...@@ -123,7 +123,7 @@ public class MultipartProperties {
} }
public boolean isResolveLazily() { public boolean isResolveLazily() {
return resolveLazily; return this.resolveLazily;
} }
public void setResolveLazily(boolean resolveLazily) { public void setResolveLazily(boolean resolveLazily) {
......
...@@ -264,7 +264,7 @@ ...@@ -264,7 +264,7 @@
<dependency> <dependency>
<groupId>com.puppycrawl.tools</groupId> <groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId> <artifactId>checkstyle</artifactId>
<version>6.17</version> <version>7.1.1</version>
</dependency> </dependency>
</dependencies> </dependencies>
</plugin> </plugin>
......
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
<module name="com.puppycrawl.tools.checkstyle.checks.coding.MultipleVariableDeclarationsCheck" /> <module name="com.puppycrawl.tools.checkstyle.checks.coding.MultipleVariableDeclarationsCheck" />
<module name="com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck"> <module name="com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck">
<property name="checkMethods" value="false" /> <property name="checkMethods" value="false" />
<property name="validateOnlyOverlapping" value="false" />
</module> </module>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.OneStatementPerLineCheck" /> <module name="com.puppycrawl.tools.checkstyle.checks.coding.OneStatementPerLineCheck" />
......
...@@ -260,10 +260,10 @@ public class RandomAccessDataFile implements RandomAccessData { ...@@ -260,10 +260,10 @@ public class RandomAccessDataFile implements RandomAccessData {
public void close() throws IOException { public void close() throws IOException {
this.available.acquireUninterruptibly(this.size); this.available.acquireUninterruptibly(this.size);
try { try {
RandomAccessFile file = this.files.poll(); RandomAccessFile pooledFile = this.files.poll();
while (file != null) { while (pooledFile != null) {
file.close(); pooledFile.close();
file = this.files.poll(); pooledFile = this.files.poll();
} }
} }
finally { finally {
......
...@@ -158,12 +158,12 @@ public class Handler extends URLStreamHandler { ...@@ -158,12 +158,12 @@ public class Handler extends URLStreamHandler {
String path = name.substring(FILE_PROTOCOL.length()); String path = name.substring(FILE_PROTOCOL.length());
File file = new File(URLDecoder.decode(path, "UTF-8")); File file = new File(URLDecoder.decode(path, "UTF-8"));
Map<File, JarFile> cache = rootFileCache.get(); Map<File, JarFile> cache = rootFileCache.get();
JarFile jarFile = (cache == null ? null : cache.get(file)); JarFile result = (cache == null ? null : cache.get(file));
if (jarFile == null) { if (result == null) {
jarFile = new JarFile(file); result = new JarFile(file);
addToRootFileCache(file, jarFile); addToRootFileCache(file, result);
} }
return jarFile; return result;
} }
catch (Exception ex) { catch (Exception ex) {
throw new IOException("Unable to open root Jar file '" + name + "'", ex); throw new IOException("Unable to open root Jar file '" + name + "'", ex);
......
...@@ -54,14 +54,12 @@ class TomcatErrorPage { ...@@ -54,14 +54,12 @@ class TomcatErrorPage {
} }
private Object createNativePage(ErrorPage errorPage) { private Object createNativePage(ErrorPage errorPage) {
Object nativePage = null;
try { try {
if (ClassUtils.isPresent(ERROR_PAGE_CLASS, null)) { if (ClassUtils.isPresent(ERROR_PAGE_CLASS, null)) {
nativePage = BeanUtils return BeanUtils.instantiate(ClassUtils.forName(ERROR_PAGE_CLASS, null));
.instantiate(ClassUtils.forName(ERROR_PAGE_CLASS, null));
} }
else if (ClassUtils.isPresent(LEGACY_ERROR_PAGE_CLASS, null)) { if (ClassUtils.isPresent(LEGACY_ERROR_PAGE_CLASS, null)) {
nativePage = BeanUtils return BeanUtils
.instantiate(ClassUtils.forName(LEGACY_ERROR_PAGE_CLASS, null)); .instantiate(ClassUtils.forName(LEGACY_ERROR_PAGE_CLASS, null));
} }
} }
...@@ -71,7 +69,7 @@ class TomcatErrorPage { ...@@ -71,7 +69,7 @@ class TomcatErrorPage {
catch (LinkageError ex) { catch (LinkageError ex) {
// Swallow and continue // Swallow and continue
} }
return nativePage; return null;
} }
public void addToContext(Context context) { public void addToContext(Context context) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment