roryqi commented on code in PR #11155:
URL: https://github.com/apache/gravitino/pull/11155#discussion_r3272404267


##########
core/src/test/java/org/apache/gravitino/credential/TestJdbcCredentialProvider.java:
##########
@@ -154,9 +155,9 @@ void testEmptyPasswordReturnsNull() {
         CredentialProviderFactory.create(JdbcCredential.JDBC_CREDENTIAL_TYPE, 
catalogProperties);
 
     CatalogCredentialContext context = new 
CatalogCredentialContext("test-user");
-    Credential credential = credentialProvider.getCredential(context);
+    Optional<Credential> credential = 
credentialProvider.getCredential(context);
 
-    Assertions.assertNull(credential);
+    Assertions.assertFalse(credential.isPresent());

Review Comment:
   Fix.



##########
core/src/main/java/org/apache/gravitino/credential/CredentialCache.java:
##########
@@ -87,8 +88,11 @@ public void initialize(Map<String, String> 
catalogProperties) {
             .build();
   }
 
-  public Credential getCredential(T cacheKey, Function<T, Credential> 
credentialSupplier) {
-    return credentialCache.get(cacheKey, key -> 
credentialSupplier.apply(cacheKey));
+  public Optional<Credential> getCredential(
+      T cacheKey, Function<T, Optional<Credential>> credentialSupplier) {
+    Credential credential =
+        credentialCache.get(cacheKey, key -> 
credentialSupplier.apply(cacheKey).orElse(null));
+    return Optional.ofNullable(credential);

Review Comment:
   Fixed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to