Skip to content

Commit

Permalink
Use try-with-resources in AllowedMethodsFilterTest
Browse files Browse the repository at this point in the history
  • Loading branch information
rhowe committed Feb 2, 2022
1 parent 981bdec commit 350c52f
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,10 @@ protected DeploymentContext configureDeployment() {
}

private int getResponseStatusForRequestMethod(String method, boolean includeEntity) {
final Response resourceResponse = includeEntity
? target("/ping").request().method(method, Entity.entity("", MediaType.TEXT_PLAIN))
: target("/ping").request().method(method);

try {
try (Response resourceResponse = includeEntity
? target("/ping").request().method(method, Entity.entity("", MediaType.TEXT_PLAIN))
: target("/ping").request().method(method)) {
return resourceResponse.getStatus();
} finally {
resourceResponse.close();
}
}

Expand Down

0 comments on commit 350c52f

Please sign in to comment.