|
41 | 41 | import java.util.ArrayList;
|
42 | 42 | import java.util.HashMap;
|
43 | 43 | import java.util.List;
|
| 44 | +import java.util.Locale; |
44 | 45 | import java.util.Map;
|
45 | 46 |
|
46 | 47 | public class GenericHandler {
|
@@ -313,25 +314,25 @@ private ProfileParameters applyWeightings(RequestProfileParamsWeightings weighti
|
313 | 314 | try {
|
314 | 315 | if (weightings.hasGreenIndex()) {
|
315 | 316 | ProfileWeighting pw = new ProfileWeighting("green");
|
316 |
| - float greenFactor = weightings.getGreenIndex(); |
317 |
| - if (greenFactor > 1) |
318 |
| - throw new ParameterOutOfRangeException(GenericErrorCodes.INVALID_PARAMETER_VALUE, String.format("%.2f", greenFactor), "green factor", "1.0"); |
319 |
| - pw.addParameter("factor", String.format("%.2f", greenFactor)); |
| 317 | + Float greenFactor = weightings.getGreenIndex(); |
| 318 | + if (greenFactor.floatValue() > 1) |
| 319 | + throw new ParameterOutOfRangeException(GenericErrorCodes.INVALID_PARAMETER_VALUE, String.format(Locale.UK, "%.2f", greenFactor), "green factor", "1.0"); |
| 320 | + pw.addParameter("factor", greenFactor); |
320 | 321 | params.add(pw);
|
321 | 322 | }
|
322 | 323 |
|
323 | 324 | if (weightings.hasQuietIndex()) {
|
324 | 325 | ProfileWeighting pw = new ProfileWeighting("quiet");
|
325 |
| - float quietFactor = weightings.getQuietIndex(); |
326 |
| - if (quietFactor > 1) |
327 |
| - throw new ParameterOutOfRangeException(GenericErrorCodes.INVALID_PARAMETER_VALUE, String.format("%.2f", quietFactor), "quiet factor", "1.0"); |
328 |
| - pw.addParameter("factor", String.format("%.2f", quietFactor)); |
| 326 | + Float quietFactor = weightings.getQuietIndex(); |
| 327 | + if (quietFactor.floatValue() > 1) |
| 328 | + throw new ParameterOutOfRangeException(GenericErrorCodes.INVALID_PARAMETER_VALUE, String.format(Locale.UK, "%.2f", quietFactor), "quiet factor", "1.0"); |
| 329 | + pw.addParameter("factor", quietFactor); |
329 | 330 | params.add(pw);
|
330 | 331 | }
|
331 | 332 |
|
332 | 333 | if (weightings.hasSteepnessDifficulty()) {
|
333 | 334 | ProfileWeighting pw = new ProfileWeighting("steepness_difficulty");
|
334 |
| - pw.addParameter("level", String.format("%d", weightings.getSteepnessDifficulty())); |
| 335 | + pw.addParameter("level", weightings.getSteepnessDifficulty()); |
335 | 336 | params.add(pw);
|
336 | 337 | }
|
337 | 338 | } catch (InternalServerException e) {
|
|
0 commit comments