|
21 | 21 | package com.apple.foundationdb.relational.util;
|
22 | 22 |
|
23 | 23 | import com.apple.foundationdb.annotation.API;
|
24 |
| - |
25 | 24 | import com.apple.foundationdb.relational.api.exceptions.ErrorCode;
|
26 |
| -import com.apple.foundationdb.relational.api.exceptions.UncheckedRelationalException; |
27 | 25 | import com.apple.foundationdb.relational.api.exceptions.RelationalException;
|
| 26 | +import com.apple.foundationdb.relational.api.exceptions.UncheckedRelationalException; |
28 | 27 |
|
29 | 28 | import javax.annotation.Nonnull;
|
| 29 | +import java.util.Locale; |
30 | 30 | import java.util.function.Supplier;
|
31 | 31 |
|
32 | 32 | /**
|
@@ -58,13 +58,13 @@ public static void that(boolean mustBeTrue, @Nonnull final ErrorCode errorCodeIf
|
58 | 58 |
|
59 | 59 | public static void that(boolean mustBeTrue, @Nonnull final ErrorCode errorCodeIfNotTrue, @Nonnull final String messageFormat, @Nonnull Object messageValue) throws RelationalException {
|
60 | 60 | if (!mustBeTrue) {
|
61 |
| - throw new RelationalException(String.format(messageFormat, messageValue), errorCodeIfNotTrue); |
| 61 | + throw new RelationalException(String.format(Locale.ROOT, messageFormat, messageValue), errorCodeIfNotTrue); |
62 | 62 | }
|
63 | 63 | }
|
64 | 64 |
|
65 | 65 | public static void that(boolean mustBeTrue, @Nonnull final ErrorCode errorCodeIfNotTrue, @Nonnull final String messageFormat, @Nonnull Object messageValue1, @Nonnull Object messageValue2) throws RelationalException {
|
66 | 66 | if (!mustBeTrue) {
|
67 |
| - throw new RelationalException(String.format(messageFormat, messageValue1, messageValue2), errorCodeIfNotTrue); |
| 67 | + throw new RelationalException(String.format(Locale.ROOT, messageFormat, messageValue1, messageValue2), errorCodeIfNotTrue); |
68 | 68 | }
|
69 | 69 | }
|
70 | 70 |
|
@@ -132,13 +132,13 @@ public static void thatUnchecked(boolean mustBeTrue, @Nonnull final ErrorCode er
|
132 | 132 |
|
133 | 133 | public static void thatUnchecked(boolean mustBeTrue, @Nonnull final ErrorCode errorCodeIfNotTrue, @Nonnull final String messageTemplate, @Nonnull final Object messageValue) {
|
134 | 134 | if (!mustBeTrue) {
|
135 |
| - throw new RelationalException(String.format(messageTemplate, messageValue), errorCodeIfNotTrue).toUncheckedWrappedException(); |
| 135 | + throw new RelationalException(String.format(Locale.ROOT, messageTemplate, messageValue), errorCodeIfNotTrue).toUncheckedWrappedException(); |
136 | 136 | }
|
137 | 137 | }
|
138 | 138 |
|
139 | 139 | public static void thatUnchecked(boolean mustBeTrue, @Nonnull final ErrorCode errorCodeIfNotTrue, @Nonnull final String messageTemplate, @Nonnull final Object messageValue1, @Nonnull final Object messageValue2) {
|
140 | 140 | if (!mustBeTrue) {
|
141 |
| - throw new RelationalException(String.format(messageTemplate, messageValue1, messageValue2), errorCodeIfNotTrue).toUncheckedWrappedException(); |
| 141 | + throw new RelationalException(String.format(Locale.ROOT, messageTemplate, messageValue1, messageValue2), errorCodeIfNotTrue).toUncheckedWrappedException(); |
142 | 142 | }
|
143 | 143 | }
|
144 | 144 |
|
@@ -168,7 +168,7 @@ public static <T> T notNullUnchecked(T object, @Nonnull final ErrorCode errorCod
|
168 | 168 |
|
169 | 169 | public static <T> T notNullUnchecked(T object, @Nonnull final ErrorCode errorCodeIfNull, @Nonnull final String messageTemplate, @Nonnull final Object messageValue) {
|
170 | 170 | if (object == null) {
|
171 |
| - throw new RelationalException(String.format(messageTemplate, messageValue), errorCodeIfNull).toUncheckedWrappedException(); |
| 171 | + throw new RelationalException(String.format(Locale.ROOT, messageTemplate, messageValue), errorCodeIfNull).toUncheckedWrappedException(); |
172 | 172 | } else {
|
173 | 173 | return object;
|
174 | 174 | }
|
|
0 commit comments