Fix for issue #5777 - java/jersey2 ApiClient.invokeAPI doesn´t close the Response object (#5782)

* Update ApiClient.mustache

Fix for issue #5777

* Update ApiClient.mustache

* Create ApiClient.mustache

* Run java-petstore-jersey2.sh
This commit is contained in:
Moscagus 2017-06-14 13:45:14 -03:00 committed by wing328
parent 77c14bca39
commit f2276e5b35
2 changed files with 96 additions and 80 deletions

View File

@ -682,8 +682,9 @@ public class ApiClient {
Entity<?> entity = serialize(body, formParams, contentType);
Response response;
Response response = null;
try {
if ("GET".equals(method)) {
response = invocationBuilder.get();
} else if ("POST".equals(method)) {
@ -725,6 +726,13 @@ public class ApiClient {
buildResponseHeaders(response),
respBody);
}
} finally {
try {
response.close();
} catch (Exception e) {
// it's not critical, since the response object is local in method invokeAPI; that's fine, just continue
}
}
}
/**

View File

@ -671,8 +671,9 @@ public class ApiClient {
Entity<?> entity = serialize(body, formParams, contentType);
Response response;
Response response = null;
try {
if ("GET".equals(method)) {
response = invocationBuilder.get();
} else if ("POST".equals(method)) {
@ -714,6 +715,13 @@ public class ApiClient {
buildResponseHeaders(response),
respBody);
}
} finally {
try {
response.close();
} catch (Exception e) {
// it's not critical, since the response object is local in method invokeAPI; that's fine, just continue
}
}
}
/**