RongtongJin commented on a change in pull request #2116:
URL: https://github.com/apache/rocketmq/pull/2116#discussion_r444630349
##########
File path: common/src/main/java/org/apache/rocketmq/common/UtilAll.java
##########
@@ -200,14 +200,20 @@ public static String timeMillisToHumanString3(final long
t) {
}
public static double getDiskPartitionSpaceUsedPercent(final String path) {
- if (null == path || path.isEmpty())
+ if (null == path || path.isEmpty()) {
+ log.error("Error when measuring disk space usage, path is null or
empty, path :" + path);
return -1;
+ }
+
try {
File file = new File(path);
- if (!file.exists())
+ if (!file.exists()) {
+ log.error("Error when measuring disk space usage, file doesn't
exist on this path: " + path);
Review comment:
It would be better to use placeholder instead of string concatenation.
##########
File path: common/src/main/java/org/apache/rocketmq/common/UtilAll.java
##########
@@ -218,6 +224,8 @@ public static double getDiskPartitionSpaceUsedPercent(final
String path) {
return usedSpace / (double) totalSpace;
}
} catch (Exception e) {
+ log.error("Error when measuring disk space usage, got exception:
");
+ e.printStackTrace();
return -1;
Review comment:
It would be better to write as `log.error("xxxxxxxxxxx", e)`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]