import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Reader;
boolean found = false;
if (!resetToDefault && dir != null) {
- // Look into Bundles.getDirectory() for .properties files
try {
+ // Look into Bundles.getDirectory() for .properties files
File file = getPropertyFile(dir, name.name(), locale);
if (file != null) {
- Reader reader = new InputStreamReader(new FileInputStream(
- file), "UTF-8");
- resetMap(new PropertyResourceBundle(reader));
+ InputStream in = new FileInputStream(file);
+ try {
+ Reader reader = new InputStreamReader(in, "UTF-8");
+ try {
+ resetMap(new PropertyResourceBundle(reader));
+ } finally {
+ reader.close();
+ }
+ } finally {
+ in.close();
+ }
found = true;
}
} catch (IOException e) {