diff -r 4660a5da7d90 -r 030080f03e4f langtools/test/tools/javac/tree/TestToString.java --- a/langtools/test/tools/javac/tree/TestToString.java Wed Oct 29 12:09:17 2014 +0100 +++ b/langtools/test/tools/javac/tree/TestToString.java Wed Oct 29 17:25:23 2014 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -63,12 +63,16 @@ } void run() throws Exception { - for (String s: statements) { - test(s); + try { + for (String s: statements) { + test(s); + } + + if (errors > 0) + throw new Exception(errors + " errors found"); + } finally { + fm.close(); } - - if (errors > 0) - throw new Exception(errors + " errors found"); } void test(String stmt) throws IOException {