Skip to content

Commit 15bf4c5

Browse files
committed
fix possible NPE in race condition when creating Thymeleaf engine
1 parent 07b5b1b commit 15bf4c5

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/main/java/cool/solr/response/ThymeleafResponseWriter.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ public void inform(SolrCore core) {
6161
templateResolver.setResourceLoader(core.getResourceLoader());
6262

6363
// Clear all cached templates. There could be a new one and should be loaded on collection reload.
64-
if (templateEngine != null) {
65-
templateEngine.clearTemplateCache();
66-
}
64+
getEngine().clearTemplateCache();
6765
}
6866

6967
@Override
@@ -78,7 +76,7 @@ public void write(Writer writer, SolrQueryRequest request, SolrQueryResponse res
7876

7977
// When changing the templates we want a cleared cache
8078
if (request.getParams().getBool("tl.clearCache", false)) {
81-
templateEngine.clearTemplateCache();
79+
getEngine().clearTemplateCache();
8280
}
8381

8482
HttpServletRequest httpServletRequest = null;

0 commit comments

Comments
 (0)