Skip to content

Commit 82b5147

Browse files
alidandachsnicoll
authored andcommitted
Use try-with-resources when applicable
See gh-32610
1 parent 2d40868 commit 82b5147

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

spring-jms/src/main/java/org/springframework/jms/connection/SingleConnectionFactory.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -575,14 +575,11 @@ protected void closeConnection(Connection con) {
575575
logger.debug("Closing shared JMS Connection: " + con);
576576
}
577577
try {
578-
try {
578+
try (con) {
579579
if (this.startedCount > 0) {
580580
con.stop();
581581
}
582582
}
583-
finally {
584-
con.close();
585-
}
586583
}
587584
catch (jakarta.jms.IllegalStateException ex) {
588585
logger.debug("Ignoring Connection state exception - assuming already closed: " + ex);

0 commit comments

Comments
 (0)