[JIRA] (JENKINS-37329) Bug in StatsMath.java DecimalFormat

1 view
Skip to first unread message

roropx3@googlemail.com (JIRA)

unread,
Aug 11, 2016, 3:10:01 AM8/11/16
to jenkinsc...@googlegroups.com
Rolf Rother created an issue
 
Jenkins / Bug JENKINS-37329
Bug in StatsMath.java DecimalFormat
Issue Type: Bug Bug
Assignee: Yoann Dubreuil
Components: build-metrics-plugin
Created: 2016/Aug/11 7:09 AM
Priority: Critical Critical
Reporter: Rolf Rother

The implementation in statsmath.java results in an NumberFormatException when then LANG for the VM is set to another than EN:

Caused by: java.lang.NumberFormatException: For input string: "19,16"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
at java.lang.Double.parseDouble(Double.java:538)
at java.lang.Double.valueOf(Double.java:502)
at jenkins.plugins.build_metrics.stats.StatsMath.roundTwoDecimals(StatsMath.java:13)
at jenkins.plugins.build_metrics.stats.StatsMath.getPercent(StatsMath.java:8)
at jenkins.plugins.build_metrics.stats.StatsFactory.getFailureRate(StatsFactory.java:167)
... 135 more

Please change:
public static double roundTwoDecimals(double iVal)

{ DecimalFormat twoDForm = new DecimalFormat("#.##"); return Double.valueOf(twoDForm.format(iVal)); }

to:
public static double roundTwoDecimals(double iVal)

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

Thanks

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

roropx3@googlemail.com (JIRA)

unread,
Aug 16, 2016, 11:02:02 AM8/16/16
to jenkinsc...@googlegroups.com
Rolf Rother assigned an issue to Rolf Rother
Change By: Rolf Rother
Assignee: Yoann Dubreuil Rolf Rother

roropx3@googlemail.com (JIRA)

unread,
Aug 16, 2016, 11:05:01 AM8/16/16
to jenkinsc...@googlegroups.com
Rolf Rother commented on Bug JENKINS-37329
 
Re: Bug in StatsMath.java DecimalFormat

Fixed and will be included in the next release

scm_issue_link@java.net (JIRA)

unread,
Aug 17, 2016, 10:10:11 AM8/17/16
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Rolf Rother
Path:
src/main/java/jenkins/plugins/build_metrics/stats/StatsMath.java
http://jenkins-ci.org/commit/build-metrics-plugin/20d0608baaf25b94d5f13b3cd64bf6c1cc246d36
Log:
[FIXED JENKINS-37329] Fixed DecimalFormat problem with VM language
settings other than EN

scm_issue_link@java.net (JIRA)

unread,
Aug 17, 2016, 10:10:11 AM8/17/16
to jenkinsc...@googlegroups.com
SCM/JIRA link daemon resolved as Fixed
Change By: SCM/JIRA link daemon
Status: Open Resolved
Resolution: Fixed

scm_issue_link@java.net (JIRA)

unread,
Aug 20, 2016, 1:29:01 PM8/20/16
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Rolf Rother
Path:
src/main/java/jenkins/plugins/build_metrics/stats/StatsMath.java

src/test/java/jenkins/plugins/build_metrics/stats/StatsMathTest.java
http://jenkins-ci.org/commit/build-metrics-plugin/b4486c4ae1a216e48029d36708c9fcb47be2f4f3
Log:
Revert "JENKINS-37329 - Changed caluclation of RoundDecimal again."

This reverts commit f22fe982feb30c5566eb665b423a6bb2806ed022.

scm_issue_link@java.net (JIRA)

unread,
Aug 20, 2016, 1:29:01 PM8/20/16
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Rolf Rother
Path:
src/main/java/jenkins/plugins/build_metrics/stats/StatsMath.java
src/test/java/jenkins/plugins/build_metrics/stats/StatsMathTest.java


JENKINS-37329 - Changed caluclation of RoundDecimal again.

scm_issue_link@java.net (JIRA)

unread,
Aug 20, 2016, 1:29:02 PM8/20/16
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Rolf Rother
Path:

src/main/java/jenkins/plugins/build_metrics/stats/StatsFactory.java
src/main/java/jenkins/plugins/build_metrics/stats/StatsMath.java
src/main/java/jenkins/plugins/build_metrics/stats/StatsModel.java
src/main/resources/jenkins/plugins/build_metrics/BuildMetricsPlugin/BuildStats.jelly
http://jenkins-ci.org/commit/build-metrics-plugin/8ace1d0873af1ae523ebc25d7c269bd7ba048de8
Log:
Revert "JENKINS-37329 - Changed caluclation of RoundDecimal again."

This reverts commit f22fe982feb30c5566eb665b423a6bb2806ed022.

Reply all
Reply to author
Forward
0 new messages