diff --git a/.mvn/settings.xml b/.mvn/settings.xml index c27552b1..e3568f66 100644 --- a/.mvn/settings.xml +++ b/.mvn/settings.xml @@ -1,26 +1,26 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> - - - central - ${env.SONATYPE_PORTAL_USERNAME} - ${env.SONATYPE_PORTAL_PASSWORD} - - + + + central + ${env.SONATYPE_PORTAL_USERNAME} + ${env.SONATYPE_PORTAL_PASSWORD} + + - - - central - - true - - - gpg - ${env.GPG_PASSPHRASE} - - - + + + central + + true + + + gpg + ${env.GPG_PASSPHRASE} + + + diff --git a/pom.xml b/pom.xml index a71df19b..3e869876 100644 --- a/pom.xml +++ b/pom.xml @@ -47,6 +47,7 @@ UTF-8 UTF-8 17 + 17 3.1.3 1.20.0 2.0.17 @@ -184,7 +185,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.0 + 3.15.0 17 UTF-8 @@ -193,7 +194,7 @@ org.apache.maven.plugins maven-source-plugin - 3.0.1 + 3.4.0 attach-sources @@ -206,7 +207,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.3.2 + 3.12.0 attach-javadocs @@ -258,7 +259,7 @@ org.apache.maven.plugins maven-gpg-plugin - 3.0.1 + 3.2.8 --pinentry-mode @@ -277,7 +278,7 @@ org.sonatype.central central-publishing-maven-plugin - 0.8.0 + 0.10.0 true central diff --git a/src/main/java/org/hisp/dhis/BaseDhis2.java b/src/main/java/org/hisp/dhis/BaseDhis2.java index d02a657c..1858ec03 100644 --- a/src/main/java/org/hisp/dhis/BaseDhis2.java +++ b/src/main/java/org/hisp/dhis/BaseDhis2.java @@ -149,8 +149,6 @@ public class BaseDhis2 { /** Error status codes for GET queries. */ private static final Set GET_ERROR_STATUS_CODES = Set.of(SC_BAD_REQUEST, SC_CONFLICT); - // Fields - // Headers protected static final Header HEADER_CONTENT_TYPE_JSON = @@ -163,7 +161,7 @@ public class BaseDhis2 { protected final Dhis2Config config; - protected final JsonMapper objectMapper; + protected final JsonMapper jsonMapper; protected final CloseableHttpClient httpClient; @@ -175,7 +173,7 @@ public class BaseDhis2 { public BaseDhis2(Dhis2Config config) { Objects.requireNonNull(config, "Config must be specified"); this.config = config; - this.objectMapper = JacksonUtils.getJsonMapper(); + this.jsonMapper = JacksonUtils.getJsonMapper(); this.httpClient = HttpClients.createDefault(); } @@ -503,7 +501,7 @@ protected CompleteDataSetRegistrationResponse saveCompleteDataSetRegistrations( URIBuilder builder = config.getResolvedUriBuilder().appendPath("completeDataSetRegistrations"); URI url = withCompleteDataSetRegistrationsImportQueryParams(builder, options); HttpPost request = getPostRequest(url, entity); - Dhis2AsyncRequest asyncRequest = new Dhis2AsyncRequest(config, httpClient, objectMapper); + Dhis2AsyncRequest asyncRequest = new Dhis2AsyncRequest(config, httpClient, jsonMapper); return asyncRequest.post(request, CompleteDataSetRegistrationResponse.class); } @@ -997,7 +995,7 @@ protected T executeRequest( log(code, "Response body: '{}'", responseBody); - T responseMessage = objectMapper.readValue(responseBody, type); + T responseMessage = jsonMapper.readValue(responseBody, type); responseMessage.setHeaders(asList(response.getHeaders())); responseMessage.setHttpStatusCode(response.getCode()); @@ -1188,7 +1186,7 @@ private void handleErrorsForGet(ClassicHttpResponse response, String url) * @throws IOException if reading failed. */ protected T readValue(String content, Class type) throws IOException { - return objectMapper.readValue(content, type); + return jsonMapper.readValue(content, type); } /** @@ -1284,7 +1282,7 @@ protected T withAuth(T request) { * @throws Dhis2ClientException if the serialization failed. */ protected String toJsonString(Object object) { - String json = objectMapper.writeValueAsString(object); + String json = jsonMapper.writeValueAsString(object); log("Object JSON: '{}'", json); diff --git a/src/main/java/org/hisp/dhis/Dhis2.java b/src/main/java/org/hisp/dhis/Dhis2.java index 4c57f570..ec442758 100644 --- a/src/main/java/org/hisp/dhis/Dhis2.java +++ b/src/main/java/org/hisp/dhis/Dhis2.java @@ -4081,7 +4081,7 @@ public DataValueSetResponse saveDataValueSet( HttpPost request = getPostRequest(url, new StringEntity(toJsonString(dataValueSet), StandardCharsets.UTF_8)); - Dhis2AsyncRequest asyncRequest = new Dhis2AsyncRequest(config, httpClient, objectMapper); + Dhis2AsyncRequest asyncRequest = new Dhis2AsyncRequest(config, httpClient, jsonMapper); return asyncRequest.post(request, DataValueSetResponse.class); } @@ -4100,7 +4100,7 @@ public DataValueSetResponse saveDataValueSet(File file, DataValueSetImportOption HttpPost request = getPostRequest(url, new FileEntity(file, ContentType.APPLICATION_JSON)); - Dhis2AsyncRequest asyncRequest = new Dhis2AsyncRequest(config, httpClient, objectMapper); + Dhis2AsyncRequest asyncRequest = new Dhis2AsyncRequest(config, httpClient, jsonMapper); return asyncRequest.post(request, DataValueSetResponse.class); } @@ -4121,7 +4121,7 @@ public DataValueSetResponse saveDataValueSet( HttpPost request = getPostRequest(url, new InputStreamEntity(inputStream, ContentType.APPLICATION_JSON)); - Dhis2AsyncRequest asyncRequest = new Dhis2AsyncRequest(config, httpClient, objectMapper); + Dhis2AsyncRequest asyncRequest = new Dhis2AsyncRequest(config, httpClient, jsonMapper); return asyncRequest.post(request, DataValueSetResponse.class); } @@ -4319,7 +4319,7 @@ public EventResponse saveEvents(InputStream inputStream) { HttpUtils.build(builder), new InputStreamEntity(inputStream, ContentType.APPLICATION_JSON)); - Dhis2AsyncRequest asyncRequest = new Dhis2AsyncRequest(config, httpClient, objectMapper); + Dhis2AsyncRequest asyncRequest = new Dhis2AsyncRequest(config, httpClient, jsonMapper); return asyncRequest.postEvent(request, EventResponse.class); }