trap potential exception on abortive close

This commit is contained in:
gtully 2015-04-23 13:25:39 +01:00
parent 165959e250
commit ac635ddf1d
2 changed files with 9 additions and 2 deletions

View File

@ -238,4 +238,11 @@ public abstract class TestSupport extends CombinationTestSupport {
assertFalse("Base directory cannot contain spaces.", new File(System.getProperty("basedir", ".")).getAbsoluteFile().toString().contains(" "));
}
public void safeCloseConnection(Connection c) {
if (c != null) {
try {
c.close();
} catch (JMSException ignored) {}
}
}
}

View File

@ -119,7 +119,7 @@ public class RedeliveryRestartWithExceptionTest extends TestSupport {
assertNotNull("Expecting an exception when updateMessage fails", expectedException);
consumer.close();
connection.close();
safeCloseConnection(connection);
restartBroker();
@ -187,7 +187,7 @@ public class RedeliveryRestartWithExceptionTest extends TestSupport {
assertNotNull("Expecting an exception when updateMessage fails", expectedException);
consumer.close();
connection.close();
safeCloseConnection(connection);
connection = (ActiveMQConnection) connectionFactory.createConnection();
connection.start();