diff --git a/java/fury-core/src/main/java/org/apache/fury/logging/FuryLogger.java b/java/fury-core/src/main/java/org/apache/fury/logging/FuryLogger.java index 748204127d..f99b48b831 100644 --- a/java/fury-core/src/main/java/org/apache/fury/logging/FuryLogger.java +++ b/java/fury-core/src/main/java/org/apache/fury/logging/FuryLogger.java @@ -142,6 +142,9 @@ private void log(int level, String msg, Object[] args, boolean mayPrintTrace) { builder.append(":").append(lineNumber); builder.append(" [").append(Thread.currentThread().getName()).append(']'); builder.append(" - "); + if (msg == null) { + msg = "null"; + } int len = msg.length(); int count = 0; for (int i = 0; i < len; i++) { diff --git a/java/fury-core/src/test/java/org/apache/fury/logging/Slf4jLoggerTest.java b/java/fury-core/src/test/java/org/apache/fury/logging/Slf4jLoggerTest.java index a10226af3f..32c0d9163c 100644 --- a/java/fury-core/src/test/java/org/apache/fury/logging/Slf4jLoggerTest.java +++ b/java/fury-core/src/test/java/org/apache/fury/logging/Slf4jLoggerTest.java @@ -35,5 +35,6 @@ public void testInfo() { furyLogger.info("testInfo {}", "placeHolder"); furyLogger.warn("testInfo {}", "placeHolder"); furyLogger.error("testInfo {}", "placeHolder", new Exception("test log")); + furyLogger.error(null, new Exception("test log")); } }