mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8274809: Update java.base classes to use try-with-resources
Reviewed-by: mullan, alanb, dfuchs
This commit is contained in:
parent
debaa28e9c
commit
dee447f8ae
7 changed files with 20 additions and 58 deletions
|
@ -382,9 +382,7 @@ public class MimeTable implements FileNameMap {
|
|||
}
|
||||
|
||||
protected boolean saveAsProperties(File file) {
|
||||
FileOutputStream os = null;
|
||||
try {
|
||||
os = new FileOutputStream(file);
|
||||
try (FileOutputStream os = new FileOutputStream(file)) {
|
||||
Properties properties = getAsProperties();
|
||||
properties.put("temp.file.template", tempFileTemplate);
|
||||
String tag;
|
||||
|
@ -407,11 +405,6 @@ public class MimeTable implements FileNameMap {
|
|||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
if (os != null) {
|
||||
try { os.close(); } catch (IOException e) {}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue