This is an automated email from the ASF dual-hosted git repository.

jmclean pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/main by this push:
     new e865084ab1 [#7523] fix(config): avoid logging null value in 
ConfigEntry writes (#7526)
e865084ab1 is described below

commit e865084ab198bbbd857a8dffc39e0607475ecbf0
Author: 신동재 <[email protected]>
AuthorDate: Wed Jul 2 10:27:45 2025 +0900

    [#7523] fix(config): avoid logging null value in ConfigEntry writes (#7526)
    
    [#7523] fix(config): avoid logging null value in ConfigEntry writes
    
    - Prevents using null as a log parameter when writing config entries.
    - Logs the config key instead when the string-converted value is null.
    - Improves log clarity and avoids potential confusion during debugging.
    
    ### What changes were proposed in this pull request?
    
    This PR fixes an issue in `ConfigEntry.writeTo()`.
    Previously, if the converted string value was `null`, the log message
    would print `"null"` as the config key, leading to confusion.
    Now, the code ensures that the actual config key is logged instead,
    preventing null values from appearing in logs.
    
    ### Why are the changes needed?
    
    Logging a null value as a key can cause confusion during debugging and
    make logs misleading.
    This fix improves log clarity and ensures that null values are not
    accidentally logged or stored.
    
    Fixes #7523
    
    ### Does this PR introduce _any_ user-facing change?
    
    No user-facing changes. Only internal logging behavior has been
    improved.
    
    ### How was this patch tested?
    
    - Unit tests were added and executed in the `TestConfigEntry.java` file
    to ensure that when the string value is null,
    the key is correctly logged instead.
    - Integration tests were not run locally due to Docker environment
    constraints
    and will be verified via CI.
---
 core/src/main/java/org/apache/gravitino/config/ConfigEntry.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/core/src/main/java/org/apache/gravitino/config/ConfigEntry.java 
b/core/src/main/java/org/apache/gravitino/config/ConfigEntry.java
index 8021ea447b..44196e3f07 100644
--- a/core/src/main/java/org/apache/gravitino/config/ConfigEntry.java
+++ b/core/src/main/java/org/apache/gravitino/config/ConfigEntry.java
@@ -313,10 +313,9 @@ public class ConfigEntry<T> {
     String stringValue = stringConverter.apply(value);
     if (stringValue == null) {
       // To ensure that a null value is not set in the configuration
-      LOG.warn("Config {} value to set is null, ignore setting to Config.", 
stringValue);
+      LOG.warn("Config key {} value to set is null, ignore setting to 
Config.", key);
       return;
     }
-
     properties.put(key, stringValue);
   }
 }

Reply via email to