From f7564d58f97f67b2e3d96e4158b2a6d9338c3efd Mon Sep 17 00:00:00 2001 From: Martin Ritchie Date: Mon, 5 Oct 2009 15:00:20 +0000 Subject: Update to ensure system properties are always reset even if exception ocurrs during tearDown git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@821820 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/qpid/test/utils/QpidTestCase.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'java') diff --git a/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java b/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java index 666c97c9de..95ce3a06b5 100644 --- a/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java +++ b/java/systests/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java @@ -1021,14 +1021,19 @@ public class QpidTestCase extends TestCase protected void tearDown() throws java.lang.Exception { - // close all the connections used by this test. - for (Connection c : _connections) + try { - c.close(); + // close all the connections used by this test. + for (Connection c : _connections) + { + c.close(); + } + } + finally{ + // Ensure any problems with close does not interfer with property resets + revertSystemProperties(); + revertLoggingLevels(); } - - revertSystemProperties(); - revertLoggingLevels(); } /** -- cgit v1.2.1