6877759: test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java leaves open file
Reviewed-by: darcy
--- a/langtools/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java Mon Aug 31 18:25:00 2009 -0700
+++ b/langtools/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java Mon Aug 31 19:43:06 2009 -0700
@@ -188,14 +188,18 @@
// Copy the bytes over
System.out.println((new File(".")).getAbsolutePath());
InputStream io = new BufferedInputStream(new FileInputStream(new File(".", "Foo.class")));
- int datum = io.read();
- while(datum != -1) {
- os.write(datum);
- datum = io.read();
+ try {
+ int datum = io.read();
+ while(datum != -1) {
+ os.write(datum);
+ datum = io.read();
+ }
+ } finally {
+ io.close();
}
os.close();
- } catch (IOException io) {
- throw new RuntimeException(io);
+ } catch (IOException ioe) {
+ throw new RuntimeException(ioe);
}