--- a/langtools/src/share/classes/com/sun/tools/javac/sym/Profiles.java Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/sym/Profiles.java Wed Dec 18 10:29:25 2013 -0500
@@ -69,30 +69,24 @@
}
for (int i = 1; i <= 4; i++) {
- BufferedWriter out = new BufferedWriter(new FileWriter(i + ".txt"));
- try {
- for (String type: lists.get(i)) {
+ try (BufferedWriter out = new BufferedWriter(new FileWriter(i + ".txt"))) {
+ for (String type : lists.get(i)) {
out.write(type);
out.newLine();
}
- } finally {
- out.close();
}
}
}
}
public static Profiles read(File file) throws IOException {
- BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
- try {
+ try (BufferedInputStream in = new BufferedInputStream(new FileInputStream(file))) {
Properties p = new Properties();
p.load(in);
if (p.containsKey("java/lang/Object"))
return new SimpleProfiles(p);
else
return new MakefileProfiles(p);
- } finally {
- in.close();
}
}