From bc65f5705bf0b064d997cd3a2210a39b0506a48f Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Thu, 4 Nov 2021 16:42:59 +0100 Subject: [PATCH] Specify Locale in humanReadableByteCountSI for consistent output For example with a French Locale the decimal separator is a comma. --- sonar-core/src/main/java/org/sonar/core/util/FileUtils.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sonar-core/src/main/java/org/sonar/core/util/FileUtils.java b/sonar-core/src/main/java/org/sonar/core/util/FileUtils.java index ad058a6f45b..c520287ae9e 100644 --- a/sonar-core/src/main/java/org/sonar/core/util/FileUtils.java +++ b/sonar-core/src/main/java/org/sonar/core/util/FileUtils.java @@ -19,6 +19,7 @@ */ package org.sonar.core.util; +import javax.annotation.Nullable; import java.io.File; import java.io.IOException; import java.nio.file.FileVisitOption; @@ -30,7 +31,7 @@ import java.nio.file.attribute.BasicFileAttributes; import java.text.CharacterIterator; import java.text.StringCharacterIterator; import java.util.EnumSet; -import javax.annotation.Nullable; +import java.util.Locale; import static com.google.common.base.Preconditions.checkArgument; import static java.lang.String.format; @@ -180,7 +181,7 @@ public final class FileUtils { bytes /= 1000; ci.next(); } - return String.format("%.1f %cB", bytes / 1000.0, ci.current()); + return String.format(Locale.ENGLISH, "%.1f %cB", bytes / 1000.0, ci.current()); } /** -- 2.39.5