Skip to content

Commit 0073ab0

Browse files
izeyesnicoll
authored andcommitted
Remove unnecessary if statement
1 parent a48296f commit 0073ab0

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchAutoConfiguration.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,14 @@ public void destroy() throws Exception {
100100
if (logger.isInfoEnabled()) {
101101
logger.info("Closing Elasticsearch client");
102102
}
103-
if (this.releasable != null) {
104-
try {
105-
this.releasable.close();
106-
}
107-
catch (NoSuchMethodError ex) {
108-
// Earlier versions of Elasticsearch had a different method name
109-
ReflectionUtils.invokeMethod(
110-
ReflectionUtils.findMethod(Releasable.class, "release"),
111-
this.releasable);
112-
}
103+
try {
104+
this.releasable.close();
105+
}
106+
catch (NoSuchMethodError ex) {
107+
// Earlier versions of Elasticsearch had a different method name
108+
ReflectionUtils.invokeMethod(
109+
ReflectionUtils.findMethod(Releasable.class, "release"),
110+
this.releasable);
113111
}
114112
}
115113
catch (final Exception ex) {

0 commit comments

Comments
 (0)