Skip to content

Commit f6aa1d2

Browse files
author
Gabriel Einsdorf
committed
Set locale to US so that the strings are always formated as expected.
In European locales "," is used as decimal seperator instead of ".". String.format(..) automatically converts decimal numbers, making some unit tests fail on systems with certain European locales.
1 parent 2cc8b1b commit f6aa1d2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/org/scijava/util/UnitUtils.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
package org.scijava.util;
3333

34+
import java.util.Locale;
35+
3436
/**
3537
* Utility methods for working with units.
3638
*
@@ -63,7 +65,7 @@ public static String getAbbreviatedByteLabel(final double totBytes) {
6365

6466
// format result with 0 decimal places for bytes, or 1 for larger values
6567
final String format = pow == 0 ? "%.0f%s" : "%.1f%s";
66-
return String.format(format, value, BYTE_UNITS[pow]);
68+
return String.format(Locale.US, format, value, BYTE_UNITS[pow]);
6769
}
6870

6971
}

0 commit comments

Comments
 (0)