Skip to content

Commit 5755e9f

Browse files
committed
test: another test for NullPointerException
1 parent 2ce54ac commit 5755e9f

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/main/java/org/tron/core/config/args/Args.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,12 @@ public static void clearParam() {
225225
INSTANCE.storageDbDirectory = "";
226226
INSTANCE.storageIndexDirectory = "";
227227

228-
// WARNING: WILL DELETE DB STORAGE PATHS
229-
INSTANCE.storage.deleteAllStoragePaths();
230-
INSTANCE.storage = null;
228+
// FIXME: INSTANCE.storage maybe null ?
229+
if (INSTANCE.storage != null) {
230+
// WARNING: WILL DELETE DB STORAGE PATHS
231+
INSTANCE.storage.deleteAllStoragePaths();
232+
INSTANCE.storage = null;
233+
}
231234

232235
INSTANCE.overlay = null;
233236
INSTANCE.seedNode = null;

src/main/java/org/tron/core/config/args/Storage.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,11 @@ public void deleteAllStoragePaths() {
141141
}
142142

143143
for (Property property : propertyMap.values()) {
144-
// TODO: NullPointerException in CI, but normal in local
145-
if (property != null) {
146-
String path = property.getPath();
147-
if (path != null) {
148-
FileUtil.recursiveDelete(path);
149-
}
144+
String path = property.getPath();
145+
if (path != null) {
146+
FileUtil.recursiveDelete(path);
150147
}
151148
}
152-
153149
}
154150

155151
private boolean hasProperty(String dbName) {

0 commit comments

Comments
 (0)