jdk/src/share/classes/sun/applet/Main.java
changeset 21785 fc0bfa7d9d95
parent 7498 fded0c3584f8
child 22584 eed64ee05369
--- a/jdk/src/share/classes/sun/applet/Main.java	Fri Nov 15 17:40:34 2013 +0400
+++ b/jdk/src/share/classes/sun/applet/Main.java	Mon Nov 18 19:22:29 2013 +0400
@@ -432,10 +432,8 @@
             }
 
             // SAVE THE FILE
-            try {
-                FileOutputStream out = new FileOutputStream(dotAV);
+            try (FileOutputStream out = new FileOutputStream(dotAV)) {
                 avProps.store(out, lookup("main.prop.store"));
-                out.close();
             } catch (IOException e) {
                 System.err.println(lookup("main.err.prop.cantsave",
                                           dotAV.toString()));
@@ -472,13 +470,10 @@
 
         // read the file
         Properties tmpProps = new Properties();
-        try {
-            FileInputStream in = new FileInputStream(inFile);
+        try (FileInputStream in = new FileInputStream(inFile)) {
             tmpProps.load(new BufferedInputStream(in));
-            in.close();
         } catch (IOException e) {
-            System.err.println(lookup("main.err.prop.cantread",
-                                      inFile.toString()));
+            System.err.println(lookup("main.err.prop.cantread", inFile.toString()));
         }
 
         // pick off the properties we care about