You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by gt...@apache.org on 2015/04/23 14:25:23 UTC
activemq git commit: trap potential exception on abortive close
Repository: activemq
Updated Branches:
refs/heads/master 165959e25 -> ac635ddf1
trap potential exception on abortive close
Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/ac635ddf
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/ac635ddf
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/ac635ddf
Branch: refs/heads/master
Commit: ac635ddf1d4861fdaa2370e34c830b71ce2e4b2e
Parents: 165959e
Author: gtully <ga...@gmail.com>
Authored: Thu Apr 23 13:25:39 2015 +0100
Committer: gtully <ga...@gmail.com>
Committed: Thu Apr 23 13:25:39 2015 +0100
----------------------------------------------------------------------
.../src/test/java/org/apache/activemq/TestSupport.java | 7 +++++++
.../activemq/broker/RedeliveryRestartWithExceptionTest.java | 4 ++--
2 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq/blob/ac635ddf/activemq-unit-tests/src/test/java/org/apache/activemq/TestSupport.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/TestSupport.java b/activemq-unit-tests/src/test/java/org/apache/activemq/TestSupport.java
index 37a74f9..5f7216a 100755
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/TestSupport.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/TestSupport.java
@@ -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) {}
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/activemq/blob/ac635ddf/activemq-unit-tests/src/test/java/org/apache/activemq/broker/RedeliveryRestartWithExceptionTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/RedeliveryRestartWithExceptionTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/RedeliveryRestartWithExceptionTest.java
index 5d8b62e..2d840ab 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/RedeliveryRestartWithExceptionTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/RedeliveryRestartWithExceptionTest.java
@@ -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();