You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/03/02 11:51:14 UTC

[GitHub] [pulsar] eolivelli commented on a change in pull request #14537: [loadbalance] remove 'Invalid argument' confusing stacktrace when NIC speed can't be detected

eolivelli commented on a change in pull request #14537:
URL: https://github.com/apache/pulsar/pull/14537#discussion_r817617264



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/LinuxBrokerHostUsageImpl.java
##########
@@ -294,4 +302,8 @@ private double getTotalNicUsageTxKb(List<String> nics) {
     private static long readLongFromFile(String path) throws IOException {
         return Long.parseLong(new String(Files.readAllBytes(Paths.get(path)), Charsets.UTF_8).trim());
     }
+
+    private static double readDoubleFromPath(Path path) throws IOException {
+        return Double.parseDouble(new String(Files.readAllBytes(path)));

Review comment:
       Double.parseDouble may throw a IllegalArgumentException (NumberFormatExcepton)
   we should wrap it in a IOException




-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org