Skip to content
Snippets Groups Projects
Commit c211c68a authored by Lene Wasskog's avatar Lene Wasskog
Browse files

fix: Set correct decimal separator symbol

Necessary in order to fix issues related to different
locales at different machines. This was discovered
when tests failed at one laptop and not another.
parent 238c5749
No related branches found
No related tags found
1 merge request!1VIPSUTV-369 Fikse test for getModelName
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
package no.nibio.model.maizepheno; package no.nibio.model.maizepheno;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -28,6 +29,7 @@ import java.util.Collections; ...@@ -28,6 +29,7 @@ import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Set; import java.util.Set;
import java.util.TimeZone; import java.util.TimeZone;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -84,7 +86,10 @@ public class MaizePhenologyModel extends I18nImpl implements Model{ ...@@ -84,7 +86,10 @@ public class MaizePhenologyModel extends I18nImpl implements Model{
Date lastDate = this.dataMatrix.getLastDateWithParameterValue(DataMatrix.TND); Date lastDate = this.dataMatrix.getLastDateWithParameterValue(DataMatrix.TND);
Double heatSum = 0.0; Double heatSum = 0.0;
List<Result> retVal = new ArrayList<>(); List<Result> retVal = new ArrayList<>();
DecimalFormat dFormat = new DecimalFormat("###.##");
DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.getDefault());
symbols.setDecimalSeparator('.');
DecimalFormat dFormat = new DecimalFormat("###.##", symbols);
while(!currentDate.after(lastDate)) while(!currentDate.after(lastDate))
{ {
Result result = new ResultImpl(); Result result = new ResultImpl();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment