|
23 | 23 | import org.bson.types.ObjectId;
|
24 | 24 |
|
25 | 25 | import java.text.DecimalFormat;
|
| 26 | +import java.text.DecimalFormatSymbols; |
26 | 27 | import java.util.Collections;
|
27 | 28 | import java.util.Date;
|
28 | 29 | import java.util.HashSet;
|
@@ -50,6 +51,8 @@ public class ServerDescription {
|
50 | 51 |
|
51 | 52 | private static final int DEFAULT_MAX_DOCUMENT_SIZE = 0x1000000; // 16MB
|
52 | 53 |
|
| 54 | + private static final DecimalFormatSymbols DECIMAL_FORMAT_SYMBOLS = initializeDecimalFormatSymbols(); |
| 55 | + |
53 | 56 | private final ServerAddress address;
|
54 | 57 |
|
55 | 58 | private final ServerType type;
|
@@ -78,6 +81,18 @@ public class ServerDescription {
|
78 | 81 |
|
79 | 82 | private final Throwable exception;
|
80 | 83 |
|
| 84 | + /** |
| 85 | + * Initialize the character used for decimal separator |
| 86 | + * |
| 87 | + * @return the character used for decimal separator |
| 88 | + * @since 3.6 |
| 89 | + */ |
| 90 | + private static DecimalFormatSymbols initializeDecimalFormatSymbols() { |
| 91 | + DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols(); |
| 92 | + decimalFormatSymbols.setDecimalSeparator('.'); |
| 93 | + return decimalFormatSymbols; |
| 94 | + } |
| 95 | + |
81 | 96 | /**
|
82 | 97 | * Gets a Builder for creating a new ServerDescription instance.
|
83 | 98 | *
|
@@ -912,7 +927,7 @@ private String translateExceptionToString() {
|
912 | 927 |
|
913 | 928 |
|
914 | 929 | private String getRoundTripFormattedInMilliseconds() {
|
915 |
| - return new DecimalFormat("#0.0").format(roundTripTimeNanos / 1000.0 / 1000.0); |
| 930 | + return new DecimalFormat("#0.0", DECIMAL_FORMAT_SYMBOLS).format(roundTripTimeNanos / 1000.0 / 1000.0); |
916 | 931 | }
|
917 | 932 |
|
918 | 933 | ServerDescription(final Builder builder) {
|
|
0 commit comments