This is an automated email from the ASF dual-hosted git repository.
chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fury.git
The following commit(s) were added to refs/heads/main by this push:
new 4f24bd4d fix(java): fix fury logger npe (#1762)
4f24bd4d is described below
commit 4f24bd4d196080cf8b85b3042cdd001b723a87d7
Author: Shawn Yang <[email protected]>
AuthorDate: Fri Jul 26 10:09:38 2024 +0800
fix(java): fix fury logger npe (#1762)
## What does this PR do?
## Related issues
Closes #1761
## Does this PR introduce any user-facing change?
<!--
If any user-facing interface changes, please [open an
issue](https://github.com/apache/fury/issues/new/choose) describing the
need to do so and update the document if necessary.
-->
- [ ] Does this PR introduce any public API change?
- [ ] Does this PR introduce any binary protocol compatibility change?
## Benchmark
<!--
When the PR has an impact on performance (if you don't know whether the
PR will have an impact on performance, you can submit the PR first, and
if it will have impact on performance, the code reviewer will explain
it), be sure to attach a benchmark data here.
-->
---
java/fury-core/src/main/java/org/apache/fury/logging/FuryLogger.java | 3 +++
.../src/test/java/org/apache/fury/logging/Slf4jLoggerTest.java | 1 +
2 files changed, 4 insertions(+)
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 74820412..f99b48b8 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 @@ public class FuryLogger implements Logger {
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 a10226af..32c0d916 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 class Slf4jLoggerTest {
furyLogger.info("testInfo {}", "placeHolder");
furyLogger.warn("testInfo {}", "placeHolder");
furyLogger.error("testInfo {}", "placeHolder", new Exception("test log"));
+ furyLogger.error(null, new Exception("test log"));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]