|
2 | 2 |
|
3 | 3 | import com.fasterxml.jackson.databind.*; |
4 | 4 | import com.fasterxml.jackson.databind.introspect.VisibilityChecker; |
| 5 | +import com.fasterxml.jackson.databind.json.JsonMapper; |
5 | 6 | import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; |
6 | 7 | import org.apache.commons.io.IOUtils; |
7 | 8 | import org.kohsuke.github.authorization.AuthorizationProvider; |
@@ -109,21 +110,19 @@ static class RetryRequestException extends IOException { |
109 | 110 | /** The Constant DEFAULT_MINIMUM_RETRY_TIMEOUT_MILLIS. */ |
110 | 111 | private static final int DEFAULT_MINIMUM_RETRY_MILLIS = DEFAULT_MAXIMUM_RETRY_MILLIS; |
111 | 112 | private static final Logger LOGGER = Logger.getLogger(GitHubClient.class.getName()); |
112 | | - private static final ObjectMapper MAPPER = new ObjectMapper(); |
| 113 | + private static final ObjectMapper MAPPER = JsonMapper.builder() |
| 114 | + .addModule(new JavaTimeModule()) |
| 115 | + .visibility(new VisibilityChecker.Std(NONE, NONE, NONE, NONE, ANY)) |
| 116 | + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) |
| 117 | + .enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS) |
| 118 | + .propertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE) |
| 119 | + .build(); |
113 | 120 |
|
114 | 121 | private static final ThreadLocal<String> sendRequestTraceId = new ThreadLocal<>(); |
115 | 122 |
|
116 | 123 | /** The Constant GITHUB_URL. */ |
117 | 124 | static final String GITHUB_URL = "https://api.github.com"; |
118 | 125 |
|
119 | | - static { |
120 | | - MAPPER.registerModule(new JavaTimeModule()); |
121 | | - MAPPER.setVisibility(new VisibilityChecker.Std(NONE, NONE, NONE, NONE, ANY)); |
122 | | - MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); |
123 | | - MAPPER.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS, true); |
124 | | - MAPPER.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE); |
125 | | - } |
126 | | - |
127 | 126 | @Nonnull |
128 | 127 | private static <T> GitHubResponse<T> createResponse(@Nonnull GitHubConnectorResponse connectorResponse, |
129 | 128 | @CheckForNull BodyHandler<T> handler) throws IOException { |
|
0 commit comments