Skip to content

Commit

Permalink
[apache#6236] fix(core): fix possible resource leak in BaseCatalog
Browse files Browse the repository at this point in the history
fix  possible resource leak in BaseCatalog.
  • Loading branch information
Abyss-lord committed Jan 15, 2025
1 parent 1988569 commit 71c717a
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions core/src/main/java/org/apache/gravitino/connector/BaseCatalog.java
Original file line number Diff line number Diff line change
Expand Up @@ -205,18 +205,10 @@ public void initAuthorizationPluginInstance(IsolatedClassLoader classLoader) {
LOG.info("Authorization provider is not set!");
return;
}
try {
BaseAuthorization<?> authorization =
BaseAuthorization.createAuthorization(classLoader, authorizationProvider);

// Load the authorization plugin with the class loader of the catalog.
// Because the JDBC authorization plugin may load JDBC driver using the class loader.
try (BaseAuthorization<?> authorization =
BaseAuthorization.createAuthorization(classLoader, authorizationProvider)) {
authorizationPlugin =
classLoader.withClassLoader(
cl ->
authorization.newPlugin(
entity.namespace().level(0), provider(), this.conf));

authorization.newPlugin(entity.namespace().level(0), provider(), this.conf);
} catch (Exception e) {
LOG.error("Failed to load authorization with class loader", e);
throw new RuntimeException(e);
Expand Down

0 comments on commit 71c717a

Please sign in to comment.