|
24 | 24 | import java.net.http.HttpResponse; |
25 | 25 | import java.nio.charset.StandardCharsets; |
26 | 26 | import java.time.Duration; |
27 | | -import java.util.ArrayList; |
28 | 27 | import java.util.Base64; |
29 | 28 | import java.util.Collections; |
30 | 29 | import java.util.HashMap; |
@@ -168,7 +167,7 @@ public WebServiceClient.Builder locales(List<String> val) { |
168 | 167 | if (locales == null) { |
169 | 168 | throw new IllegalArgumentException("locales must not be null"); |
170 | 169 | } |
171 | | - locales = new ArrayList<>(val); |
| 170 | + locales = List.copyOf(val); |
172 | 171 | return this; |
173 | 172 | } |
174 | 173 |
|
@@ -436,17 +435,11 @@ private void handleErrorWithJsonBody(Map<String, String> content, |
436 | 435 | } |
437 | 436 |
|
438 | 437 | switch (code) { |
439 | | - case "ACCOUNT_ID_REQUIRED": |
440 | | - case "AUTHORIZATION_INVALID": |
441 | | - case "LICENSE_KEY_REQUIRED": |
442 | | - case "USER_ID_REQUIRED": |
443 | | - throw new AuthenticationException(error); |
444 | | - case "INSUFFICIENT_FUNDS": |
445 | | - throw new InsufficientFundsException(error); |
446 | | - case "PERMISSION_REQUIRED": |
447 | | - throw new PermissionRequiredException(error); |
448 | | - default: |
449 | | - throw new InvalidRequestException(error, code, status, uri, null); |
| 438 | + case "ACCOUNT_ID_REQUIRED", "AUTHORIZATION_INVALID", "LICENSE_KEY_REQUIRED", |
| 439 | + "USER_ID_REQUIRED" -> throw new AuthenticationException(error); |
| 440 | + case "INSUFFICIENT_FUNDS" -> throw new InsufficientFundsException(error); |
| 441 | + case "PERMISSION_REQUIRED" -> throw new PermissionRequiredException(error); |
| 442 | + default -> throw new InvalidRequestException(error, code, status, uri, null); |
450 | 443 | } |
451 | 444 | } |
452 | 445 |
|
|
0 commit comments