From 43b5a3c4a93a71ac8845df59cdbe28790a06efeb Mon Sep 17 00:00:00 2001 From: Patrick Huang Date: Mon, 26 Sep 2016 15:24:13 +1000 Subject: [PATCH] ZNTA-1271 - close response --- .../main/java/org/zanata/rest/client/AccountClient.java | 7 +++++-- .../main/java/org/zanata/rest/client/GlossaryClient.java | 3 ++- .../main/java/org/zanata/rest/client/ProjectClient.java | 4 +++- .../org/zanata/rest/client/ProjectIterationClient.java | 4 +++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/zanata-rest-client/src/main/java/org/zanata/rest/client/AccountClient.java b/zanata-rest-client/src/main/java/org/zanata/rest/client/AccountClient.java index 2c15f8ee..260e7adb 100644 --- a/zanata-rest-client/src/main/java/org/zanata/rest/client/AccountClient.java +++ b/zanata-rest-client/src/main/java/org/zanata/rest/client/AccountClient.java @@ -26,6 +26,7 @@ import javax.ws.rs.client.Entity; import javax.ws.rs.client.Invocation; import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; import org.zanata.rest.MediaTypes; import org.zanata.rest.dto.Account; @@ -49,8 +50,10 @@ public Account get(String username) { } public void put(String username, Account account) { - webResource(username) - .put(Entity.entity(account, MediaTypes.APPLICATION_ZANATA_ACCOUNT_XML)); + Response response = webResource(username) + .put(Entity.entity(account, + MediaTypes.APPLICATION_ZANATA_ACCOUNT_XML)); + response.close(); } private Invocation.Builder webResource(String username) { diff --git a/zanata-rest-client/src/main/java/org/zanata/rest/client/GlossaryClient.java b/zanata-rest-client/src/main/java/org/zanata/rest/client/GlossaryClient.java index e56be907..10c55c0f 100644 --- a/zanata-rest-client/src/main/java/org/zanata/rest/client/GlossaryClient.java +++ b/zanata-rest-client/src/main/java/org/zanata/rest/client/GlossaryClient.java @@ -76,10 +76,11 @@ public Response downloadFile(String fileType, } public void delete(String id, String qualifiedName) { - webResource().path("entries/" + id) + Response response = webResource().path("entries/" + id) .queryParam("qualifiedName", qualifiedName) .request(MediaType.APPLICATION_JSON_TYPE) .delete(); + response.close(); } public int deleteAll(String qualifiedName) { diff --git a/zanata-rest-client/src/main/java/org/zanata/rest/client/ProjectClient.java b/zanata-rest-client/src/main/java/org/zanata/rest/client/ProjectClient.java index ee4f4e64..b9485cf0 100644 --- a/zanata-rest-client/src/main/java/org/zanata/rest/client/ProjectClient.java +++ b/zanata-rest-client/src/main/java/org/zanata/rest/client/ProjectClient.java @@ -24,6 +24,7 @@ import javax.ws.rs.client.Entity; import javax.ws.rs.client.Invocation; import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; import org.zanata.rest.dto.Project; @@ -53,7 +54,8 @@ private Invocation.Builder webResource() { } public void put(Project project) { - webResource().put(Entity.xml(project)); + Response response = webResource().put(Entity.xml(project)); + response.close(); } } diff --git a/zanata-rest-client/src/main/java/org/zanata/rest/client/ProjectIterationClient.java b/zanata-rest-client/src/main/java/org/zanata/rest/client/ProjectIterationClient.java index 49a91bf7..aa798cf3 100644 --- a/zanata-rest-client/src/main/java/org/zanata/rest/client/ProjectIterationClient.java +++ b/zanata-rest-client/src/main/java/org/zanata/rest/client/ProjectIterationClient.java @@ -26,6 +26,7 @@ import javax.ws.rs.client.Entity; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; import org.zanata.rest.dto.ProjectIteration; @@ -60,8 +61,9 @@ private WebTarget webResource() { } public void put(ProjectIteration projectVersion) { - webResource().request() + Response response = webResource().request() .put(Entity.xml(projectVersion)); + response.close(); } public String sampleConfiguration() {