From d58d41723efaaf152d12c0abe1956ca8a844d5f8 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Fri, 31 Oct 2025 18:39:38 -0400 Subject: [PATCH] Minor variable/function name and comment clean-ups --- .../security/krb5/native/NativeCacheTest.java | 28 +++++++++---------- .../native/libNativeCredentialCacheHelper.c | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/test/jdk/sun/security/krb5/native/NativeCacheTest.java b/test/jdk/sun/security/krb5/native/NativeCacheTest.java index 741d19d081c..7becb4218c8 100644 --- a/test/jdk/sun/security/krb5/native/NativeCacheTest.java +++ b/test/jdk/sun/security/krb5/native/NativeCacheTest.java @@ -64,17 +64,17 @@ import java.io.File; /** * Test JAAS access to in-memory credential caches. * - * This test validates that JAAS can access MEMORY: credential caches - * on Linux through the native enhancement, using real TGTs from OneKDC. + * This test validates that JAAS can access in-memory credential caches + * on Linux through the native enhancement, using TGTs from OneKDC. */ public class NativeCacheTest { public static void main(String[] args) throws Exception { try { - // Create real TGT using OneKDC (in isolated cache) - createRealTGTWithOneKDC(); + // Create TGT using OneKDC (in file cache) + createTGTWithOneKDC(); - // Copy real TGT to in-memory cache using JNI + // Copy TGT to in-memory cache using JNI String inMemoryCacheName = copyTGTToInMemoryCache(); // Test JAAS access to in-memory cache @@ -90,9 +90,9 @@ public class NativeCacheTest { } /** - * Use OneKDC to create a real TGT via the JAAS LoginModule + * Use OneKDC to create a TGT via the JAAS LoginModule */ - private static void createRealTGTWithOneKDC() throws Exception { + private static void createTGTWithOneKDC() throws Exception { System.out.println("Creating TGT via OneKDC"); OneKDC kdc = new OneKDC(null); @@ -120,7 +120,7 @@ public class NativeCacheTest { } /** - * Copy the real TGT to an in-memory cache using JNI + * Copy the TGT to an in-memory cache using JNI */ private static String copyTGTToInMemoryCache() throws Exception { System.out.println("Copying credentials to memory cache"); @@ -133,18 +133,18 @@ public class NativeCacheTest { } System.out.println("Created memory cache: " + memoryCacheName); - // Try to copy credentials from the saved cache file + // Try to copy credentials from the file cache boolean copied = false; - File savedCache = new File("onekdc_cache.ccache"); - if (savedCache.exists()) { - System.out.println("Copying from: " + savedCache.getAbsolutePath()); + File fileCache = new File("onekdc_cache.ccache"); + if (fileCache.exists()) { + System.out.println("Copying from: " + fileCache.getAbsolutePath()); copied = NativeCredentialCacheHelper.copyCredentialsToInMemoryCache( memoryCacheName, - "FILE:" + savedCache.getAbsolutePath() + "FILE:" + fileCache.getAbsolutePath() ); } - // Fallback to the default cache if the file cache doesn't exist + // Fallback to the default cache if copying from file cache fails if (!copied) { copied = NativeCredentialCacheHelper.copyCredentialsToInMemoryCache(memoryCacheName, null); } diff --git a/test/jdk/sun/security/krb5/native/libNativeCredentialCacheHelper.c b/test/jdk/sun/security/krb5/native/libNativeCredentialCacheHelper.c index 68df803aa2d..344f03a2706 100644 --- a/test/jdk/sun/security/krb5/native/libNativeCredentialCacheHelper.c +++ b/test/jdk/sun/security/krb5/native/libNativeCredentialCacheHelper.c @@ -180,7 +180,7 @@ JNIEXPORT jboolean JNICALL Java_NativeCredentialCacheHelper_copyCredentialsToInM source_cache_name ? source_cache_name : "default cache" ); - // Open source cache (default if sourceCacheName is null) + // Open source cache (or default cache if sourceCacheName is null) if (source_cache_name) { ret = krb5_cc_resolve(g_context, source_cache_name, &source_ccache); if (ret) {