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:
@@ -97,14 +97,10 @@ public class SampleIntegrationApplicationTests {
|
||||
}
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (Resource resource : resources) {
|
||||
InputStream inputStream = resource.getInputStream();
|
||||
try {
|
||||
try (InputStream inputStream = resource.getInputStream()) {
|
||||
builder.append(new String(
|
||||
StreamUtils.copyToByteArray(inputStream)));
|
||||
}
|
||||
finally {
|
||||
inputStream.close();
|
||||
}
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user