From 62d140ab23b733d2201d91083bd16d34d03e0972 Mon Sep 17 00:00:00 2001 From: pancx Date: Wed, 15 Jan 2025 17:01:59 +0800 Subject: [PATCH] [#6236] fix(core): fix possible resource leak in BaseCatalog fix possible resource leak in BaseCatalog. --- .../java/org/apache/gravitino/connector/BaseCatalog.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/apache/gravitino/connector/BaseCatalog.java b/core/src/main/java/org/apache/gravitino/connector/BaseCatalog.java index 14b1912b4d6..35fd0ba03e2 100644 --- a/core/src/main/java/org/apache/gravitino/connector/BaseCatalog.java +++ b/core/src/main/java/org/apache/gravitino/connector/BaseCatalog.java @@ -205,9 +205,8 @@ public void initAuthorizationPluginInstance(IsolatedClassLoader classLoader) { LOG.info("Authorization provider is not set!"); return; } - try { - BaseAuthorization authorization = - BaseAuthorization.createAuthorization(classLoader, authorizationProvider); + try (BaseAuthorization authorization = + BaseAuthorization.createAuthorization(classLoader, authorizationProvider)) { authorizationPlugin = authorization.newPlugin(entity.namespace().level(0), provider(), this.conf); } catch (Exception e) {