Skip to content

Commit 45d2c3b

Browse files
committed
Merge pull request #38924 from skcskitano
* pr/38924: Fix connection leak in SqlDialectLookup Closes gh-38924
2 parents 748a80c + dc8b55c commit 45d2c3b

File tree

1 file changed

+1
-2
lines changed
  • spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq

1 file changed

+1
-2
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq/SqlDialectLookup.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ private SqlDialectLookup() {
4646
* @return the most suitable {@link SQLDialect}
4747
*/
4848
static SQLDialect getDialect(DataSource dataSource) {
49-
try {
50-
Connection connection = (dataSource != null) ? dataSource.getConnection() : null;
49+
try (Connection connection = (dataSource != null) ? dataSource.getConnection() : null) {
5150
return JDBCUtils.dialect(connection);
5251
}
5352
catch (SQLException ex) {

0 commit comments

Comments
 (0)