From 5410e6350b35347acefcf99ae59c1b9d9be4f7cb Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Mon, 9 Nov 2020 15:16:03 +0100 Subject: [PATCH] HHH-14317 Avoid closing datasource in AgroalConnectionProvider if datasource is not initialized --- .../hibernate/agroal/internal/AgroalConnectionProvider.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hibernate-agroal/src/main/java/org/hibernate/agroal/internal/AgroalConnectionProvider.java b/hibernate-agroal/src/main/java/org/hibernate/agroal/internal/AgroalConnectionProvider.java index 4db6f88c81..c53b6c66d3 100644 --- a/hibernate-agroal/src/main/java/org/hibernate/agroal/internal/AgroalConnectionProvider.java +++ b/hibernate-agroal/src/main/java/org/hibernate/agroal/internal/AgroalConnectionProvider.java @@ -139,6 +139,8 @@ public class AgroalConnectionProvider implements ConnectionProvider, Configurabl @Override public void stop() { - agroalDataSource.close(); + if ( agroalDataSource != null ) { + agroalDataSource.close(); + } } }