From f4ddaea56b7039ecf4e94273aa037e52da934de4 Mon Sep 17 00:00:00 2001 From: Tai Le Manh <49281946+tlm365@users.noreply.github.com> Date: Tue, 2 Jul 2024 07:23:30 +0700 Subject: [PATCH] Core: Handle potential NPE in RESTSessionCatalog#newSessionCache (#10607) Signed-off-by: Tai Le Manh --- .../java/org/apache/iceberg/rest/RESTSessionCatalog.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java b/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java index da40d4c3ae31..11a6aa6f27da 100644 --- a/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java +++ b/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java @@ -1049,7 +1049,12 @@ private static Cache newSessionCache(Map pr return Caffeine.newBuilder() .expireAfterAccess(Duration.ofMillis(expirationIntervalMs)) .removalListener( - (RemovalListener) (id, auth, cause) -> auth.stopRefreshing()) + (RemovalListener) + (id, auth, cause) -> { + if (auth != null) { + auth.stopRefreshing(); + } + }) .build(); }