hongzhi-gao commented on code in PR #18008:
URL: https://github.com/apache/iotdb/pull/18008#discussion_r3464271724
##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/utils/JVMCommonUtils.java:
##########
@@ -111,6 +111,9 @@ public static boolean hasSpace(String dir) {
public static long getOccupiedSpace(String folderPath) throws IOException {
Path folder = Paths.get(folderPath);
+ if (!Files.exists(folder)) {
+ return 0;
+ }
try (Stream<Path> s = Files.walk(folder)) {
return s.filter(p -> p.toFile().isFile()).mapToLong(p ->
p.toFile().length()).sum();
Review Comment:
return s.filter(p -> p.toFile().isFile())
.mapToLong(
p -> {
File file = p.toFile();
return file.exists() ? file.length() : 0L;
})
.sum();
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]