Skip to content
Permalink
Browse files

[FIXED JENKINS-37329] Fixed DecimalFormat problem with VM language

settings other than EN
  • Loading branch information
opx3 committed Aug 17, 2016
1 parent d7b6838 commit 20d0608baaf25b94d5f13b3cd64bf6c1cc246d36
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/main/java/jenkins/plugins/build_metrics/stats/StatsMath.java
@@ -1,6 +1,8 @@
package jenkins.plugins.build_metrics.stats;

import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Locale;

public class StatsMath {

@@ -9,7 +11,8 @@ public static double getPercent(double subVal, double totalVal){
}

public static double roundTwoDecimals(double iVal){
DecimalFormat twoDForm = new DecimalFormat("#.##");
return Double.valueOf(twoDForm.format(iVal));
DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols(Locale.getDefault());
DecimalFormat twoDForm = new DecimalFormat("#"+decimalFormatSymbols.getDecimalSeparator()+"##",decimalFormatSymbols);
return Double.valueOf(twoDForm.format(iVal));
}
}

0 comments on commit 20d0608

Please sign in to comment.
You can’t perform that action at this time.