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:
@@ -201,13 +201,9 @@ public class AutoConfigureAnnotationProcessor extends AbstractProcessor {
|
||||
if (!this.properties.isEmpty()) {
|
||||
FileObject file = this.processingEnv.getFiler()
|
||||
.createResource(StandardLocation.CLASS_OUTPUT, "", PROPERTIES_PATH);
|
||||
OutputStream outputStream = file.openOutputStream();
|
||||
try {
|
||||
try (OutputStream outputStream = file.openOutputStream()) {
|
||||
this.properties.store(outputStream, null);
|
||||
}
|
||||
finally {
|
||||
outputStream.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,15 +62,11 @@ public class TestConditionMetadataAnnotationProcessor
|
||||
if (!file.exists()) {
|
||||
return null;
|
||||
}
|
||||
FileInputStream inputStream = new FileInputStream(file);
|
||||
try {
|
||||
try (FileInputStream inputStream = new FileInputStream(file)) {
|
||||
Properties properties = new Properties();
|
||||
properties.load(inputStream);
|
||||
return properties;
|
||||
}
|
||||
finally {
|
||||
inputStream.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user