You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by eo...@apache.org on 2020/09/21 14:37:16 UTC
[bookkeeper] branch master updated: Fix potential
NullPointerException when local book keeper stop on exit
This is an automated email from the ASF dual-hosted git repository.
eolivelli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new ddfeaf9 Fix potential NullPointerException when local book keeper stop on exit
ddfeaf9 is described below
commit ddfeaf9a11fc82cb3b1225a5754285435f2f7fab
Author: gaoxinge <xg...@tianrang-inc.com>
AuthorDate: Mon Sep 21 22:34:28 2020 +0800
Fix potential NullPointerException when local book keeper stop on exit
Descriptions of the changes in this PR:
- Fix potential NullPointerException when local book keeper stop on exit.
Reviewers: Enrico Olivelli <eo...@gmail.com>, Sijie Guo <si...@apache.org>
This closes #2414 from gaoxinge/fix
---
.../src/main/java/org/apache/bookkeeper/util/LocalBookKeeper.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/LocalBookKeeper.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/LocalBookKeeper.java
index d9570ff..c264e6b 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/LocalBookKeeper.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/LocalBookKeeper.java
@@ -168,7 +168,7 @@ public class LocalBookKeeper {
private List<File> runBookies(String dirSuffix)
throws Exception {
- List<File> tempDirs = new ArrayList<File>();
+ List<File> tempDirs = new ArrayList<>();
try {
runBookies(tempDirs, dirSuffix);
return tempDirs;
@@ -391,7 +391,9 @@ public class LocalBookKeeper {
throw e;
} finally {
if (stopOnExit) {
- cleanupDirectories(bkTmpDirs);
+ if (null != bkTmpDirs) {
+ cleanupDirectories(bkTmpDirs);
+ }
if (null != zkTmpDir) {
FileUtils.deleteDirectory(zkTmpDir);
}