src/share/classes/java/util/Currency.java

Print this page
rev 3509 : 7021209: convert lang, math, util to use try-with-resources
Reviewed-by: XXX

@@ -231,11 +231,13 @@
                     File propFile = new File(homeDir + File.separator +
                                              "lib" + File.separator +
                                              "currency.properties");
                     if (propFile.exists()) {
                         Properties props = new Properties();
-                        props.load(new FileReader(propFile));
+                        try (FileReader fr = new FileReader(propFile)) {
+                            props.load(fr);
+                        }
                         Set<String> keys = props.stringPropertyNames();
                         Pattern propertiesPattern =
                             Pattern.compile("([A-Z]{3})\\s*,\\s*(\\d{3})\\s*,\\s*([0-3])");
                         for (String key : keys) {
                            replaceCurrencyData(propertiesPattern,