test/tools/javac/TryWithResources/TwrMultiCatch.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -21,11 +21,11 @@
* questions.
*/
/*
* @test
- * @bug 6911256 6964740
+ * @bug 6911256 6964740 7013420
* @author Joseph D. Darcy
* @summary Test that TWR and multi-catch play well together
* @compile TwrMultiCatch.java
* @run main TwrMultiCatch
*/
@@ -46,13 +46,13 @@
CustomCloseException2.class);
}
private static void test(TwrMultiCatch twrMultiCatch,
Class<? extends Exception> expected) {
- try(twrMultiCatch) {
- System.out.println(twrMultiCatch.toString());
- } catch (final CustomCloseException1 |
+ try(TwrMultiCatch tmc = twrMultiCatch) {
+ System.out.println(tmc.toString());
+ } catch (CustomCloseException1 |
CustomCloseException2 exception) {
if (!exception.getClass().equals(expected) ) {
throw new RuntimeException("Unexpected catch!");
}
}
@@ -66,11 +66,11 @@
throw new RuntimeException(rfe);
}
try {
throw t;
- } catch (final CustomCloseException1 |
+ } catch (CustomCloseException1 |
CustomCloseException2 exception) {
throw exception;
} catch (Throwable throwable) {
throw new RuntimeException(throwable);
}