mirror of https://github.com/apache/kafka.git
KAFKA-8024; Fix `UtilsTest` failure under non-english locales (#6351)
The two digit formatting we use in `Utils.formatBytes` depends on the english locale. If run from a different locale (e.g. German), the test case fails. This patch uses english explicitly. Reviewers: Lee Dongjin <dongjin@apache.org>, Jason Gustafson <jason@confluent.io>
This commit is contained in:
parent
f65c71cf6e
commit
ecf23b51b0
|
@ -39,11 +39,12 @@ import java.nio.file.FileVisitResult;
|
|||
import java.nio.file.Files;
|
||||
import java.nio.file.NoSuchFileException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.SimpleFileVisitor;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.SimpleFileVisitor;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
@ -53,6 +54,7 @@ import java.util.HashSet;
|
|||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Properties;
|
||||
|
@ -75,7 +77,8 @@ public final class Utils {
|
|||
private static final Pattern VALID_HOST_CHARACTERS = Pattern.compile("([0-9a-zA-Z\\-%._:]*)");
|
||||
|
||||
// Prints up to 2 decimal digits. Used for human readable printing
|
||||
private static final DecimalFormat TWO_DIGIT_FORMAT = new DecimalFormat("0.##");
|
||||
private static final DecimalFormat TWO_DIGIT_FORMAT = new DecimalFormat("0.##",
|
||||
DecimalFormatSymbols.getInstance(Locale.ENGLISH));
|
||||
|
||||
private static final String[] BYTE_SCALE_SUFFIXES = new String[] {"B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"};
|
||||
|
||||
|
|
Loading…
Reference in New Issue