|
17 | 17 |
|
18 | 18 | package io.minio.admin; |
19 | 19 |
|
| 20 | +import com.fasterxml.jackson.databind.DeserializationFeature; |
20 | 21 | import com.fasterxml.jackson.databind.JsonNode; |
21 | 22 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 23 | +import com.fasterxml.jackson.databind.json.JsonMapper; |
22 | 24 | import com.fasterxml.jackson.databind.type.CollectionType; |
23 | 25 | import com.fasterxml.jackson.databind.type.MapType; |
24 | 26 | import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; |
@@ -101,7 +103,10 @@ public String toString() { |
101 | 103 |
|
102 | 104 | private static final long DEFAULT_CONNECTION_TIMEOUT = TimeUnit.MINUTES.toMillis(1); |
103 | 105 | private static final MediaType DEFAULT_MEDIA_TYPE = MediaType.parse("application/octet-stream"); |
104 | | - private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); |
| 106 | + private static final ObjectMapper OBJECT_MAPPER = |
| 107 | + JsonMapper.builder() |
| 108 | + .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) |
| 109 | + .build(); |
105 | 110 |
|
106 | 111 | private static final Pattern SERVICE_ACCOUNT_NAME_REGEX = |
107 | 112 | Pattern.compile("^(?!-)(?!_)[a-z_\\d-]{1,31}(?<!-)(?<!_)$", Pattern.CASE_INSENSITIVE); |
@@ -657,7 +662,8 @@ public Credentials addServiceAccount( |
657 | 662 | } |
658 | 663 | if (name != null && !SERVICE_ACCOUNT_NAME_REGEX.matcher(name).find()) { |
659 | 664 | throw new IllegalArgumentException( |
660 | | - "name must contain non-empty alphanumeric, underscore and hyphen characters not longer than 32 characters"); |
| 665 | + "name must contain non-empty alphanumeric, underscore and hyphen characters not longer" |
| 666 | + + " than 32 characters"); |
661 | 667 | } |
662 | 668 | if (description != null && description.length() > 256) { |
663 | 669 | throw new IllegalArgumentException("description must be at most 256 characters long"); |
@@ -724,7 +730,8 @@ public void updateServiceAccount( |
724 | 730 | } |
725 | 731 | if (newName != null && !SERVICE_ACCOUNT_NAME_REGEX.matcher(newName).find()) { |
726 | 732 | throw new IllegalArgumentException( |
727 | | - "new name must contain non-empty alphanumeric, underscore and hyphen characters not longer than 32 characters"); |
| 733 | + "new name must contain non-empty alphanumeric, underscore and hyphen characters not" |
| 734 | + + " longer than 32 characters"); |
728 | 735 | } |
729 | 736 | if (newDescription != null && newDescription.length() > 256) { |
730 | 737 | throw new IllegalArgumentException("new description must be at most 256 characters long"); |
|
0 commit comments