You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celeborn.apache.org by zh...@apache.org on 2023/12/07 15:21:10 UTC
(incubator-celeborn) branch branch-0.3 updated: [CELEBORN-1154] Fix NPE in DeviceMonitor#readWriteError
This is an automated email from the ASF dual-hosted git repository.
zhouky pushed a commit to branch branch-0.3
in repository https://gitbox.apache.org/repos/asf/incubator-celeborn.git
The following commit(s) were added to refs/heads/branch-0.3 by this push:
new 60ce4e1df [CELEBORN-1154] Fix NPE in DeviceMonitor#readWriteError
60ce4e1df is described below
commit 60ce4e1df598115ee69826ffab143e5ac837a262
Author: jiang13021 <ji...@antgroup.com>
AuthorDate: Thu Dec 7 23:20:43 2023 +0800
[CELEBORN-1154] Fix NPE in DeviceMonitor#readWriteError
### What changes were proposed in this pull request?
Avoid NPE in DeviceMonitor#readWriteError
### Why are the changes needed?
The NullPointerException in the finally block will mask the real exception.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
manually test
Closes #2137 from jiang13021/celeborn-1154.
Authored-by: jiang13021 <ji...@antgroup.com>
Signed-off-by: zky.zhoukeyong <zk...@alibaba-inc.com>
(cherry picked from commit c9db95386c2790b1a04ccc5b6a0f031601660c89)
Signed-off-by: zky.zhoukeyong <zk...@alibaba-inc.com>
---
.../celeborn/service/deploy/worker/storage/DeviceMonitor.scala | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/worker/src/main/scala/org/apache/celeborn/service/deploy/worker/storage/DeviceMonitor.scala b/worker/src/main/scala/org/apache/celeborn/service/deploy/worker/storage/DeviceMonitor.scala
index d7f5879f1..8acb8b2b7 100644
--- a/worker/src/main/scala/org/apache/celeborn/service/deploy/worker/storage/DeviceMonitor.scala
+++ b/worker/src/main/scala/org/apache/celeborn/service/deploy/worker/storage/DeviceMonitor.scala
@@ -298,9 +298,9 @@ object DeviceMonitor extends Logging {
bufferReader = new BufferedReader(inputStreamReader)
bufferReader.readLine()
} finally {
- bufferReader.close()
- inputStreamReader.close()
- fileInputStream.close()
+ Option(bufferReader).foreach(_.close())
+ Option(inputStreamReader).foreach(_.close())
+ Option(fileInputStream).foreach(_.close())
}
FileUtils.forceDelete(file)
false