Polish "Use try-with-resources to close resources automatically"
- Apply code formatting - Use try-with-resources in many other places that were missed in the pull request Closes gh-8045
This commit is contained in:
@@ -75,15 +75,11 @@ public class SampleTomcatApplicationTests {
|
||||
ResponseEntity<byte[]> entity = this.restTemplate.exchange("/", HttpMethod.GET,
|
||||
requestEntity, byte[].class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
GZIPInputStream inflater = new GZIPInputStream(
|
||||
new ByteArrayInputStream(entity.getBody()));
|
||||
try {
|
||||
try (GZIPInputStream inflater = new GZIPInputStream(
|
||||
new ByteArrayInputStream(entity.getBody()))) {
|
||||
assertThat(StreamUtils.copyToString(inflater, Charset.forName("UTF-8")))
|
||||
.isEqualTo("Hello World");
|
||||
}
|
||||
finally {
|
||||
inflater.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user