Xeli commented on a change in pull request #8259: [FLINK-12325][metrics] Fix 
bug in statsd exporter when using negative values
URL: https://github.com/apache/flink/pull/8259#discussion_r280971043
 
 

 ##########
 File path: 
flink-metrics/flink-metrics-statsd/src/main/java/org/apache/flink/metrics/statsd/StatsDReporter.java
 ##########
 @@ -240,12 +240,6 @@ public String filterCharacters(String input) {
        }
 
        private boolean numberIsNegative(Number input) {
-               try {
-                       return new 
BigDecimal(input.toString()).compareTo(BigDecimal.ZERO) == -1;
-               } catch (Exception e) {
-                       //not all Number's can be converted to a BigDecimal, 
such as Infinity or NaN
-                       //in this case we just say it isn't a negative number
-                       return false;
-               }
+               return input.doubleValue() < 0;
 
 Review comment:
   Ah sorry, no reason! 
   
   I've changed it to Double.compare(), I've also changed line #190 to use this 
method so the double check there works in the same way.  

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to