Hi Stuart,
I'm unclear how try-with-resources applies in different cases. For
example, here in Package.java:
private static Manifest loadManifest(String fn) {
try (FileInputStream fis = new FileInputStream(fn);
JarInputStream jis = new JarInputStream(fis, false))
{
return jis.getManifest();
} catch (IOException e) {
return null;
}
}
from which code will the the explicit catch block actually catch
IOException? Does this act as-if it were written:
try {
try (FileInputStream fis = new FileInputStream(fn);
JarInputStream jis = new JarInputStream(fis, false))
{
return jis.getManifest();
}
} catch (IOException e) {
return null;
}
If so it seems a bit redundant to jump through all the suppressed
exception stuff only to throw away any exception and return null.
David
-----
Stuart Marks said the following on 02/22/11 12:05:
Hi all,
The following webrev changes a variety of files in java.lang, math, and
util, and their corresponding tests, to use the new Java 7
try-with-resources construct. I think most of the changes should be
straightforward. In a few cases (e.g., Currency.java and
LocalGregorianCalendar.java) there was no close() call in the original
code so the open file was always leaked.
Naoto, several of the util changes look like they're in the
internationalization area. I don't know if you're the right person to
review them; if not, please forward or cc this to the right person. Or,
should I forward this to something like i18n-dev?
Webrev is here:
http://cr.openjdk.java.net/~smarks/reviews/7021209/webrev.0/
Thanks!
s'marks