Spaceman1984 commented on a change in pull request #4900:
URL: https://github.com/apache/cloudstack/pull/4900#discussion_r609784804



##########
File path: 
plugins/metrics/src/main/java/org/apache/cloudstack/response/HostMetricsResponse.java
##########
@@ -117,7 +117,7 @@ public void setCpuTotal(final Integer cpuNumber, final Long 
cpuSpeed, final Doub
 
     public void setCpuUsed(final String cpuUsed, final Integer cpuNumber, 
final Long cpuSpeed) {
         if (cpuUsed != null && cpuNumber != null && cpuSpeed != null) {
-            this.cpuUsed = String.format("%.2f Ghz", 
Double.valueOf(cpuUsed.replace("%", "")) * cpuNumber * cpuSpeed / (100.0 * 
1000.0));
+            this.cpuUsed = String.format("%.2f Ghz", 
Double.valueOf(cpuUsed.replace(",",".").replace("%", "")) * cpuNumber * 
cpuSpeed / (100.0 * 1000.0));

Review comment:
       This method is taking a percentage value and doing some conversion on 
it. At the source it's set using DecimalFormat. I have changed my solution to 
use the same object and formatting so the locale won't be a problem anymore.




-- 
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]


Reply via email to