From 922a17bce168aee9230e3a0af1b0f43e19a3723e Mon Sep 17 00:00:00 2001 From: "toby.tan" Date: Tue, 16 Apr 2024 09:20:36 +0800 Subject: [PATCH] fix NPE --- .../fabric8/kubernetes/client/utils/OpenIDConnectionUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/OpenIDConnectionUtils.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/OpenIDConnectionUtils.java index bf383fee55f..3629937bef8 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/OpenIDConnectionUtils.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/OpenIDConnectionUtils.java @@ -267,7 +267,7 @@ public static boolean persistKubeConfigWithUpdatedAuthInfo(Config currentConfig, if (namedAuthInfo.getUser() == null) { namedAuthInfo.setUser(authInfo); } else { - Optional.of(authInfo.getToken()).ifPresent(t -> namedAuthInfo.getUser().setToken(t)); + Optional.ofNullable(authInfo.getToken()).ifPresent(t -> namedAuthInfo.getUser().setToken(t)); namedAuthInfo.getUser().getAuthProvider().getConfig().putAll(authInfo.getAuthProvider().getConfig()); } // Persist changes to KUBECONFIG