summaryrefslogtreecommitdiff
path: root/qpid/java/broker-core
diff options
context:
space:
mode:
authorRobert Godfrey <rgodfrey@apache.org>2014-02-14 10:52:47 +0000
committerRobert Godfrey <rgodfrey@apache.org>2014-02-14 10:52:47 +0000
commit50b314a51a2c787fcd412a84cb8464f72e3868b4 (patch)
treefa6e85db6da742fbb9b235ca3e1d036d288ae970 /qpid/java/broker-core
parent08b64b592cb844cbd746b33e5f17c94b2158a115 (diff)
downloadqpid-python-50b314a51a2c787fcd412a84cb8464f72e3868b4.tar.gz
QPID-5551 : Remove uses of AMQException, add ServerScopedRuntimeException and ConnectionScopedRuntimeException
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1568235 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-core')
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/TransactionTimeoutHelper.java7
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/JsonConfigurationEntryStore.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/StoreConfigurationChangeListener.java5
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/ChangeAttributesTask.java4
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/ChangeStateTask.java2
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/CreateChildTask.java2
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/SetAttributeTask.java2
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/TaskExecutor.java76
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/connection/IConnectionRegistry.java4
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/consumer/Consumer.java6
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/consumer/ConsumerTarget.java1
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AMQUnknownExchangeType.java41
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java33
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchange.java19
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java8
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeRegistry.java7
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DirectExchange.java2
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DirectExchangeType.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/Exchange.java21
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeFactory.java7
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeInitialiser.java9
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeRegistry.java8
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/FanoutExchange.java2
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/FanoutExchangeType.java2
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersBinding.java2
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersExchangeType.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/TopicExchange.java6
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/TopicExchangeType.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/AMQInvalidArgumentException.java (renamed from qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MessageStoreClosedException.java)29
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/FilterManagerFactory.java4
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/FilterSupport.java1
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/NoConsumerFilter.java48
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/AbstractServerMessageImpl.java5
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/MessageSource.java16
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessage.java10
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaData.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaDataType.java5
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractAdapter.java2
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AmqpPortAdapter.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderAdapter.java5
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BindingAdapter.java5
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java10
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ExchangeAdapter.java9
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProvider.java4
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/KeyStoreAdapter.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/QueueAdapter.java17
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAdapter.java33
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/ExchangeType.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/QpidServiceLoader.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/VirtualHostFactory.java2
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/protocol/AMQConnectionModel.java7
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/protocol/AMQSessionModel.java7
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueue.java10
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java42
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/BaseQueue.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueConsumer.java14
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueEntryImpl.java1
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueFactory.java5
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueRunner.java14
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java28
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SortedQueue.java3
-rwxr-xr-xqpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SubFlushRunner.java1
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/database/HashedUser.java5
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManager.java21
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ldap/LDAPSSLSocketFactoryGenerator.java17
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HashedSaslServer.java4
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HexSaslServer.java4
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/group/FileGroupDatabase.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AMQStoreException.java47
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java171
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractMemoryMessageStore.java20
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationRecoverer.java4
-rwxr-xr-xqpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStore.java4
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStoreHelper.java76
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java96
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MessageStore.java6
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/NullMessageStore.java16
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/Transaction.java22
-rwxr-xr-xqpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/AsyncAutoCommitTransaction.java41
-rwxr-xr-xqpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/AutoCommitTransaction.java41
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DtxBranch.java17
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DtxRegistry.java2
-rwxr-xr-xqpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/LocalTransaction.java66
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/ConnectionScopedRuntimeException.java17
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/MapJsonSerializer.java4
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/ServerScopedRuntimeException.java17
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java61
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/BindingRecoverer.java5
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeExistsException.java3
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeIsAlternateException.java7
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeRecoverer.java11
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueExistsException.java (renamed from qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/plugins/QueueExistsException.java)5
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueRecoverer.java5
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/RequiredExchangeException.java7
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ReservedExchangeNameException.java4
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHost.java39
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHostFactory.java2
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/UnknownExchangeException.java7
-rwxr-xr-xqpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java13
-rwxr-xr-xqpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java118
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/updater/TaskExecutorTest.java64
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/consumer/MockConsumer.java10
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/DefaultExchangeFactoryTest.java3
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/FanoutExchangeTest.java12
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java3
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java4
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/logging/actors/AMQPConnectionActorTest.java3
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/logging/actors/CurrentActorTest.java4
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/AMQQueueFactoryTest.java2
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java20
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/MockMessageInstance.java1
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/PriorityQueueTest.java8
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/QueueEntryImplTestBase.java3
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/QueueEntryListTestBase.java9
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SimpleAMQQueueTestBase.java31
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SimpleQueueEntryImplTest.java6
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SortedQueueEntryListTest.java5
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SortedQueueEntryTest.java3
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/StandardQueueEntryListTest.java3
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/StandardQueueTest.java2
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/AbstractDurableConfigurationStoreTestCase.java1
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/JsonFileConfigStoreTest.java9
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java11
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/txn/MockStoreTransaction.java16
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java7
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/DurableConfigurationRecovererTest.java2
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java9
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/StandardVirtualHostTest.java13
128 files changed, 947 insertions, 968 deletions
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/TransactionTimeoutHelper.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/TransactionTimeoutHelper.java
index b7007bf768..13f4fbf254 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/TransactionTimeoutHelper.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/TransactionTimeoutHelper.java
@@ -18,7 +18,6 @@
*/
package org.apache.qpid.server;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.logging.LogActor;
import org.apache.qpid.server.logging.LogMessage;
import org.apache.qpid.server.logging.LogSubject;
@@ -41,7 +40,7 @@ public class TransactionTimeoutHelper
_closeAction = closeAction;
}
- public void checkIdleOrOpenTimes(ServerTransaction transaction, long openWarn, long openClose, long idleWarn, long idleClose) throws AMQException
+ public void checkIdleOrOpenTimes(ServerTransaction transaction, long openWarn, long openClose, long idleWarn, long idleClose)
{
if (transaction.isTransactional())
{
@@ -70,7 +69,7 @@ public class TransactionTimeoutHelper
*/
private boolean logAndCloseIfNecessary(final long timeSoFar,
final long warnTimeout, final long closeTimeout,
- final LogMessage warnMessage, final String closeMessage) throws AMQException
+ final LogMessage warnMessage, final String closeMessage)
{
if (isTimedOut(timeSoFar, warnTimeout))
{
@@ -96,7 +95,7 @@ public class TransactionTimeoutHelper
public interface CloseAction
{
- void doTimeoutAction(String reason) throws AMQException;
+ void doTimeoutAction(String reason);
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/JsonConfigurationEntryStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/JsonConfigurationEntryStore.java
index df82822a86..4897983caf 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/JsonConfigurationEntryStore.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/JsonConfigurationEntryStore.java
@@ -28,6 +28,7 @@ import java.util.UUID;
import org.apache.qpid.server.configuration.ConfigurationEntry;
import org.apache.qpid.server.configuration.ConfigurationEntryStore;
import org.apache.qpid.server.configuration.IllegalConfigurationException;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class JsonConfigurationEntryStore extends MemoryConfigurationEntryStore
{
@@ -49,7 +50,7 @@ public class JsonConfigurationEntryStore extends MemoryConfigurationEntryStore
{
if(!_storeFile.delete())
{
- throw new RuntimeException("Unable to overwrite existing configuration store file as requested: " + storeLocation);
+ throw new ServerScopedRuntimeException("Unable to overwrite existing configuration store file as requested: " + storeLocation);
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/StoreConfigurationChangeListener.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/StoreConfigurationChangeListener.java
index 6cd3447ebd..076c86fcba 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/StoreConfigurationChangeListener.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/store/StoreConfigurationChangeListener.java
@@ -37,6 +37,7 @@ import org.apache.qpid.server.model.Model;
import org.apache.qpid.server.model.Port;
import org.apache.qpid.server.model.State;
import org.apache.qpid.server.model.VirtualHost;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class StoreConfigurationChangeListener implements ConfigurationChangeListener
{
@@ -148,7 +149,7 @@ public class StoreConfigurationChangeListener implements ConfigurationChangeList
if (interfaces.size() == 0)
{
- throw new RuntimeException("Can not identify the configured object type");
+ throw new ServerScopedRuntimeException("Can not identify the configured object type");
}
if (interfaces.size() == 1)
@@ -185,7 +186,7 @@ public class StoreConfigurationChangeListener implements ConfigurationChangeList
}
else
{
- throw new RuntimeException("Can not identify the configured object type as an it implements"
+ throw new ServerScopedRuntimeException("Can not identify the configured object type as an it implements"
+ " more than one configured object interfaces: " + interfaces);
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/ChangeAttributesTask.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/ChangeAttributesTask.java
index 4ba4057fee..fb672635b4 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/ChangeAttributesTask.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/ChangeAttributesTask.java
@@ -25,7 +25,7 @@ import java.util.concurrent.Callable;
import org.apache.qpid.server.model.ConfiguredObject;
-public class ChangeAttributesTask implements Callable<Void>
+public class ChangeAttributesTask implements TaskExecutor.Task<Void>
{
private final Map<String, Object> _attributes;
private final ConfiguredObject _object;
@@ -38,7 +38,7 @@ public class ChangeAttributesTask implements Callable<Void>
}
@Override
- public Void call() throws Exception
+ public Void call()
{
_object.setAttributes(_attributes);
return null;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/ChangeStateTask.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/ChangeStateTask.java
index b6de1e136a..42ce1d8c03 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/ChangeStateTask.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/ChangeStateTask.java
@@ -25,7 +25,7 @@ import java.util.concurrent.Callable;
import org.apache.qpid.server.model.ConfiguredObject;
import org.apache.qpid.server.model.State;
-public final class ChangeStateTask implements Callable<State>
+public final class ChangeStateTask implements TaskExecutor.Task<State>
{
private ConfiguredObject _object;
private State _expectedState;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/CreateChildTask.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/CreateChildTask.java
index d3a8f5b797..27bc6d73f6 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/CreateChildTask.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/CreateChildTask.java
@@ -26,7 +26,7 @@ import java.util.concurrent.Callable;
import org.apache.qpid.server.model.ConfiguredObject;
-public final class CreateChildTask implements Callable<ConfiguredObject>
+public final class CreateChildTask implements TaskExecutor.Task<ConfiguredObject>
{
private ConfiguredObject _object;
private Class<? extends ConfiguredObject> _childClass;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/SetAttributeTask.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/SetAttributeTask.java
index 94649434e6..f8d29c368b 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/SetAttributeTask.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/SetAttributeTask.java
@@ -24,7 +24,7 @@ import java.util.concurrent.Callable;
import org.apache.qpid.server.model.ConfiguredObject;
-public final class SetAttributeTask implements Callable<Object>
+public final class SetAttributeTask implements TaskExecutor.Task<Object>
{
private ConfiguredObject _object;
private String _attributeName;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/TaskExecutor.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/TaskExecutor.java
index 22863c089e..3104df6b00 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/TaskExecutor.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/TaskExecutor.java
@@ -42,6 +42,7 @@ import org.apache.qpid.server.logging.LogActor;
import org.apache.qpid.server.logging.actors.CurrentActor;
import org.apache.qpid.server.model.State;
import org.apache.qpid.server.security.SecurityManager;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class TaskExecutor
{
@@ -52,6 +53,11 @@ public class TaskExecutor
private final AtomicReference<State> _state;
private volatile ExecutorService _executor;
+ public static interface Task<X> extends Callable<X>
+ {
+ X call();
+ }
+
public TaskExecutor()
{
_state = new AtomicReference<State>(State.INITIALISING);
@@ -122,17 +128,17 @@ public class TaskExecutor
}
}
- Future<?> submit(Callable<?> task)
+ <T> Future<T> submit(Task<T> task)
{
checkState();
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("Submitting task: " + task);
}
- Future<?> future = null;
+ Future<T> future = null;
if (isTaskExecutorThread())
{
- Object result = executeTaskAndHandleExceptions(task);
+ T result = executeTask(task);
return new ImmediateFuture(result);
}
else
@@ -142,16 +148,16 @@ public class TaskExecutor
return future;
}
- public Object submitAndWait(Callable<?> task) throws CancellationException
+ public <T> T submitAndWait(Task<T> task) throws CancellationException
{
try
{
- Future<?> future = submit(task);
+ Future<T> future = submit(task);
return future.get();
}
catch (InterruptedException e)
{
- throw new RuntimeException("Task execution was interrupted: " + task, e);
+ throw new ServerScopedRuntimeException("Task execution was interrupted: " + task, e);
}
catch (ExecutionException e)
{
@@ -162,7 +168,7 @@ public class TaskExecutor
}
else if (cause instanceof Exception)
{
- throw new RuntimeException("Failed to execute user task: " + task, cause);
+ throw new ServerScopedRuntimeException("Failed to execute user task: " + task, cause);
}
else if (cause instanceof Error)
{
@@ -170,7 +176,7 @@ public class TaskExecutor
}
else
{
- throw new RuntimeException("Failed to execute user task: " + task, cause);
+ throw new ServerScopedRuntimeException("Failed to execute user task: " + task, cause);
}
}
}
@@ -188,29 +194,13 @@ public class TaskExecutor
}
}
- private Object executeTaskAndHandleExceptions(Callable<?> userTask)
- {
- try
- {
- return executeTask(userTask);
- }
- catch (Exception e)
- {
- if (e instanceof RuntimeException)
- {
- throw (RuntimeException) e;
- }
- throw new RuntimeException("Failed to execute user task: " + userTask, e);
- }
- }
-
- private Object executeTask(Callable<?> userTask) throws Exception
+ private <T> T executeTask(Task<T> userTask)
{
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("Performing task " + userTask);
}
- Object result = userTask.call();
+ T result = userTask.call();
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("Task " + userTask + " is performed successfully with result:" + result);
@@ -218,14 +208,14 @@ public class TaskExecutor
return result;
}
- private class CallableWrapper implements Callable<Object>
+ private class CallableWrapper<T> implements Task<T>
{
- private Callable<?> _userTask;
+ private Task<T> _userTask;
private Subject _securityManagerSubject;
private LogActor _actor;
private Subject _contextSubject;
- public CallableWrapper(Callable<?> userWork)
+ public CallableWrapper(Task<T> userWork)
{
_userTask = userWork;
_securityManagerSubject = SecurityManager.getThreadSubject();
@@ -234,20 +224,20 @@ public class TaskExecutor
}
@Override
- public Object call() throws Exception
+ public T call()
{
SecurityManager.setThreadSubject(_securityManagerSubject);
CurrentActor.set(_actor);
try
{
- Object result = null;
+ T result = null;
try
{
- result = Subject.doAs(_contextSubject, new PrivilegedExceptionAction<Object>()
+ result = Subject.doAs(_contextSubject, new PrivilegedExceptionAction<T>()
{
@Override
- public Object run() throws Exception
+ public T run() throws Exception
{
return executeTask(_userTask);
}
@@ -255,7 +245,15 @@ public class TaskExecutor
}
catch (PrivilegedActionException e)
{
- throw e.getException();
+ Exception underlying = e.getException();
+ if(underlying instanceof RuntimeException)
+ {
+ throw (RuntimeException)underlying;
+ }
+ else
+ {
+ throw new ServerScopedRuntimeException(e);
+ }
}
return result;
}
@@ -281,11 +279,11 @@ public class TaskExecutor
}
}
- private class ImmediateFuture implements Future<Object>
+ private class ImmediateFuture<T> implements Future<T>
{
- private Object _result;
+ private T _result;
- public ImmediateFuture(Object result)
+ public ImmediateFuture(T result)
{
super();
this._result = result;
@@ -310,13 +308,13 @@ public class TaskExecutor
}
@Override
- public Object get()
+ public T get()
{
return _result;
}
@Override
- public Object get(long timeout, TimeUnit unit)
+ public T get(long timeout, TimeUnit unit)
{
return get();
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/connection/IConnectionRegistry.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/connection/IConnectionRegistry.java
index 77febd9312..209e2739f4 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/connection/IConnectionRegistry.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/connection/IConnectionRegistry.java
@@ -20,8 +20,6 @@
*/
package org.apache.qpid.server.connection;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.protocol.AMQConstant;
import org.apache.qpid.server.protocol.AMQConnectionModel;
import java.util.List;
@@ -33,7 +31,7 @@ public interface IConnectionRegistry
public void initialise();
- public void close() throws AMQException;
+ public void close();
public void close(String replyText);
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/consumer/Consumer.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/consumer/Consumer.java
index 76eb7e8c14..e23eb397e1 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/consumer/Consumer.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/consumer/Consumer.java
@@ -21,11 +21,7 @@
package org.apache.qpid.server.consumer;
import java.util.concurrent.atomic.AtomicLong;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.logging.LogActor;
-import org.apache.qpid.server.message.MessageInstance;
import org.apache.qpid.server.protocol.AMQSessionModel;
-import org.apache.qpid.server.util.StateChangeListener;
public interface Consumer
{
@@ -64,7 +60,7 @@ public interface Consumer
boolean seesRequeues();
- void close() throws AMQException;
+ void close();
boolean trySendLock();
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/consumer/ConsumerTarget.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/consumer/ConsumerTarget.java
index a32fd7fc59..8f6b008f9b 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/consumer/ConsumerTarget.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/consumer/ConsumerTarget.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.consumer;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.message.MessageInstance;
import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.protocol.AMQSessionModel;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AMQUnknownExchangeType.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AMQUnknownExchangeType.java
new file mode 100644
index 0000000000..2e39973c11
--- /dev/null
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AMQUnknownExchangeType.java
@@ -0,0 +1,41 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.qpid.server.exchange;
+
+/**
+ * AMQUnknownExchangeType represents coding error where unknown exchange type requested from exchange factory.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Represents unknown exchange type request.
+ * <tr><td>
+ *
+ * @todo Represent coding error, where unknown exchange type is requested by passing a string parameter. Use a type safe
+ * enum for the exchange type, or replace with IllegalArgumentException. Should be runtime.
+ */
+public class AMQUnknownExchangeType extends Exception
+{
+ public AMQUnknownExchangeType(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java
index 07fb554638..6f1db59b1a 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java
@@ -22,8 +22,6 @@ package org.apache.qpid.server.exchange;
import java.util.ArrayList;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQInternalException;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.server.binding.Binding;
import org.apache.qpid.server.consumer.Consumer;
@@ -113,7 +111,6 @@ public abstract class AbstractExchange implements Exchange
String name,
boolean durable,
boolean autoDelete)
- throws AMQException
{
_virtualHost = host;
_name = name;
@@ -137,7 +134,7 @@ public abstract class AbstractExchange implements Exchange
return _autoDelete;
}
- public void close() throws QpidSecurityException, AMQInternalException
+ public void close() throws QpidSecurityException
{
if(_closed.compareAndSet(false,true))
@@ -457,19 +454,17 @@ public abstract class AbstractExchange implements Exchange
public void postCommit()
{
- for(int i = 0; i < baseQueues.length; i++)
+ try
{
- try
+ for(int i = 0; i < baseQueues.length; i++)
{
baseQueues[i].enqueue(message, postEnqueueAction);
}
- catch (AMQException e)
- {
- // TODO
- throw new RuntimeException(e);
- }
}
- _reference.release();
+ finally
+ {
+ _reference.release();
+ }
}
public void onRollback()
@@ -531,7 +526,7 @@ public abstract class AbstractExchange implements Exchange
@Override
public boolean addBinding(String bindingKey, AMQQueue queue, Map<String, Object> arguments)
- throws QpidSecurityException, AMQInternalException
+ throws QpidSecurityException
{
return makeBinding(null, bindingKey, queue, arguments, false, false);
}
@@ -540,7 +535,7 @@ public abstract class AbstractExchange implements Exchange
public boolean replaceBinding(final UUID id, final String bindingKey,
final AMQQueue queue,
final Map<String, Object> arguments)
- throws QpidSecurityException, AMQInternalException
+ throws QpidSecurityException
{
return makeBinding(id, bindingKey, queue, arguments, false, true);
}
@@ -548,20 +543,20 @@ public abstract class AbstractExchange implements Exchange
@Override
public void restoreBinding(final UUID id, final String bindingKey, final AMQQueue queue,
final Map<String, Object> argumentMap)
- throws QpidSecurityException, AMQInternalException
+ throws QpidSecurityException
{
makeBinding(id, bindingKey,queue, argumentMap,true, false);
}
@Override
- public void removeBinding(final Binding b) throws QpidSecurityException, AMQInternalException
+ public void removeBinding(final Binding b) throws QpidSecurityException
{
removeBinding(b.getBindingKey(), b.getQueue(), b.getArguments());
}
@Override
public Binding removeBinding(String bindingKey, AMQQueue queue, Map<String, Object> arguments)
- throws QpidSecurityException, AMQInternalException
+ throws QpidSecurityException
{
assert queue != null;
@@ -627,7 +622,7 @@ public abstract class AbstractExchange implements Exchange
AMQQueue queue,
Map<String, Object> arguments,
boolean restore,
- boolean force) throws QpidSecurityException, AMQInternalException
+ boolean force) throws QpidSecurityException
{
assert queue != null;
@@ -695,7 +690,7 @@ public abstract class AbstractExchange implements Exchange
}
- public void onClose(final Exchange exchange) throws QpidSecurityException, AMQInternalException
+ public void onClose(final Exchange exchange) throws QpidSecurityException
{
removeBinding(this);
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchange.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchange.java
index acb9a47096..d7dfcfbfc5 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchange.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchange.java
@@ -27,8 +27,6 @@ import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQInternalException;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.server.binding.Binding;
@@ -72,7 +70,7 @@ public class DefaultExchange implements Exchange
VirtualHost host,
String name,
boolean durable,
- boolean autoDelete) throws AMQException
+ boolean autoDelete)
{
_id = id;
_virtualHost = host;
@@ -122,34 +120,34 @@ public class DefaultExchange implements Exchange
@Override
public boolean addBinding(String bindingKey, AMQQueue queue, Map<String, Object> arguments)
- throws QpidSecurityException, AMQInternalException
+ throws QpidSecurityException
{
throw new QpidSecurityException("Cannot add bindings to the default exchange");
}
@Override
public boolean replaceBinding(UUID id, String bindingKey, AMQQueue queue, Map<String, Object> arguments)
- throws QpidSecurityException, AMQInternalException
+ throws QpidSecurityException
{
throw new QpidSecurityException("Cannot replace bindings on the default exchange");
}
@Override
public void restoreBinding(UUID id, String bindingKey, AMQQueue queue, Map<String, Object> argumentMap)
- throws QpidSecurityException, AMQInternalException
+ throws QpidSecurityException
{
_logger.warn("Bindings to the default exchange should not be stored in the configuration store");
}
@Override
- public void removeBinding(Binding b) throws QpidSecurityException, AMQInternalException
+ public void removeBinding(Binding b) throws QpidSecurityException
{
throw new QpidSecurityException("Cannot remove bindings to the default exchange");
}
@Override
public Binding removeBinding(String bindingKey, AMQQueue queue, Map<String, Object> arguments)
- throws QpidSecurityException, AMQInternalException
+ throws QpidSecurityException
{
throw new QpidSecurityException("Cannot remove bindings to the default exchange");
}
@@ -356,11 +354,6 @@ public class DefaultExchange implements Exchange
{
q.enqueue(message, postEnqueueAction);
}
- catch (AMQException e)
- {
- // TODO
- throw new RuntimeException(e);
- }
finally
{
_reference.release();
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java
index 7229f008d6..a63e1afa3a 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java
@@ -22,9 +22,7 @@ package org.apache.qpid.server.exchange;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.security.QpidSecurityException;
-import org.apache.qpid.AMQUnknownExchangeType;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.server.model.UUIDGenerator;
import org.apache.qpid.server.plugin.ExchangeType;
@@ -109,7 +107,7 @@ public class DefaultExchangeFactory implements ExchangeFactory
}
public Exchange createExchange(String exchange, String type, boolean durable, boolean autoDelete)
- throws AMQException, QpidSecurityException
+ throws AMQUnknownExchangeType, QpidSecurityException
{
UUID id = UUIDGenerator.generateExchangeUUID(exchange, _host.getName());
@@ -117,7 +115,7 @@ public class DefaultExchangeFactory implements ExchangeFactory
}
public Exchange createExchange(UUID id, String exchange, String type, boolean durable, boolean autoDelete)
- throws QpidSecurityException, AMQException
+ throws QpidSecurityException, AMQUnknownExchangeType
{
// Check access
if (!_host.getSecurityManager().authoriseCreateExchange(autoDelete, durable, exchange, null, null, null, type))
@@ -138,7 +136,7 @@ public class DefaultExchangeFactory implements ExchangeFactory
@Override
public Exchange restoreExchange(UUID id, String exchange, String type, boolean autoDelete)
- throws AMQException, QpidSecurityException
+ throws AMQUnknownExchangeType, QpidSecurityException
{
return createExchange(id, exchange, type, true, autoDelete);
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeRegistry.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeRegistry.java
index 7f1c29f9e5..8d2d04a464 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeRegistry.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeRegistry.java
@@ -21,7 +21,6 @@
package org.apache.qpid.server.exchange;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.server.model.UUIDGenerator;
@@ -59,7 +58,7 @@ public class DefaultExchangeRegistry implements ExchangeRegistry
_queueRegistry = queueRegistry;
}
- public void initialise(ExchangeFactory exchangeFactory) throws AMQException
+ public void initialise(ExchangeFactory exchangeFactory)
{
//create 'standard' exchanges:
new ExchangeInitialiser().initialise(exchangeFactory, this, getDurableConfigurationStore());
@@ -78,7 +77,7 @@ public class DefaultExchangeRegistry implements ExchangeRegistry
return _host.getDurableConfigurationStore();
}
- public void registerExchange(Exchange exchange) throws AMQException
+ public void registerExchange(Exchange exchange)
{
_exchangeMap.put(exchange.getName(), exchange);
synchronized (_listeners)
@@ -101,7 +100,7 @@ public class DefaultExchangeRegistry implements ExchangeRegistry
return _defaultExchange;
}
- public boolean unregisterExchange(String name, boolean inUse) throws AMQException, QpidSecurityException
+ public boolean unregisterExchange(String name, boolean inUse) throws QpidSecurityException
{
final Exchange exchange = _exchangeMap.get(name);
if (exchange != null)
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DirectExchange.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DirectExchange.java
index 2d65c22727..e2db7611eb 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DirectExchange.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DirectExchange.java
@@ -25,8 +25,8 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQInvalidArgumentException;
import org.apache.qpid.server.binding.Binding;
+import org.apache.qpid.server.filter.AMQInvalidArgumentException;
import org.apache.qpid.server.filter.FilterSupport;
import org.apache.qpid.server.filter.Filterable;
import org.apache.qpid.server.filter.MessageFilter;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DirectExchangeType.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DirectExchangeType.java
index 99c913ad07..3a4f7a9a3b 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DirectExchangeType.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DirectExchangeType.java
@@ -22,7 +22,6 @@ package org.apache.qpid.server.exchange;
import java.util.UUID;
-import org.apache.qpid.AMQException;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.server.plugin.ExchangeType;
import org.apache.qpid.server.virtualhost.VirtualHost;
@@ -38,7 +37,7 @@ public class DirectExchangeType implements ExchangeType<DirectExchange>
public DirectExchange newInstance(UUID id, VirtualHost host,
String name,
boolean durable,
- boolean autoDelete) throws AMQException
+ boolean autoDelete)
{
DirectExchange exch = new DirectExchange();
exch.initialise(id, host,name,durable, autoDelete);
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/Exchange.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/Exchange.java
index d20bf788c7..38249e6b1f 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/Exchange.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/Exchange.java
@@ -20,8 +20,6 @@
*/
package org.apache.qpid.server.exchange;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQInternalException;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.server.binding.Binding;
import org.apache.qpid.server.message.MessageDestination;
@@ -35,8 +33,7 @@ import java.util.UUID;
public interface Exchange extends ExchangeReferrer, MessageDestination
{
- void initialise(UUID id, VirtualHost host, String name, boolean durable, boolean autoDelete)
- throws AMQException;
+ void initialise(UUID id, VirtualHost host, String name, boolean durable, boolean autoDelete);
UUID getId();
@@ -70,25 +67,25 @@ public interface Exchange extends ExchangeReferrer, MessageDestination
boolean addBinding(String bindingKey, AMQQueue queue, Map<String, Object> arguments)
- throws QpidSecurityException, AMQInternalException;
+ throws QpidSecurityException;
boolean replaceBinding(UUID id, String bindingKey,
AMQQueue queue,
Map<String, Object> arguments)
- throws QpidSecurityException, AMQInternalException;
+ throws QpidSecurityException;
void restoreBinding(UUID id, String bindingKey, AMQQueue queue,
Map<String, Object> argumentMap)
- throws QpidSecurityException, AMQInternalException;
+ throws QpidSecurityException;
- void removeBinding(Binding b) throws QpidSecurityException, AMQInternalException;
+ void removeBinding(Binding b) throws QpidSecurityException;
Binding removeBinding(String bindingKey, AMQQueue queue, Map<String, Object> arguments)
- throws QpidSecurityException, AMQInternalException;
+ throws QpidSecurityException;
Binding getBinding(String bindingKey, AMQQueue queue, Map<String, Object> arguments);
- void close() throws QpidSecurityException, AMQInternalException;
+ void close() throws QpidSecurityException;
/**
* Determines whether a message would be isBound to a particular queue using a specific routing key and arguments
@@ -96,7 +93,6 @@ public interface Exchange extends ExchangeReferrer, MessageDestination
* @param arguments
* @param queue
* @return
- * @throws AMQException
*/
boolean isBound(String bindingKey, Map<String,Object> arguments, AMQQueue queue);
@@ -106,7 +102,6 @@ public interface Exchange extends ExchangeReferrer, MessageDestination
* @param bindingKey
* @param queue
* @return
- * @throws AMQException
*/
boolean isBound(String bindingKey, AMQQueue queue);
@@ -115,14 +110,12 @@ public interface Exchange extends ExchangeReferrer, MessageDestination
* Determines whether a message is routing to any queue using a specific _routing key
* @param bindingKey
* @return
- * @throws AMQException
*/
boolean isBound(String bindingKey);
/**
* Returns true if this exchange has at least one binding associated with it.
* @return
- * @throws AMQException
*/
boolean hasBindings();
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeFactory.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeFactory.java
index ef2a3358dd..06aa3aee2d 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeFactory.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeFactory.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.exchange;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.plugin.ExchangeType;
import org.apache.qpid.server.security.QpidSecurityException;
@@ -36,11 +35,11 @@ public interface ExchangeFactory
Collection<ExchangeType<? extends Exchange>> getPublicCreatableTypes();
Exchange createExchange(String exchange, String type, boolean durable, boolean autoDelete)
- throws AMQException, QpidSecurityException;
+ throws AMQUnknownExchangeType, QpidSecurityException;
- Exchange createExchange(UUID id, String exchange, String type, boolean durable, boolean autoDelete) throws AMQException,
+ Exchange createExchange(UUID id, String exchange, String type, boolean durable, boolean autoDelete) throws AMQUnknownExchangeType,
QpidSecurityException;
Exchange restoreExchange(UUID id, String exchange, String type, boolean autoDelete)
- throws AMQException, QpidSecurityException;
+ throws AMQUnknownExchangeType, QpidSecurityException;
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeInitialiser.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeInitialiser.java
index 334c1f5411..aa3f0de24f 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeInitialiser.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeInitialiser.java
@@ -20,8 +20,6 @@
*/
package org.apache.qpid.server.exchange;
-
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.plugin.ExchangeType;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.server.store.DurableConfigurationStoreHelper;
@@ -31,7 +29,6 @@ import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class ExchangeInitialiser
{
public void initialise(ExchangeFactory factory, ExchangeRegistry registry, DurableConfigurationStore store)
- throws AMQException
{
for (ExchangeType<? extends Exchange> type : factory.getRegisteredTypes())
{
@@ -42,7 +39,6 @@ public class ExchangeInitialiser
private void define(ExchangeRegistry r, ExchangeFactory f,
String name, String type, DurableConfigurationStore store)
- throws AMQException
{
try
{
@@ -61,5 +57,10 @@ public class ExchangeInitialiser
throw new ServerScopedRuntimeException("Security Exception when attempting to initialise exchanges - " +
"this is likely a programming error", e);
}
+ catch (AMQUnknownExchangeType e)
+ {
+ throw new ServerScopedRuntimeException("Unknown exchange type while attempting to initialise exchanges - " +
+ "this is because necessary jar files are not on the classpath", e);
+ }
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeRegistry.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeRegistry.java
index 6ecbb94235..aa66b98a5c 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeRegistry.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/ExchangeRegistry.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.exchange;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.security.QpidSecurityException;
import java.util.Collection;
@@ -29,11 +28,11 @@ import java.util.UUID;
public interface ExchangeRegistry
{
- void registerExchange(Exchange exchange) throws AMQException;
+ void registerExchange(Exchange exchange);
Exchange getDefaultExchange();
- void initialise(ExchangeFactory exchangeFactory) throws AMQException;
+ void initialise(ExchangeFactory exchangeFactory);
Exchange getExchange(String exchangeName);
@@ -41,9 +40,8 @@ public interface ExchangeRegistry
* Unregister an exchange
* @param exchange name of the exchange to delete
* @param ifUnused if true, do NOT delete the exchange if it is in use (has queues bound to it)
- * @throws AMQException
*/
- boolean unregisterExchange(String exchange, boolean ifUnused) throws AMQException, QpidSecurityException;
+ boolean unregisterExchange(String exchange, boolean ifUnused) throws QpidSecurityException;
void clearAndUnregisterMbeans();
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/FanoutExchange.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/FanoutExchange.java
index ba60d956fd..fc1a5ea3de 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/FanoutExchange.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/FanoutExchange.java
@@ -27,8 +27,8 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQInvalidArgumentException;
import org.apache.qpid.server.binding.Binding;
+import org.apache.qpid.server.filter.AMQInvalidArgumentException;
import org.apache.qpid.server.filter.FilterSupport;
import org.apache.qpid.server.filter.Filterable;
import org.apache.qpid.server.filter.MessageFilter;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/FanoutExchangeType.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/FanoutExchangeType.java
index 9fc0d1f071..5e1f6784bd 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/FanoutExchangeType.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/FanoutExchangeType.java
@@ -22,7 +22,6 @@ package org.apache.qpid.server.exchange;
import java.util.UUID;
-import org.apache.qpid.AMQException;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.server.plugin.ExchangeType;
import org.apache.qpid.server.virtualhost.VirtualHost;
@@ -37,7 +36,6 @@ public class FanoutExchangeType implements ExchangeType<FanoutExchange>
public FanoutExchange newInstance(UUID id, VirtualHost host, String name,
boolean durable, boolean autoDelete)
- throws AMQException
{
FanoutExchange exch = new FanoutExchange();
exch.initialise(id, host, name, durable, autoDelete);
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersBinding.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersBinding.java
index 276a38e7f8..4780fae84e 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersBinding.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersBinding.java
@@ -22,8 +22,8 @@ package org.apache.qpid.server.exchange;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQInvalidArgumentException;
import org.apache.qpid.server.binding.Binding;
+import org.apache.qpid.server.filter.AMQInvalidArgumentException;
import org.apache.qpid.server.filter.FilterSupport;
import org.apache.qpid.server.filter.MessageFilter;
import org.apache.qpid.server.message.AMQMessageHeader;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersExchangeType.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersExchangeType.java
index 097a7bd5bd..19b830b6b2 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersExchangeType.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersExchangeType.java
@@ -22,7 +22,6 @@ package org.apache.qpid.server.exchange;
import java.util.UUID;
-import org.apache.qpid.AMQException;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.server.plugin.ExchangeType;
import org.apache.qpid.server.virtualhost.VirtualHost;
@@ -36,7 +35,7 @@ public class HeadersExchangeType implements ExchangeType<HeadersExchange>
}
public HeadersExchange newInstance(UUID id, VirtualHost host, String name, boolean durable,
- boolean autoDelete) throws AMQException
+ boolean autoDelete)
{
HeadersExchange exch = new HeadersExchange();
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/TopicExchange.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/TopicExchange.java
index d86d5cd769..0389638d4f 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/TopicExchange.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/TopicExchange.java
@@ -28,12 +28,12 @@ import java.util.HashSet;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQInvalidArgumentException;
import org.apache.qpid.server.binding.Binding;
import org.apache.qpid.server.exchange.topic.TopicExchangeResult;
import org.apache.qpid.server.exchange.topic.TopicMatcherResult;
import org.apache.qpid.server.exchange.topic.TopicNormalizer;
import org.apache.qpid.server.exchange.topic.TopicParser;
+import org.apache.qpid.server.filter.AMQInvalidArgumentException;
import org.apache.qpid.server.filter.FilterSupport;
import org.apache.qpid.server.filter.Filterable;
import org.apache.qpid.server.message.InstanceProperties;
@@ -41,6 +41,7 @@ import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.plugin.ExchangeType;
import org.apache.qpid.server.queue.AMQQueue;
import org.apache.qpid.server.queue.BaseQueue;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
public class TopicExchange extends AbstractExchange
{
@@ -252,7 +253,8 @@ public class TopicExchange extends AbstractExchange
}
catch (AMQInvalidArgumentException e)
{
- throw new RuntimeException(e);
+ // TODO - this seems incorrect, handling of invalid bindings should be propagated more cleanly
+ throw new ConnectionScopedRuntimeException(e);
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/TopicExchangeType.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/TopicExchangeType.java
index c1f42017bf..f76d556ded 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/TopicExchangeType.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/TopicExchangeType.java
@@ -22,7 +22,6 @@ package org.apache.qpid.server.exchange;
import java.util.UUID;
-import org.apache.qpid.AMQException;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.server.plugin.ExchangeType;
import org.apache.qpid.server.virtualhost.VirtualHost;
@@ -38,7 +37,7 @@ public class TopicExchangeType implements ExchangeType<TopicExchange>
public TopicExchange newInstance(UUID id, VirtualHost host,
String name,
boolean durable,
- boolean autoDelete) throws AMQException
+ boolean autoDelete)
{
TopicExchange exch = new TopicExchange();
exch.initialise(id, host, name, durable, autoDelete);
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MessageStoreClosedException.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/AMQInvalidArgumentException.java
index b0a736c66c..ec5d68f0a6 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MessageStoreClosedException.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/AMQInvalidArgumentException.java
@@ -18,21 +18,26 @@
* under the License.
*
*/
+package org.apache.qpid.server.filter;
-package org.apache.qpid.server.store;
+public class AMQInvalidArgumentException extends Exception
+{
+ public AMQInvalidArgumentException(final Throwable cause)
+ {
+ super(cause);
+ }
+
+ public AMQInvalidArgumentException(final String message, final Throwable cause)
+ {
+ super(message, cause);
+ }
-import org.apache.qpid.AMQException;
+ public AMQInvalidArgumentException(final String message)
+ {
+ super(message);
+ }
-/**
- * NOTE: this class currently extends AMQException but
- * we should be using AMQExceptions internally in the code base for Protocol errors hence
- * the message store interface should throw a different super class which this should be
- * moved to reflect
- */
-public class MessageStoreClosedException extends AMQException
-{
- public MessageStoreClosedException()
+ public AMQInvalidArgumentException()
{
- super("Message store closed");
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/FilterManagerFactory.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/FilterManagerFactory.java
index dc6d5d0123..a159a8506b 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/FilterManagerFactory.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/FilterManagerFactory.java
@@ -22,8 +22,6 @@ package org.apache.qpid.server.filter;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQInvalidArgumentException;
import org.apache.qpid.common.AMQPFilterTypes;
import org.apache.qpid.filter.SelectorParsingException;
import org.apache.qpid.filter.selector.ParseException;
@@ -43,7 +41,7 @@ public class FilterManagerFactory
//TODO move to a common class so it can be referred to from client code.
- public static FilterManager createManager(Map<String,Object> filters) throws AMQException
+ public static FilterManager createManager(Map<String,Object> filters) throws AMQInvalidArgumentException
{
FilterManager manager = null;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/FilterSupport.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/FilterSupport.java
index efefec58fd..9870551313 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/FilterSupport.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/FilterSupport.java
@@ -25,7 +25,6 @@ import java.lang.ref.WeakReference;
import java.util.Collections;
import java.util.Map;
import java.util.WeakHashMap;
-import org.apache.qpid.AMQInvalidArgumentException;
import org.apache.qpid.common.AMQPFilterTypes;
import org.apache.qpid.filter.SelectorParsingException;
import org.apache.qpid.filter.selector.ParseException;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/NoConsumerFilter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/NoConsumerFilter.java
deleted file mode 100644
index cf73bfa21f..0000000000
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/NoConsumerFilter.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- *
- */
-package org.apache.qpid.server.filter;
-
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.AMQException;
-
-public class NoConsumerFilter implements MessageFilter
-{
- private final static Logger _logger = org.apache.log4j.Logger.getLogger(NoConsumerFilter.class);
-
-
- public NoConsumerFilter() throws AMQException
- {
- _logger.info("Created NoConsumerFilter");
- }
-
- public boolean matches(Filterable message)
- {
- return true;
- }
-
- @Override
- public String toString()
- {
- return "NoConsumer";
- }
-
-}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/AbstractServerMessageImpl.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/AbstractServerMessageImpl.java
index a2b7dd10e1..556cfcb266 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/AbstractServerMessageImpl.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/AbstractServerMessageImpl.java
@@ -22,6 +22,7 @@ package org.apache.qpid.server.message;
import org.apache.qpid.server.store.StorableMessageMetaData;
import org.apache.qpid.server.store.StoredMessage;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import java.nio.ByteBuffer;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -93,8 +94,8 @@ public abstract class AbstractServerMessageImpl<X extends AbstractServerMessageI
{
if (count < 0)
{
- throw new RuntimeException("Reference count for message id " + debugIdentity()
- + " has gone below 0.");
+ throw new ServerScopedRuntimeException("Reference count for message id " + debugIdentity()
+ + " has gone below 0.");
}
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/MessageSource.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/MessageSource.java
index 86179f9b00..b947bc0ef6 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/MessageSource.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/MessageSource.java
@@ -20,12 +20,10 @@
*/
package org.apache.qpid.server.message;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.consumer.Consumer;
import org.apache.qpid.server.consumer.ConsumerTarget;
import org.apache.qpid.server.filter.FilterManager;
import org.apache.qpid.server.protocol.AMQSessionModel;
-import org.apache.qpid.server.queue.AMQQueue;
import org.apache.qpid.server.security.AuthorizationHolder;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.server.store.TransactionLogResource;
@@ -38,7 +36,7 @@ public interface MessageSource<C extends Consumer, S extends MessageSource<C,S>>
<T extends ConsumerTarget> C addConsumer(T target, FilterManager filters,
Class<? extends ServerMessage> messageClass,
String consumerName, EnumSet<Consumer.Option> options)
- throws AMQException, QpidSecurityException;
+ throws ExistingExclusiveConsumer, ExistingConsumerPreventsExclusive, QpidSecurityException;
Collection<C> getConsumers();
@@ -70,12 +68,10 @@ public interface MessageSource<C extends Consumer, S extends MessageSource<C,S>>
* <tr><th> Responsibilities <th> Collaborations
* <tr><td> Represent failure to create a consumer, because an exclusive consumer already exists.
* </table>
- *
- * @todo Not an AMQP exception as no status code.
- *
+ * *
* @todo Move to top level, used outside this class.
*/
- static final class ExistingExclusiveConsumer extends AMQException
+ static final class ExistingExclusiveConsumer extends Exception
{
public ExistingExclusiveConsumer()
@@ -92,12 +88,10 @@ public interface MessageSource<C extends Consumer, S extends MessageSource<C,S>>
* <tr><th> Responsibilities <th> Collaborations
* <tr><td> Represent failure to create an exclusive consumer, as a consumer already exists.
* </table>
- *
- * @todo Not an AMQP exception as no status code.
- *
+ * *
* @todo Move to top level, used outside this class.
*/
- static final class ExistingConsumerPreventsExclusive extends AMQException
+ static final class ExistingConsumerPreventsExclusive extends Exception
{
public ExistingConsumerPreventsExclusive()
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessage.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessage.java
index f972bd78f6..6375cfb07d 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessage.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessage.java
@@ -25,6 +25,7 @@ import org.apache.qpid.server.message.AbstractServerMessageImpl;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.StoreFuture;
import org.apache.qpid.server.store.StoredMessage;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import org.apache.qpid.util.ByteBufferInputStream;
import java.io.ByteArrayOutputStream;
@@ -69,11 +70,12 @@ public class InternalMessage extends AbstractServerMessageImpl<InternalMessage,
}
catch (IOException e)
{
- throw new RuntimeException(e);
+ throw new ConnectionScopedRuntimeException("Unexpected IO Exception in operation in memory", e);
}
catch (ClassNotFoundException e)
{
- throw new RuntimeException(e);
+ throw new ConnectionScopedRuntimeException("Object message contained an object which could not " +
+ "be deserialized", e);
}
}
@@ -142,7 +144,7 @@ public class InternalMessage extends AbstractServerMessageImpl<InternalMessage,
}
catch (IOException e)
{
- throw new RuntimeException(e);
+ throw new ConnectionScopedRuntimeException("Unexpected IO Exception on operation in memory", e);
}
}
@@ -246,7 +248,7 @@ public class InternalMessage extends AbstractServerMessageImpl<InternalMessage,
}
catch (IOException e)
{
- throw new RuntimeException(e);
+ throw new ConnectionScopedRuntimeException("Unexpected IO Exception on operation in memory", e);
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaData.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaData.java
index d7772657a2..ed16335cf2 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaData.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaData.java
@@ -21,6 +21,7 @@
package org.apache.qpid.server.message.internal;
import org.apache.qpid.server.store.StorableMessageMetaData;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -87,7 +88,7 @@ public class InternalMessageMetaData implements StorableMessageMetaData
}
catch (IOException e)
{
- throw new RuntimeException(e);
+ throw new ConnectionScopedRuntimeException("Unexpected IO Exception on in memory operation", e);
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaDataType.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaDataType.java
index eb90599aef..20e506e634 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaDataType.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaDataType.java
@@ -23,6 +23,7 @@ package org.apache.qpid.server.message.internal;
import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.plugin.MessageMetaDataType;
import org.apache.qpid.server.store.StoredMessage;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import org.apache.qpid.util.ByteBufferInputStream;
import java.io.IOException;
@@ -51,11 +52,11 @@ public class InternalMessageMetaDataType implements MessageMetaDataType<Internal
}
catch (IOException e)
{
- throw new RuntimeException("Cannot decode message header");
+ throw new ConnectionScopedRuntimeException("Unexpected IO Exception on operation in memory", e);
}
catch (ClassNotFoundException e)
{
- throw new RuntimeException(e);
+ throw new ConnectionScopedRuntimeException("Unexpected exception when reading meta data, check classpath",e);
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractAdapter.java
index 7cc88f8743..cc669538d8 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractAdapter.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractAdapter.java
@@ -131,7 +131,7 @@ public abstract class AbstractAdapter implements ConfiguredObject
}
else
{
- return (State)_taskExecutor.submitAndWait(new ChangeStateTask(this, currentState, desiredState));
+ return _taskExecutor.submitAndWait(new ChangeStateTask(this, currentState, desiredState));
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AmqpPortAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AmqpPortAdapter.java
index c255ce2f4a..42a234579b 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AmqpPortAdapter.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AmqpPortAdapter.java
@@ -47,6 +47,7 @@ import org.apache.qpid.server.plugin.TransportProviderFactory;
import org.apache.qpid.server.protocol.AmqpProtocolVersion;
import org.apache.qpid.server.transport.AcceptingTransport;
import org.apache.qpid.server.transport.TransportProvider;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.transport.network.security.ssl.QpidMultipleTrustManager;
public class AmqpPortAdapter extends PortAdapter
@@ -187,7 +188,7 @@ public class AmqpPortAdapter extends PortAdapter
}
catch (GeneralSecurityException e)
{
- throw new RuntimeException("Unable to create SSLContext for key or trust store", e);
+ throw new ServerScopedRuntimeException("Unable to create SSLContext for key or trust store", e);
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderAdapter.java
index 033429980f..0fcdb779c1 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderAdapter.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderAdapter.java
@@ -554,8 +554,9 @@ public abstract class AuthenticationProviderAdapter<T extends AuthenticationMana
}
else
{
- //TODO? Silly interface on the PrincipalDatabase at fault
- throw new RuntimeException("Failed to create user");
+ LOGGER.info("Failed to create user " + username + ". User already exists?");
+ return null;
+
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BindingAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BindingAdapter.java
index 79ba45a2f0..88475809c9 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BindingAdapter.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BindingAdapter.java
@@ -26,7 +26,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import org.apache.qpid.AMQInternalException;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.server.model.Binding;
import org.apache.qpid.server.model.ConfiguredObject;
@@ -148,10 +147,6 @@ final class BindingAdapter extends AbstractAdapter implements Binding
{
throw new AccessControlException(e.getMessage());
}
- catch(AMQInternalException e)
- {
- throw new IllegalStateException(e);
- }
}
@Override
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java
index dd5fc67b48..dda23f1cfc 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java
@@ -30,7 +30,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import org.apache.qpid.AMQException;
import org.apache.qpid.protocol.AMQConstant;
import org.apache.qpid.server.model.ConfiguredObject;
import org.apache.qpid.server.model.Connection;
@@ -109,14 +108,7 @@ final class ConnectionAdapter extends AbstractAdapter implements Connection
public void delete()
{
- try
- {
- _connection.close(AMQConstant.CONNECTION_FORCED, "Connection closed by external action");
- }
- catch(AMQException e)
- {
- throw new IllegalStateException(e);
- }
+ _connection.close(AMQConstant.CONNECTION_FORCED, "Connection closed by external action");
}
public String getName()
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ExchangeAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ExchangeAdapter.java
index 7958dfab23..f7ecbd323a 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ExchangeAdapter.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ExchangeAdapter.java
@@ -27,8 +27,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQInternalException;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.server.binding.Binding;
import org.apache.qpid.server.model.ConfiguredObject;
@@ -41,6 +39,7 @@ import org.apache.qpid.server.model.State;
import org.apache.qpid.server.model.Statistics;
import org.apache.qpid.server.queue.AMQQueue;
import org.apache.qpid.server.util.MapValueConverter;
+import org.apache.qpid.server.virtualhost.ExchangeIsAlternateException;
import org.apache.qpid.server.virtualhost.RequiredExchangeException;
final class ExchangeAdapter extends AbstractAdapter implements Exchange, org.apache.qpid.server.exchange.Exchange.BindingListener
@@ -151,10 +150,6 @@ final class ExchangeAdapter extends AbstractAdapter implements Exchange, org.apa
{
throw new AccessControlException(e.toString());
}
- catch(AMQInternalException e)
- {
- throw new IllegalStateException(e);
- }
}
public void delete()
@@ -167,7 +162,7 @@ final class ExchangeAdapter extends AbstractAdapter implements Exchange, org.apa
{
throw new UnsupportedOperationException("'" + getName() + "' is a reserved exchange and can't be deleted");
}
- catch(AMQException e)
+ catch(ExchangeIsAlternateException e)
{
throw new IllegalStateException(e);
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProvider.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProvider.java
index 39f0017fc3..ea1f735c15 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProvider.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProvider.java
@@ -246,7 +246,7 @@ public class FileSystemPreferencesProvider extends AbstractAdapter implements Pr
_store.open();
return true;
}
- catch (Exception e)
+ catch (RuntimeException e)
{
_state.compareAndSet(State.ACTIVE, State.ERRORED);
Broker broker = getAuthenticationProvider().getParent(Broker.class);
@@ -256,7 +256,7 @@ public class FileSystemPreferencesProvider extends AbstractAdapter implements Pr
}
else
{
- throw new RuntimeException(e);
+ throw e;
}
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/KeyStoreAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/KeyStoreAdapter.java
index 1101232c96..27ecb9ca75 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/KeyStoreAdapter.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/KeyStoreAdapter.java
@@ -45,6 +45,7 @@ import org.apache.qpid.server.model.Port;
import org.apache.qpid.server.model.State;
import org.apache.qpid.server.security.access.Operation;
import org.apache.qpid.server.util.MapValueConverter;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.transport.network.security.ssl.QpidClientX509KeyManager;
import org.apache.qpid.transport.network.security.ssl.SSLUtil;
@@ -195,7 +196,7 @@ public class KeyStoreAdapter extends AbstractKeyStoreAdapter implements KeyStore
catch (KeyStoreException e)
{
// key store should be initialized above
- throw new RuntimeException("Key store has not been initialized", e);
+ throw new ServerScopedRuntimeException("Key store has not been initialized", e);
}
if (cert == null)
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/QueueAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/QueueAdapter.java
index 19a44fc4c3..733b6cecc2 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/QueueAdapter.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/QueueAdapter.java
@@ -28,8 +28,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.binding.Binding;
import org.apache.qpid.server.configuration.IllegalConfigurationException;
import org.apache.qpid.server.message.MessageSource;
@@ -175,10 +173,6 @@ final class QueueAdapter<Q extends AMQQueue<?,Q,?>> extends AbstractAdapter impl
{
_queue.getVirtualHost().removeQueue(_queue);
}
- catch(AMQException e)
- {
- throw new IllegalStateException(e);
- }
catch (QpidSecurityException e)
{
throw new AccessControlException(e.toString());
@@ -343,15 +337,8 @@ final class QueueAdapter<Q extends AMQQueue<?,Q,?>> extends AbstractAdapter impl
{
if (_queue.isDurable())
{
- try
- {
- DurableConfigurationStoreHelper.updateQueue(_queue.getVirtualHost().getDurableConfigurationStore(),
- _queue);
- }
- catch (AMQStoreException e)
- {
- throw new IllegalStateException(e);
- }
+ DurableConfigurationStoreHelper.updateQueue(_queue.getVirtualHost().getDurableConfigurationStore(),
+ _queue);
}
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAdapter.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAdapter.java
index bd265fe938..17ce69da4a 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAdapter.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAdapter.java
@@ -40,7 +40,7 @@ import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.commons.configuration.SystemConfiguration;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
+import org.apache.qpid.server.exchange.AMQUnknownExchangeType;
import org.apache.qpid.server.configuration.IllegalConfigurationException;
import org.apache.qpid.server.configuration.VirtualHostConfiguration;
import org.apache.qpid.server.configuration.XmlConfigurationUtilities.MyConfiguration;
@@ -76,12 +76,13 @@ import org.apache.qpid.server.txn.LocalTransaction;
import org.apache.qpid.server.txn.ServerTransaction;
import org.apache.qpid.server.util.MapValueConverter;
import org.apache.qpid.server.plugin.VirtualHostFactory;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.server.virtualhost.ExchangeExistsException;
import org.apache.qpid.server.virtualhost.ReservedExchangeNameException;
import org.apache.qpid.server.virtualhost.UnknownExchangeException;
import org.apache.qpid.server.virtualhost.VirtualHostListener;
import org.apache.qpid.server.virtualhost.VirtualHostRegistry;
-import org.apache.qpid.server.virtualhost.plugins.QueueExistsException;
+import org.apache.qpid.server.virtualhost.QueueExistsException;
public final class VirtualHostAdapter extends AbstractAdapter implements VirtualHost, VirtualHostListener
{
@@ -375,7 +376,7 @@ public final class VirtualHostAdapter extends AbstractAdapter implements Virtual
{
throw new IllegalArgumentException("Alternate Exchange with name '" + e.getExchangeName() + "' does not exist");
}
- catch(AMQException e)
+ catch(AMQUnknownExchangeType e)
{
throw new IllegalArgumentException(e);
}
@@ -472,10 +473,6 @@ public final class VirtualHostAdapter extends AbstractAdapter implements Virtual
{
throw new IllegalArgumentException("Queue with name "+name+" already exists");
}
- catch(AMQException e)
- {
- throw new IllegalArgumentException(e);
- }
catch (QpidSecurityException e)
{
throw new AccessControlException(e.toString());
@@ -800,14 +797,7 @@ public final class VirtualHostAdapter extends AbstractAdapter implements Virtual
{
public void postCommit()
{
- try
- {
- toQueue.enqueue(message, null);
- }
- catch(AMQException e)
- {
- throw new RuntimeException(e);
- }
+ toQueue.enqueue(message, null);
}
public void onRollback()
@@ -829,14 +819,7 @@ public final class VirtualHostAdapter extends AbstractAdapter implements Virtual
public void postCommit()
{
- try
- {
- toQueue.enqueue(message, null);
- }
- catch (AMQException e)
- {
- throw new RuntimeException(e);
- }
+ toQueue.enqueue(message, null);
}
public void onRollback()
@@ -1148,9 +1131,9 @@ public final class VirtualHostAdapter extends AbstractAdapter implements Virtual
this);
}
}
- catch (Exception e)
+ catch (ConfigurationException e)
{
- throw new RuntimeException("Failed to create virtual host " + virtualHostName, e);
+ throw new ServerScopedRuntimeException("Failed to create virtual host " + virtualHostName, e);
}
virtualHostRegistry.registerVirtualHost(_virtualHost);
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/ExchangeType.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/ExchangeType.java
index 423b76ab8e..910dfbf33d 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/ExchangeType.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/ExchangeType.java
@@ -22,7 +22,6 @@ package org.apache.qpid.server.plugin;
import java.util.UUID;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.exchange.Exchange;
import org.apache.qpid.server.virtualhost.VirtualHost;
@@ -31,7 +30,7 @@ public interface ExchangeType<T extends Exchange> extends Pluggable
public String getType();
public T newInstance(UUID id, VirtualHost host, String name,
- boolean durable, boolean autoDelete) throws AMQException;
+ boolean durable, boolean autoDelete);
public String getDefaultExchangeName();
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/QpidServiceLoader.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/QpidServiceLoader.java
index 148a306b27..6920d5a879 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/QpidServiceLoader.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/QpidServiceLoader.java
@@ -24,6 +24,7 @@ import java.util.List;
import java.util.ServiceLoader;
import org.apache.log4j.Logger;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
/**
* Simple facade over a {@link ServiceLoader} to instantiate all configured implementations of an interface.
@@ -59,7 +60,7 @@ public class QpidServiceLoader<C extends Pluggable>
if(atLeastOne && serviceImplementations.isEmpty())
{
- throw new RuntimeException("At least one implementation of " + clazz + " expected");
+ throw new ServerScopedRuntimeException("At least one implementation of " + clazz + " expected");
}
if(_logger.isDebugEnabled())
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/VirtualHostFactory.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/VirtualHostFactory.java
index 9549b70c83..a073c89a1b 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/VirtualHostFactory.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/VirtualHostFactory.java
@@ -41,7 +41,7 @@ public interface VirtualHostFactory extends Pluggable
StatisticsGatherer brokerStatisticsGatherer,
SecurityManager parentSecurityManager,
VirtualHostConfiguration hostConfig,
- org.apache.qpid.server.model.VirtualHost virtualHost) throws Exception;
+ org.apache.qpid.server.model.VirtualHost virtualHost);
void validateAttributes(Map<String, Object> attributes);
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/protocol/AMQConnectionModel.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/protocol/AMQConnectionModel.java
index 180653af0e..bc272f13dc 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/protocol/AMQConnectionModel.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/protocol/AMQConnectionModel.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.protocol;
-import org.apache.qpid.AMQException;
import org.apache.qpid.protocol.AMQConstant;
import org.apache.qpid.server.logging.LogSubject;
import org.apache.qpid.server.model.Port;
@@ -37,9 +36,8 @@ public interface AMQConnectionModel extends StatisticsGatherer
*
* @param cause
* @param message
- * @throws org.apache.qpid.AMQException
*/
- public void close(AMQConstant cause, String message) throws AMQException;
+ public void close(AMQConstant cause, String message);
public void block();
@@ -51,9 +49,8 @@ public interface AMQConnectionModel extends StatisticsGatherer
* @param session
* @param cause
* @param message
- * @throws org.apache.qpid.AMQException
*/
- public void closeSession(AMQSessionModel session, AMQConstant cause, String message) throws AMQException;
+ public void closeSession(AMQSessionModel session, AMQConstant cause, String message);
public long getConnectionId();
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/protocol/AMQSessionModel.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/protocol/AMQSessionModel.java
index 28fadd4162..520489ab1f 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/protocol/AMQSessionModel.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/protocol/AMQSessionModel.java
@@ -23,7 +23,6 @@ package org.apache.qpid.server.protocol;
import java.util.UUID;
import java.util.concurrent.ConcurrentSkipListSet;
-import org.apache.qpid.AMQException;
import org.apache.qpid.protocol.AMQConstant;
import org.apache.qpid.server.logging.LogSubject;
import org.apache.qpid.server.queue.AMQQueue;
@@ -41,9 +40,9 @@ public interface AMQSessionModel extends Comparable<AMQSessionModel>
public String getClientID();
- public void close() throws AMQException;
+ public void close();
- public void close(AMQConstant cause, String message) throws AMQException;
+ public void close(AMQConstant cause, String message);
public LogSubject getLogSubject();
@@ -62,7 +61,7 @@ public interface AMQSessionModel extends Comparable<AMQSessionModel>
* @param idleWarn time in milliseconds before alerting on idle transaction
* @param idleClose time in milliseconds before closing connection with idle transaction
*/
- public void checkTransactionStatus(long openWarn, long openClose, long idleWarn, long idleClose) throws AMQException;
+ public void checkTransactionStatus(long openWarn, long openClose, long idleWarn, long idleClose);
void block(AMQQueue queue);
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueue.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueue.java
index 49c8a8f2a1..237f2cd8aa 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueue.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueue.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.queue;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.binding.Binding;
import org.apache.qpid.server.configuration.QueueConfiguration;
import org.apache.qpid.server.exchange.Exchange;
@@ -95,7 +94,7 @@ public interface AMQQueue<E extends QueueEntry<E,Q,C>, Q extends AMQQueue<E,Q,C>
boolean isDeleted();
- int delete() throws AMQException, QpidSecurityException;
+ int delete() throws QpidSecurityException;
void requeue(E entry);
@@ -103,7 +102,7 @@ public interface AMQQueue<E extends QueueEntry<E,Q,C>, Q extends AMQQueue<E,Q,C>
void decrementUnackedMsgCount(E queueEntry);
- boolean resend(final E entry, final C consumer) throws AMQException;
+ boolean resend(final E entry, final C consumer);
void addQueueDeleteTask(Action<AMQQueue> task);
void removeQueueDeleteTask(Action<AMQQueue> task);
@@ -170,13 +169,12 @@ public interface AMQQueue<E extends QueueEntry<E,Q,C>, Q extends AMQQueue<E,Q,C>
void deleteMessageFromTop();
- long clearQueue() throws AMQException, QpidSecurityException;
+ long clearQueue() throws QpidSecurityException;
/**
* Checks the status of messages on the queue, purging expired ones, firing age related alerts etc.
- * @throws AMQException
*/
- void checkMessageStatus() throws AMQException;
+ void checkMessageStatus();
Set<NotificationCheck> getNotificationChecks();
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java
index 1f281b16e9..409c528a4b 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueueFactory.java
@@ -25,7 +25,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-import org.apache.qpid.AMQException;
+import org.apache.qpid.server.exchange.AMQUnknownExchangeType;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.server.configuration.BrokerProperties;
@@ -35,8 +35,13 @@ import org.apache.qpid.server.exchange.Exchange;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.model.UUIDGenerator;
import org.apache.qpid.server.store.DurableConfigurationStoreHelper;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.server.virtualhost.ExchangeExistsException;
+import org.apache.qpid.server.virtualhost.ReservedExchangeNameException;
+import org.apache.qpid.server.virtualhost.UnknownExchangeException;
import org.apache.qpid.server.virtualhost.VirtualHost;
+import org.apache.qpid.server.virtualhost.QueueExistsException;
public class AMQQueueFactory implements QueueFactory
{
@@ -183,7 +188,7 @@ public class AMQQueueFactory implements QueueFactory
boolean autoDelete,
boolean exclusive,
boolean deleteOnNoConsumer,
- Map<String, Object> arguments) throws QpidSecurityException, AMQException
+ Map<String, Object> arguments) throws QpidSecurityException
{
return createOrRestoreQueue(id, queueName, true, owner, autoDelete, exclusive, deleteOnNoConsumer, arguments, false);
@@ -201,7 +206,7 @@ public class AMQQueueFactory implements QueueFactory
boolean autoDelete,
boolean exclusive,
boolean deleteOnNoConsumer,
- Map<String, Object> arguments) throws QpidSecurityException, AMQException
+ Map<String, Object> arguments) throws QpidSecurityException
{
return createOrRestoreQueue(id, queueName, durable, owner, autoDelete, exclusive, deleteOnNoConsumer, arguments, true);
}
@@ -214,7 +219,7 @@ public class AMQQueueFactory implements QueueFactory
boolean exclusive,
boolean deleteOnNoConsumer,
Map<String, Object> arguments,
- boolean createInStore) throws QpidSecurityException, AMQException
+ boolean createInStore) throws QpidSecurityException
{
if (id == null)
{
@@ -339,6 +344,18 @@ public class AMQQueueFactory implements QueueFactory
// We're ok if the exchange already exists
dlExchange = e.getExistingExchange();
}
+ catch (ReservedExchangeNameException e)
+ {
+ throw new ConnectionScopedRuntimeException("Attempt to create an alternate exchange for a queue failed",e);
+ }
+ catch (AMQUnknownExchangeType e)
+ {
+ throw new ConnectionScopedRuntimeException("Attempt to create an alternate exchange for a queue failed",e);
+ }
+ catch (UnknownExchangeException e)
+ {
+ throw new ConnectionScopedRuntimeException("Attempt to create an alternate exchange for a queue failed",e);
+ }
AMQQueue dlQueue = null;
@@ -353,8 +370,19 @@ public class AMQQueueFactory implements QueueFactory
args.put(Queue.CREATE_DLQ_ON_CREATION, false);
args.put(Queue.MAXIMUM_DELIVERY_ATTEMPTS, 0);
- dlQueue = _virtualHost.createQueue(UUIDGenerator.generateQueueUUID(dlQueueName, _virtualHost.getName()), dlQueueName, true, owner, false, exclusive,
- false, args);
+ try
+ {
+ dlQueue = _virtualHost.createQueue(UUIDGenerator.generateQueueUUID(dlQueueName, _virtualHost.getName()), dlQueueName, true, owner, false, exclusive,
+ false, args);
+ }
+ catch (QueueExistsException e)
+ {
+ throw new ServerScopedRuntimeException("Attempt to create a queue failed because the " +
+ "queue already exists, however this occurred within " +
+ "a block where the queue existence had previously been " +
+ "checked, and no queue creation should have been " +
+ "possible from another thread", e);
+ }
}
}
@@ -391,7 +419,7 @@ public class AMQQueueFactory implements QueueFactory
return q;
}
- public AMQQueue createAMQQueueImpl(QueueConfiguration config) throws AMQException, QpidSecurityException
+ public AMQQueue createAMQQueueImpl(QueueConfiguration config) throws QpidSecurityException
{
String queueName = config.getName();
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/BaseQueue.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/BaseQueue.java
index 31c54dcdd2..4158e51d2f 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/BaseQueue.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/BaseQueue.java
@@ -21,7 +21,6 @@
package org.apache.qpid.server.queue;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.consumer.Consumer;
import org.apache.qpid.server.message.MessageInstance;
import org.apache.qpid.server.message.ServerMessage;
@@ -30,7 +29,7 @@ import org.apache.qpid.server.util.Action;
public interface BaseQueue<C extends Consumer> extends TransactionLogResource
{
- void enqueue(ServerMessage message, Action<? super MessageInstance<?,C>> action) throws AMQException;
+ void enqueue(ServerMessage message, Action<? super MessageInstance<?,C>> action);
boolean isDurable();
boolean isDeleted();
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueConsumer.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueConsumer.java
index bd4724db20..45dc556732 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueConsumer.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueConsumer.java
@@ -21,7 +21,6 @@
package org.apache.qpid.server.queue;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.filter.FilterManager;
import org.apache.qpid.server.logging.LogActor;
import org.apache.qpid.server.logging.LogSubject;
@@ -41,7 +40,6 @@ import java.text.MessageFormat;
import java.util.EnumMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
@@ -149,15 +147,7 @@ class QueueConsumer<T extends ConsumerTarget, E extends QueueEntryImpl<E,Q,L>, Q
if(newState == ConsumerTarget.State.CLOSED && oldState != newState && !_closed.get())
{
- try
- {
- close();
- }
- catch (AMQException e)
- {
- _logger.error("Unable to remove to remove consumer", e);
- throw new RuntimeException(e);
- }
+ close();
}
final StateChangeListener<? super QueueConsumer<T,E,Q,L>, State> stateListener = getStateListener();
if(stateListener != null)
@@ -202,7 +192,7 @@ class QueueConsumer<T extends ConsumerTarget, E extends QueueEntryImpl<E,Q,L>, Q
}
@Override
- public void close() throws AMQException
+ public void close()
{
if(_closed.compareAndSet(false,true))
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueEntryImpl.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueEntryImpl.java
index 433daedee9..1f09fe3fb9 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueEntryImpl.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueEntryImpl.java
@@ -22,7 +22,6 @@ package org.apache.qpid.server.queue;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.exchange.Exchange;
import org.apache.qpid.server.filter.Filterable;
import org.apache.qpid.server.message.InstanceProperties;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueFactory.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueFactory.java
index d58de14000..8c0386c7b4 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueFactory.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueFactory.java
@@ -22,7 +22,6 @@ package org.apache.qpid.server.queue;
import java.util.Map;
import java.util.UUID;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.security.QpidSecurityException;
public interface QueueFactory
@@ -34,7 +33,7 @@ public interface QueueFactory
boolean autoDelete,
boolean exclusive,
boolean deleteOnNoConsumer,
- Map<String, Object> arguments) throws QpidSecurityException, AMQException;
+ Map<String, Object> arguments) throws QpidSecurityException;
AMQQueue restoreQueue(UUID id,
String queueName,
@@ -42,6 +41,6 @@ public interface QueueFactory
boolean autoDelete,
boolean exclusive,
boolean deleteOnNoConsumer,
- Map<String, Object> arguments) throws QpidSecurityException, AMQException;
+ Map<String, Object> arguments) throws QpidSecurityException;
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueRunner.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueRunner.java
index 005d9b66b3..317e184dae 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueRunner.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueRunner.java
@@ -26,8 +26,8 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.logging.actors.CurrentActor;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import org.apache.qpid.transport.TransportException;
/**
@@ -70,9 +70,17 @@ public class QueueRunner implements Runnable
runAgain = _queue.processQueue(this);
}
- catch (final AMQException e)
+ catch (final ConnectionScopedRuntimeException e)
{
- _logger.error("Exception during asynchronous delivery by " + toString(), e);
+ final String errorMessage = "Problem during asynchronous delivery by " + toString();
+ if(_logger.isDebugEnabled())
+ {
+ _logger.debug(errorMessage, e);
+ }
+ else
+ {
+ _logger.info(errorMessage + ' ' + e.getMessage());
+ }
}
catch (final TransportException transe)
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
index c07264b628..b2408f6dfa 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
@@ -28,7 +28,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.pool.ReferenceCountingExecutorService;
import org.apache.qpid.server.binding.Binding;
@@ -382,7 +381,7 @@ abstract class SimpleAMQQueue<E extends QueueEntryImpl<E,Q,L>, Q extends SimpleA
final FilterManager filters,
final Class<? extends ServerMessage> messageClass,
final String consumerName,
- EnumSet<Consumer.Option> optionSet) throws AMQException, QpidSecurityException
+ EnumSet<Consumer.Option> optionSet) throws ExistingExclusiveConsumer, ExistingConsumerPreventsExclusive, QpidSecurityException
{
// Access control
@@ -460,7 +459,7 @@ abstract class SimpleAMQQueue<E extends QueueEntryImpl<E,Q,L>, Q extends SimpleA
}
- synchronized void unregisterConsumer(final QueueConsumer<?,E,Q,L> consumer) throws AMQException
+ synchronized void unregisterConsumer(final QueueConsumer<?,E,Q,L> consumer)
{
if (consumer == null)
{
@@ -622,7 +621,7 @@ abstract class SimpleAMQQueue<E extends QueueEntryImpl<E,Q,L>, Q extends SimpleA
// ------ Enqueue / Dequeue
- public void enqueue(ServerMessage message, Action<? super MessageInstance<?, QueueConsumer<?,E,Q,L>>> action) throws AMQException
+ public void enqueue(ServerMessage message, Action<? super MessageInstance<?, QueueConsumer<?,E,Q,L>>> action)
{
incrementQueueCount();
incrementQueueSize(message);
@@ -711,7 +710,6 @@ abstract class SimpleAMQQueue<E extends QueueEntryImpl<E,Q,L>, Q extends SimpleA
}
private void deliverToConsumer(final QueueConsumer<?,E,Q,L> sub, final E entry)
- throws AMQException
{
if(sub.trySendLock())
@@ -810,7 +808,7 @@ abstract class SimpleAMQQueue<E extends QueueEntryImpl<E,Q,L>, Q extends SimpleA
sub.send(entry, batch);
}
- private boolean consumerReadyAndHasInterest(final QueueConsumer<?,E,Q,L> sub, final E entry) throws AMQException
+ private boolean consumerReadyAndHasInterest(final QueueConsumer<?,E,Q,L> sub, final E entry)
{
return sub.hasInterest(entry) && (getNextAvailableEntry(sub) == entry);
}
@@ -1177,7 +1175,7 @@ abstract class SimpleAMQQueue<E extends QueueEntryImpl<E,Q,L>, Q extends SimpleA
}
- public void purge(final long request) throws AMQException, QpidSecurityException
+ public void purge(final long request) throws QpidSecurityException
{
clear(request);
}
@@ -1207,7 +1205,7 @@ abstract class SimpleAMQQueue<E extends QueueEntryImpl<E,Q,L>, Q extends SimpleA
}
}
- public long clearQueue() throws AMQException, QpidSecurityException
+ public long clearQueue() throws QpidSecurityException
{
return clear(0l);
}
@@ -1279,7 +1277,7 @@ abstract class SimpleAMQQueue<E extends QueueEntryImpl<E,Q,L>, Q extends SimpleA
}
// TODO list all thrown exceptions
- public int delete() throws AMQException, QpidSecurityException
+ public int delete() throws QpidSecurityException
{
// Check access
if (!_virtualHost.getSecurityManager().authoriseDelete(this))
@@ -1667,9 +1665,8 @@ abstract class SimpleAMQQueue<E extends QueueEntryImpl<E,Q,L>, Q extends SimpleA
* ends the current instance
*
* @param runner the Runner to schedule
- * @throws AMQException
*/
- public long processQueue(QueueRunner runner) throws AMQException
+ public long processQueue(QueueRunner runner)
{
long stateChangeCount;
long previousStateChangeCount = Long.MIN_VALUE;
@@ -1790,7 +1787,7 @@ abstract class SimpleAMQQueue<E extends QueueEntryImpl<E,Q,L>, Q extends SimpleA
}
- public void checkMessageStatus() throws AMQException
+ public void checkMessageStatus()
{
QueueEntryIterator<E,Q,L,QueueConsumer<?,E,Q,L>> queueListIterator = _entries.iterator();
@@ -2102,7 +2099,7 @@ abstract class SimpleAMQQueue<E extends QueueEntryImpl<E,Q,L>, Q extends SimpleA
/**
* Checks if there is any notification to send to the listeners
*/
- private void checkForNotification(ServerMessage<?> msg) throws AMQException
+ private void checkForNotification(ServerMessage<?> msg)
{
final Set<NotificationCheck> notificationChecks = getNotificationChecks();
final AMQQueue.NotificationListener listener = _notificationListener;
@@ -2164,11 +2161,6 @@ abstract class SimpleAMQQueue<E extends QueueEntryImpl<E,Q,L>, Q extends SimpleA
{
SimpleAMQQueue.this.enqueue(message, postEnqueueAction);
}
- catch (AMQException e)
- {
- // TODO
- throw new RuntimeException(e);
- }
finally
{
_reference.release();
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SortedQueue.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SortedQueue.java
index 2cae18f3ec..f85f9479bb 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SortedQueue.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SortedQueue.java
@@ -19,8 +19,6 @@
*/
package org.apache.qpid.server.queue;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.consumer.Consumer;
import org.apache.qpid.server.message.MessageInstance;
import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.util.Action;
@@ -67,7 +65,6 @@ public class SortedQueue extends OutOfOrderQueue<SortedQueueEntry, SortedQueue,
@Override
public void enqueue(final ServerMessage message,
final Action<? super MessageInstance<?, QueueConsumer<?, SortedQueueEntry, SortedQueue, SortedQueueEntryList>>> action)
- throws AMQException
{
synchronized (_sortedQueueLock)
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SubFlushRunner.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SubFlushRunner.java
index 50af44fed4..2100e3c5cd 100755
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SubFlushRunner.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/SubFlushRunner.java
@@ -23,7 +23,6 @@ package org.apache.qpid.server.queue;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.logging.actors.CurrentActor;
import org.apache.qpid.transport.TransportException;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/database/HashedUser.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/database/HashedUser.java
index b9de1587b5..2b2ecd1d92 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/database/HashedUser.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/database/HashedUser.java
@@ -22,6 +22,7 @@ package org.apache.qpid.server.security.auth.database;
import org.apache.commons.codec.binary.Base64;
import org.apache.log4j.Logger;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
@@ -54,7 +55,7 @@ public class HashedUser implements PasswordPrincipal
}
catch (UnsupportedEncodingException e)
{
- throw new RuntimeException("MD5 encoding not supported, even though the Java standard requires it",e);
+ throw new ServerScopedRuntimeException("MD5 encoding not supported, even though the Java standard requires it",e);
}
Base64 b64 = new Base64();
@@ -86,7 +87,7 @@ public class HashedUser implements PasswordPrincipal
}
catch (NoSuchAlgorithmException e)
{
- throw new RuntimeException("MD5 not supported although Java compliance requires it");
+ throw new ServerScopedRuntimeException("MD5 not supported although Java compliance requires it");
}
for (byte b : data)
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManager.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManager.java
index 726284fcce..2cb61b451f 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManager.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManager.java
@@ -20,6 +20,9 @@
package org.apache.qpid.server.security.auth.manager;
import java.io.IOException;
+import java.security.GeneralSecurityException;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
import java.security.Principal;
import java.util.Hashtable;
@@ -49,6 +52,7 @@ import org.apache.qpid.server.security.auth.manager.ldap.AbstractLDAPSSLSocketFa
import org.apache.qpid.server.security.auth.manager.ldap.LDAPSSLSocketFactoryGenerator;
import org.apache.qpid.server.security.auth.sasl.plain.PlainPasswordCallback;
import org.apache.qpid.server.security.auth.sasl.plain.PlainSaslServer;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.server.util.StringUtil;
import org.apache.qpid.ssl.SSLContextFactory;
@@ -267,11 +271,22 @@ public class SimpleLDAPAuthenticationManager implements AuthenticationManager
sslContext = SSLContext.getInstance("TLS");
sslContext.init(null, _trustStore.getTrustManagers(), null);
}
- catch (Exception e)
+ catch (NoSuchAlgorithmException e)
{
_logger.error("Exception creating SSLContext", e);
- throw new RuntimeException("Error creating SSLContext for trust store : " + _trustStore.getName() , e);
+ throw new ServerScopedRuntimeException("Error creating SSLContext for trust store : " + _trustStore.getName() , e);
}
+ catch (KeyManagementException e)
+ {
+ _logger.error("Exception creating SSLContext", e);
+ throw new ServerScopedRuntimeException("Error creating SSLContext for trust store : " + _trustStore.getName() , e);
+ }
+ catch (GeneralSecurityException e)
+ {
+ _logger.error("Exception creating SSLContext", e);
+ throw new ServerScopedRuntimeException("Error creating SSLContext for trust store : " + _trustStore.getName() , e);
+ }
+
Class<? extends AbstractLDAPSSLSocketFactory> clazz = LDAPSSLSocketFactoryGenerator.createSubClass(clazzName, sslContext.getSocketFactory());
if (_logger.isDebugEnabled())
{
@@ -295,7 +310,7 @@ public class SimpleLDAPAuthenticationManager implements AuthenticationManager
}
catch (NamingException e)
{
- throw new RuntimeException("Unable to establish anonymous connection to the ldap server at " + _providerSearchURL, e);
+ throw new ServerScopedRuntimeException("Unable to establish anonymous connection to the ldap server at " + _providerSearchURL, e);
}
finally
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ldap/LDAPSSLSocketFactoryGenerator.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ldap/LDAPSSLSocketFactoryGenerator.java
index 5cfc8b7a0b..6aa900ceaa 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ldap/LDAPSSLSocketFactoryGenerator.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/ldap/LDAPSSLSocketFactoryGenerator.java
@@ -42,6 +42,7 @@ import org.apache.bcel.generic.InstructionFactory;
import org.apache.bcel.generic.InstructionList;
import org.apache.bcel.generic.MethodGen;
import org.apache.bcel.generic.Type;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
/**
* This class provides a single method, {@link #createSubClass(String, SSLSocketFactory)}. This creates a
@@ -214,19 +215,19 @@ public class LDAPSSLSocketFactoryGenerator
}
catch (IllegalArgumentException e)
{
- throw new RuntimeException(exceptionMessage, e);
+ throw new ServerScopedRuntimeException(exceptionMessage, e);
}
catch (IllegalAccessException e)
{
- throw new RuntimeException(exceptionMessage, e);
+ throw new ServerScopedRuntimeException(exceptionMessage, e);
}
catch (NoSuchFieldException e)
{
- throw new RuntimeException(exceptionMessage, e);
+ throw new ServerScopedRuntimeException(exceptionMessage, e);
}
catch (SecurityException e)
{
- throw new RuntimeException(exceptionMessage, e);
+ throw new ServerScopedRuntimeException(exceptionMessage, e);
}
}
@@ -252,19 +253,19 @@ public class LDAPSSLSocketFactoryGenerator
}
catch (NoSuchFieldException e)
{
- throw new RuntimeException(exceptionMessage, e);
+ throw new ServerScopedRuntimeException(exceptionMessage, e);
}
catch (SecurityException e)
{
- throw new RuntimeException(exceptionMessage, e);
+ throw new ServerScopedRuntimeException(exceptionMessage, e);
}
catch (IllegalArgumentException e)
{
- throw new RuntimeException(exceptionMessage, e);
+ throw new ServerScopedRuntimeException(exceptionMessage, e);
}
catch (IllegalAccessException e)
{
- throw new RuntimeException(exceptionMessage, e);
+ throw new ServerScopedRuntimeException(exceptionMessage, e);
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HashedSaslServer.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HashedSaslServer.java
index a2d9fa5e3e..6e5dd1aec8 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HashedSaslServer.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HashedSaslServer.java
@@ -20,6 +20,8 @@
*/
package org.apache.qpid.server.security.auth.sasl.crammd5;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
+
import javax.security.auth.callback.CallbackHandler;
import javax.security.sasl.Sasl;
import javax.security.sasl.SaslException;
@@ -60,7 +62,7 @@ public class CRAMMD5HashedSaslServer implements SaslServer
}
}
- throw new RuntimeException("No default SaslServer found for mechanism:" + "CRAM-MD5");
+ throw new ServerScopedRuntimeException("No default SaslServer found for mechanism:" + "CRAM-MD5");
}
public String getMechanismName()
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HexSaslServer.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HexSaslServer.java
index e19baaa7c6..8ae0a0044a 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HexSaslServer.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/sasl/crammd5/CRAMMD5HexSaslServer.java
@@ -20,6 +20,8 @@
*/
package org.apache.qpid.server.security.auth.sasl.crammd5;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
+
import javax.security.auth.callback.CallbackHandler;
import javax.security.sasl.Sasl;
import javax.security.sasl.SaslException;
@@ -60,7 +62,7 @@ public class CRAMMD5HexSaslServer implements SaslServer
}
}
- throw new RuntimeException("No default SaslServer found for mechanism:" + "CRAM-MD5");
+ throw new ServerScopedRuntimeException("No default SaslServer found for mechanism:" + "CRAM-MD5");
}
public String getMechanismName()
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/group/FileGroupDatabase.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/group/FileGroupDatabase.java
index c66e7fd4e4..0a02ce38fc 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/group/FileGroupDatabase.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/group/FileGroupDatabase.java
@@ -34,6 +34,7 @@ import java.util.concurrent.ConcurrentSkipListSet;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
/**
* A group database that reads/writes the following file format:
@@ -181,7 +182,7 @@ public class FileGroupDatabase implements GroupDatabase
}
catch (IOException e)
{
- throw new RuntimeException("Unable to persist change to file " + _groupFile);
+ throw new ServerScopedRuntimeException("Unable to persist change to file " + _groupFile);
}
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AMQStoreException.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AMQStoreException.java
new file mode 100644
index 0000000000..98ed01efb4
--- /dev/null
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AMQStoreException.java
@@ -0,0 +1,47 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.server.store;
+
+
+/**
+ * StoreException is a specific type of internal error relating to errors in the message store, such as {@link java.sql.SQLException}.
+ */
+public class AMQStoreException extends Exception
+{
+ /** serialVersionUID */
+ private static final long serialVersionUID = 2859681947490637496L;
+
+ /**
+ * Creates an exception with an optional message and optional underlying cause.
+ *
+ * @param msg The exception message. May be null if not to be set.
+ * @param cause The underlying cause of the exception. May be null if not to be set.
+ */
+ public AMQStoreException(String msg, Throwable cause)
+ {
+ super(((msg == null) ? "Store error" : msg), cause);
+ }
+
+ public AMQStoreException(String msg)
+ {
+ this(msg, null);
+ }
+}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java
index d80fa656e7..dd9f5ebe51 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java
@@ -43,12 +43,11 @@ import java.util.UUID;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.message.EnqueueableMessage;
import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.plugin.MessageMetaDataType;
import org.apache.qpid.server.queue.AMQQueue;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
@@ -177,7 +176,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
@Override
- public void configureConfigStore(VirtualHost virtualHost, ConfigurationRecoveryHandler configRecoveryHandler) throws Exception
+ public void configureConfigStore(VirtualHost virtualHost, ConfigurationRecoveryHandler configRecoveryHandler)
{
_stateManager.attainState(State.INITIALISING);
_configRecoveryHandler = configRecoveryHandler;
@@ -187,7 +186,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
@Override
public void configureMessageStore(VirtualHost virtualHost, MessageStoreRecoveryHandler recoveryHandler,
- TransactionLogRecoveryHandler tlogRecoveryHandler) throws Exception
+ TransactionLogRecoveryHandler tlogRecoveryHandler)
{
if(_stateManager.isInState(State.INITIAL))
{
@@ -201,7 +200,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
completeInitialisation();
}
- private void completeInitialisation() throws ClassNotFoundException, SQLException, AMQStoreException
+ private void completeInitialisation()
{
commonConfiguration();
@@ -209,7 +208,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
@Override
- public void activate() throws Exception
+ public void activate()
{
if(_stateManager.isInState(State.INITIALISING))
{
@@ -224,12 +223,28 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
if(_messageRecoveryHandler != null)
{
- recoverMessages(_messageRecoveryHandler);
+ try
+ {
+ recoverMessages(_messageRecoveryHandler);
+ }
+ catch (SQLException e)
+ {
+ throw new ServerScopedRuntimeException("Error encountered when restoring message data from " +
+ "persistent store ", e);
+ }
}
if(_tlogRecoveryHandler != null)
{
- TransactionLogRecoveryHandler.DtxRecordRecoveryHandler dtxrh = recoverQueueEntries(_tlogRecoveryHandler);
- recoverXids(dtxrh);
+ try
+ {
+ TransactionLogRecoveryHandler.DtxRecordRecoveryHandler dtxrh = recoverQueueEntries(_tlogRecoveryHandler);
+ recoverXids(dtxrh);
+ }
+ catch (SQLException e)
+ {
+ throw new ServerScopedRuntimeException("Error encountered when restoring distributed transaction " +
+ "data from persistent store ", e);
+ }
}
@@ -237,14 +252,24 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
private void commonConfiguration()
- throws ClassNotFoundException, SQLException, AMQStoreException
{
- implementationSpecificConfiguration(_virtualHost.getName(), _virtualHost);
- createOrOpenDatabase();
- upgradeIfNecessary();
+ try
+ {
+ implementationSpecificConfiguration(_virtualHost.getName(), _virtualHost);
+ createOrOpenDatabase();
+ upgradeIfNecessary();
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new ServerScopedRuntimeException("Unable to configure message store ", e);
+ }
+ catch (SQLException e)
+ {
+ throw new ServerScopedRuntimeException("Unable to configure message store ", e);
+ }
}
- protected void upgradeIfNecessary() throws SQLException, AMQStoreException
+ protected void upgradeIfNecessary() throws SQLException
{
Connection conn = newAutoCommitConnection();
try
@@ -258,7 +283,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
{
if(!rs.next())
{
- throw new AMQStoreException(DB_VERSION_TABLE_NAME + " does not contain the database version");
+ throw new ServerScopedRuntimeException(DB_VERSION_TABLE_NAME + " does not contain the database version");
}
int version = rs.getInt(1);
switch (version)
@@ -268,7 +293,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
case DB_VERSION:
return;
default:
- throw new AMQStoreException("Unknown database version: " + version);
+ throw new ServerScopedRuntimeException("Unknown database version: " + version);
}
}
finally
@@ -591,7 +616,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
}
- protected void recoverConfiguration(ConfigurationRecoveryHandler recoveryHandler) throws AMQException
+ protected void recoverConfiguration(ConfigurationRecoveryHandler recoveryHandler)
{
try
{
@@ -602,7 +627,11 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
catch (SQLException e)
{
- throw new AMQStoreException("Error recovering persistent state: " + e.getMessage(), e);
+ throw new ServerScopedRuntimeException("Error recovering persistent state: " + e.getMessage(), e);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("Error recovering persistent state: " + e.getMessage(), e);
}
}
@@ -668,7 +697,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
@Override
- public void close() throws Exception
+ public void close()
{
if (_closed.compareAndSet(false, true))
{
@@ -681,7 +710,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
- protected abstract void doClose() throws Exception;
+ protected abstract void doClose();
@Override
public StoredMessage addMessage(StorableMessageMetaData metaData)
@@ -756,7 +785,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
catch (SQLException e)
{
- throw new RuntimeException("Error removing message with id " + messageId + " from database: " + e.getMessage(), e);
+ throw new ServerScopedRuntimeException("Error removing message with id " + messageId + " from database: " + e.getMessage(), e);
}
}
@@ -1208,7 +1237,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
if(result == 0)
{
- throw new RuntimeException("Unable to add meta data for message " +messageId);
+ throw new ServerScopedRuntimeException("Unable to add meta data for message " +messageId);
}
}
finally
@@ -1533,7 +1562,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
else
{
- throw new RuntimeException("Meta data not found for message with id " + messageId);
+ throw new ServerScopedRuntimeException("Meta data not found for message with id " + messageId);
}
}
finally
@@ -1579,7 +1608,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
catch (SQLException e)
{
closeConnection(conn);
- throw new RuntimeException("Error adding content for message " + messageId + ": " + e.getMessage(), e);
+ throw new ServerScopedRuntimeException("Error adding content for message " + messageId + ": " + e.getMessage(), e);
}
finally
{
@@ -1611,7 +1640,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
if (offset > size)
{
- throw new RuntimeException("Offset " + offset + " is greater than message size " + size
+ throw new ServerScopedRuntimeException("Offset " + offset + " is greater than message size " + size
+ " for message id " + messageId + "!");
}
@@ -1630,7 +1659,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
catch (SQLException e)
{
- throw new RuntimeException("Error retrieving content from offset " + offset + " for message " + messageId + ": " + e.getMessage(), e);
+ throw new ServerScopedRuntimeException("Error retrieving content from offset " + offset + " for message " + messageId + ": " + e.getMessage(), e);
}
finally
{
@@ -1662,12 +1691,12 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
catch (SQLException e)
{
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
}
@Override
- public void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException
+ public void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message)
{
final StoredMessage storedMessage = message.getStoredMessage();
if(storedMessage instanceof StoredJDBCMessage)
@@ -1678,52 +1707,100 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
catch (SQLException e)
{
- throw new AMQStoreException("Exception on enqueuing message " + _messageId, e);
+ throw new ServerScopedRuntimeException("Exception on enqueuing message into message store" + _messageId, e);
}
}
_storeSizeIncrease += storedMessage.getMetaData().getContentSize();
- AbstractJDBCMessageStore.this.enqueueMessage(_connWrapper, queue, message.getMessageNumber());
+ try
+ {
+ AbstractJDBCMessageStore.this.enqueueMessage(_connWrapper, queue, message.getMessageNumber());
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
@Override
- public void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException
+ public void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message)
{
- AbstractJDBCMessageStore.this.dequeueMessage(_connWrapper, queue, message.getMessageNumber());
+ try
+ {
+ AbstractJDBCMessageStore.this.dequeueMessage(_connWrapper, queue, message.getMessageNumber());
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
@Override
- public void commitTran() throws AMQStoreException
+ public void commitTran()
{
- AbstractJDBCMessageStore.this.commitTran(_connWrapper);
- storedSizeChange(_storeSizeIncrease);
+ try
+ {
+ AbstractJDBCMessageStore.this.commitTran(_connWrapper);
+ storedSizeChange(_storeSizeIncrease);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
@Override
- public StoreFuture commitTranAsync() throws AMQStoreException
+ public StoreFuture commitTranAsync()
{
- final StoreFuture storeFuture = AbstractJDBCMessageStore.this.commitTranAsync(_connWrapper);
- storedSizeChange(_storeSizeIncrease);
- return storeFuture;
+ try
+ {
+ StoreFuture storeFuture = AbstractJDBCMessageStore.this.commitTranAsync(_connWrapper);
+ storedSizeChange(_storeSizeIncrease);
+ return storeFuture;
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
@Override
- public void abortTran() throws AMQStoreException
+ public void abortTran()
{
- AbstractJDBCMessageStore.this.abortTran(_connWrapper);
+ try
+ {
+ AbstractJDBCMessageStore.this.abortTran(_connWrapper);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
@Override
- public void removeXid(long format, byte[] globalId, byte[] branchId) throws AMQStoreException
+ public void removeXid(long format, byte[] globalId, byte[] branchId)
{
- AbstractJDBCMessageStore.this.removeXid(_connWrapper, format, globalId, branchId);
+ try
+ {
+ AbstractJDBCMessageStore.this.removeXid(_connWrapper, format, globalId, branchId);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
@Override
public void recordXid(long format, byte[] globalId, byte[] branchId, Record[] enqueues, Record[] dequeues)
- throws AMQStoreException
{
- AbstractJDBCMessageStore.this.recordXid(_connWrapper, format, globalId, branchId, enqueues, dequeues);
+ try
+ {
+ AbstractJDBCMessageStore.this.recordXid(_connWrapper, format, globalId, branchId, enqueues, dequeues);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
}
@@ -1770,7 +1847,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
}
catch (SQLException e)
{
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
_metaDataRef = new SoftReference<StorableMessageMetaData>(metaData);
}
@@ -1856,7 +1933,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
{
getLogger().debug("Error when trying to flush message " + _messageId + " to store: " + e);
}
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
finally
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractMemoryMessageStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractMemoryMessageStore.java
index 1a7cd72cb6..d72bd1a5bf 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractMemoryMessageStore.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractMemoryMessageStore.java
@@ -22,7 +22,7 @@ package org.apache.qpid.server.store;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
-import org.apache.qpid.AMQStoreException;
+
import org.apache.qpid.server.message.EnqueueableMessage;
import org.apache.qpid.server.model.VirtualHost;
@@ -35,28 +35,28 @@ abstract public class AbstractMemoryMessageStore extends NullMessageStore
private static final Transaction IN_MEMORY_TRANSACTION = new Transaction()
{
@Override
- public StoreFuture commitTranAsync() throws AMQStoreException
+ public StoreFuture commitTranAsync()
{
return StoreFuture.IMMEDIATE_FUTURE;
}
@Override
- public void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException
+ public void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message)
{
}
@Override
- public void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException
+ public void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message)
{
}
@Override
- public void commitTran() throws AMQStoreException
+ public void commitTran()
{
}
@Override
- public void abortTran() throws AMQStoreException
+ public void abortTran()
{
}
@@ -80,14 +80,14 @@ abstract public class AbstractMemoryMessageStore extends NullMessageStore
}
@Override
- public void configureConfigStore(VirtualHost virtualHost, ConfigurationRecoveryHandler recoveryHandler) throws Exception
+ public void configureConfigStore(VirtualHost virtualHost, ConfigurationRecoveryHandler recoveryHandler)
{
_stateManager.attainState(State.INITIALISING);
}
@Override
public void configureMessageStore(VirtualHost virtualHost, MessageStoreRecoveryHandler recoveryHandler,
- TransactionLogRecoveryHandler tlogRecoveryHandler) throws Exception
+ TransactionLogRecoveryHandler tlogRecoveryHandler)
{
if(_stateManager.isInState(State.INITIAL))
{
@@ -97,7 +97,7 @@ abstract public class AbstractMemoryMessageStore extends NullMessageStore
}
@Override
- public void activate() throws Exception
+ public void activate()
{
if(_stateManager.isInState(State.INITIALISING))
@@ -131,7 +131,7 @@ abstract public class AbstractMemoryMessageStore extends NullMessageStore
}
@Override
- public void close() throws Exception
+ public void close()
{
if (_closed.compareAndSet(false, true))
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationRecoverer.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationRecoverer.java
index 1caaedf6dc..ced677b005 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationRecoverer.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationRecoverer.java
@@ -27,11 +27,11 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.configuration.IllegalConfigurationException;
import org.apache.qpid.server.logging.actors.CurrentActor;
import org.apache.qpid.server.logging.messages.ConfigStoreMessages;
import org.apache.qpid.server.logging.subjects.MessageStoreLogSubject;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import static org.apache.qpid.server.model.VirtualHost.CURRENT_CONFIG_VERSION;
@@ -138,7 +138,7 @@ public class DurableConfigurationRecoverer implements ConfigurationRecoveryHandl
catch (AMQStoreException e)
{
// TODO better exception
- throw new RuntimeException("Unable to update config store when upgrading");
+ throw new ServerScopedRuntimeException("Unable to update config store when upgrading");
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStore.java
index 9c9ce7df59..6c90247ebc 100755
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStore.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStore.java
@@ -23,7 +23,6 @@ package org.apache.qpid.server.store;
import java.util.Map;
import java.util.UUID;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.model.VirtualHost;
public interface DurableConfigurationStore
@@ -44,9 +43,8 @@ public interface DurableConfigurationStore
*
* @param virtualHost
* @param recoveryHandler Handler to be called as the store recovers on start up
- * @throws Exception If any error occurs that means the store is unable to configure itself.
*/
- void configureConfigStore(VirtualHost virtualHost, ConfigurationRecoveryHandler recoveryHandler) throws Exception;
+ void configureConfigStore(VirtualHost virtualHost, ConfigurationRecoveryHandler recoveryHandler);
/**
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStoreHelper.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStoreHelper.java
index eff9bdf433..50837d433e 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStoreHelper.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/DurableConfigurationStoreHelper.java
@@ -28,13 +28,13 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
-import org.apache.qpid.AMQStoreException;
-import org.apache.qpid.server.consumer.Consumer;
+
import org.apache.qpid.server.model.Binding;
import org.apache.qpid.server.model.Exchange;
import org.apache.qpid.server.model.LifetimePolicy;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.queue.AMQQueue;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class DurableConfigurationStoreHelper
{
@@ -47,7 +47,7 @@ public class DurableConfigurationStoreHelper
Queue.EXCLUSIVE,
Queue.ALTERNATE_EXCHANGE));
- public static void updateQueue(DurableConfigurationStore store, AMQQueue<?,?,?> queue) throws AMQStoreException
+ public static void updateQueue(DurableConfigurationStore store, AMQQueue<?,?,?> queue)
{
Map<String, Object> attributesMap = new LinkedHashMap<String, Object>();
attributesMap.put(Queue.NAME, queue.getName());
@@ -69,11 +69,17 @@ public class DurableConfigurationStoreHelper
}
}
- store.update(queue.getId(), QUEUE, attributesMap);
+ try
+ {
+ store.update(queue.getId(), QUEUE, attributesMap);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem was encountered with the configuration store ", e);
+ }
}
public static void createQueue(DurableConfigurationStore store, AMQQueue<?,?,?> queue)
- throws AMQStoreException
{
Map<String, Object> attributesMap = new HashMap<String, Object>();
attributesMap.put(Queue.NAME, queue.getName());
@@ -91,35 +97,60 @@ public class DurableConfigurationStoreHelper
attributesMap.put(attrName, queue.getAttribute(attrName));
}
}
- store.create(queue.getId(), QUEUE,attributesMap);
+ try
+ {
+ store.create(queue.getId(), QUEUE, attributesMap);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem was encountered with the configuration store ", e);
+ }
}
- public static void removeQueue(DurableConfigurationStore store, AMQQueue queue) throws AMQStoreException
+ public static void removeQueue(DurableConfigurationStore store, AMQQueue queue)
{
- store.remove(queue.getId(), QUEUE);
+ try
+ {
+ store.remove(queue.getId(), QUEUE);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem was encountered with the configuration store ", e);
+ }
}
public static void createExchange(DurableConfigurationStore store, org.apache.qpid.server.exchange.Exchange exchange)
- throws AMQStoreException
{
Map<String, Object> attributesMap = new HashMap<String, Object>();
attributesMap.put(Exchange.NAME, exchange.getName());
attributesMap.put(Exchange.TYPE, exchange.getTypeName());
attributesMap.put(Exchange.LIFETIME_POLICY, exchange.isAutoDelete() ? LifetimePolicy.AUTO_DELETE.name()
: LifetimePolicy.PERMANENT.name());
- store.create(exchange.getId(), EXCHANGE, attributesMap);
+ try
+ {
+ store.create(exchange.getId(), EXCHANGE, attributesMap);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem was encountered with the configuration store ", e);
+ }
}
public static void removeExchange(DurableConfigurationStore store, org.apache.qpid.server.exchange.Exchange exchange)
- throws AMQStoreException
{
- store.remove(exchange.getId(), EXCHANGE);
+ try
+ {
+ store.remove(exchange.getId(), EXCHANGE);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem was encountered with the configuration store ", e);
+ }
}
public static void createBinding(DurableConfigurationStore store, org.apache.qpid.server.binding.Binding binding)
- throws AMQStoreException
{
Map<String, Object> attributesMap = new HashMap<String, Object>();
attributesMap.put(Binding.NAME, binding.getBindingKey());
@@ -130,14 +161,27 @@ public class DurableConfigurationStoreHelper
{
attributesMap.put(Binding.ARGUMENTS, arguments);
}
- store.create(binding.getId(), BINDING, attributesMap);
+ try
+ {
+ store.create(binding.getId(), BINDING, attributesMap);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem was encountered with the configuration store ", e);
+ }
}
public static void removeBinding(DurableConfigurationStore store, org.apache.qpid.server.binding.Binding binding)
- throws AMQStoreException
{
- store.remove(binding.getId(), BINDING);
+ try
+ {
+ store.remove(binding.getId(), BINDING);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem was encountered with the configuration store ", e);
+ }
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java
index 9b20c9a780..c80158965c 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java
@@ -34,10 +34,13 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-import org.apache.qpid.AMQStoreException;
+
import org.apache.qpid.server.model.ConfiguredObject;
import org.apache.qpid.server.model.Model;
import org.apache.qpid.server.model.VirtualHost;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.SerializationConfig;
@@ -66,14 +69,13 @@ public class JsonFileConfigStore implements DurableConfigurationStore
@Override
public void configureConfigStore(final VirtualHost virtualHost, final ConfigurationRecoveryHandler recoveryHandler)
- throws Exception
{
_name = virtualHost.getName();
Object storePathAttr = virtualHost.getAttribute(VirtualHost.CONFIG_STORE_PATH);
if(!(storePathAttr instanceof String))
{
- throw new AMQStoreException("Cannot determine path for configuration storage");
+ throw new ServerScopedRuntimeException("Cannot determine path for configuration storage");
}
_directoryName = (String) storePathAttr;
_configFileName = _name + ".json";
@@ -86,7 +88,14 @@ public class JsonFileConfigStore implements DurableConfigurationStore
if(!fileExists(_backupFileName))
{
File newFile = new File(_directoryName, _configFileName);
- _objectMapper.writeValue(newFile, Collections.emptyMap());
+ try
+ {
+ _objectMapper.writeValue(newFile, Collections.emptyMap());
+ }
+ catch (IOException e)
+ {
+ throw new ServerScopedRuntimeException("Could not write configuration file " + newFile, e);
+ }
}
else
{
@@ -110,21 +119,21 @@ public class JsonFileConfigStore implements DurableConfigurationStore
}
}
- private void renameFile(String fromFileName, String toFileName) throws AMQStoreException
+ private void renameFile(String fromFileName, String toFileName)
{
File toFile = new File(_directoryName, toFileName);
if(toFile.exists())
{
if(!toFile.delete())
{
- throw new AMQStoreException("Cannot delete file " + toFile.getAbsolutePath());
+ throw new ServerScopedRuntimeException("Cannot delete file " + toFile.getAbsolutePath());
}
}
File fromFile = new File(_directoryName, fromFileName);
if(!fromFile.renameTo(toFile))
{
- throw new AMQStoreException("Cannot rename file " + fromFile.getAbsolutePath() + " to " + toFile.getAbsolutePath());
+ throw new ServerScopedRuntimeException("Cannot rename file " + fromFile.getAbsolutePath() + " to " + toFile.getAbsolutePath());
}
}
@@ -134,7 +143,7 @@ public class JsonFileConfigStore implements DurableConfigurationStore
return file.exists();
}
- private void getFileLock() throws AMQStoreException
+ private void getFileLock()
{
File lockFile = new File(_directoryName, _name + ".lck");
try
@@ -149,7 +158,7 @@ public class JsonFileConfigStore implements DurableConfigurationStore
}
catch (IOException ioe)
{
- throw new AMQStoreException("Cannot create the lock file " + lockFile.getName(), ioe);
+ throw new ServerScopedRuntimeException("Cannot create the lock file " + lockFile.getName(), ioe);
}
catch(OverlappingFileLockException e)
{
@@ -158,11 +167,11 @@ public class JsonFileConfigStore implements DurableConfigurationStore
if(_fileLock == null)
{
- throw new AMQStoreException("Cannot get lock on file " + lockFile.getAbsolutePath() + ". Is another instance running?");
+ throw new ServerScopedRuntimeException("Cannot get lock on file " + lockFile.getAbsolutePath() + ". Is another instance running?");
}
}
- private void checkDirectoryIsWritable(String directoryName) throws AMQStoreException
+ private void checkDirectoryIsWritable(String directoryName)
{
File dir = new File(directoryName);
if(dir.exists())
@@ -171,51 +180,68 @@ public class JsonFileConfigStore implements DurableConfigurationStore
{
if(!dir.canWrite())
{
- throw new AMQStoreException("Configuration path " + directoryName + " exists, but is not writable");
+ throw new ServerScopedRuntimeException("Configuration path " + directoryName + " exists, but is not writable");
}
}
else
{
- throw new AMQStoreException("Configuration path " + directoryName + " exists, but is not a directory");
+ throw new ServerScopedRuntimeException("Configuration path " + directoryName + " exists, but is not a directory");
}
}
else if(!dir.mkdirs())
{
- throw new AMQStoreException("Cannot create directory " + directoryName);
+ throw new ServerScopedRuntimeException("Cannot create directory " + directoryName);
}
}
- private void load() throws IOException
+ private void load()
{
- Map data = _objectMapper.readValue(new File(_directoryName,_configFileName),Map.class);
- Collection<Class<? extends ConfiguredObject>> childClasses =
- MODEL.getChildTypes(VirtualHost.class);
- data.remove("modelVersion");
- Object configVersion;
- if((configVersion = data.remove("configVersion")) instanceof Integer)
- {
- _configVersion = (Integer) configVersion;
- }
- for(Class<? extends ConfiguredObject> childClass : childClasses)
+ final File configFile = new File(_directoryName, _configFileName);
+ try
{
- final String type = childClass.getSimpleName();
- String attrName = type.toLowerCase() + "s";
- Object children = data.remove(attrName);
- if(children != null)
+ Map data = _objectMapper.readValue(configFile,Map.class);
+ Collection<Class<? extends ConfiguredObject>> childClasses =
+ MODEL.getChildTypes(VirtualHost.class);
+ data.remove("modelVersion");
+ Object configVersion;
+ if((configVersion = data.remove("configVersion")) instanceof Integer)
{
- if(children instanceof Collection)
+ _configVersion = (Integer) configVersion;
+ }
+ for(Class<? extends ConfiguredObject> childClass : childClasses)
+ {
+ final String type = childClass.getSimpleName();
+ String attrName = type.toLowerCase() + "s";
+ Object children = data.remove(attrName);
+ if(children != null)
{
- for(Object child : (Collection)children)
+ if(children instanceof Collection)
{
- if(child instanceof Map)
+ for(Object child : (Collection)children)
{
- loadChild(childClass, (Map)child, VirtualHost.class, null);
+ if(child instanceof Map)
+ {
+ loadChild(childClass, (Map)child, VirtualHost.class, null);
+ }
}
}
}
}
}
+ catch (JsonMappingException e)
+ {
+ throw new ServerScopedRuntimeException("Cannot parse the configuration file " + configFile, e);
+ }
+ catch (JsonParseException e)
+ {
+ throw new ServerScopedRuntimeException("Cannot parse the configuration file " + configFile, e);
+ }
+ catch (IOException e)
+ {
+ throw new ServerScopedRuntimeException("Could not load the configuration file " + configFile, e);
+ }
+
}
private void loadChild(final Class<? extends ConfiguredObject> clazz,
@@ -311,7 +337,7 @@ public class JsonFileConfigStore implements DurableConfigurationStore
}
}
- private void save() throws AMQStoreException
+ private void save()
{
Collection<Class<? extends ConfiguredObject>> childClasses =
MODEL.getChildTypes(VirtualHost.class);
@@ -351,7 +377,7 @@ public class JsonFileConfigStore implements DurableConfigurationStore
}
catch (IOException e)
{
- throw new AMQStoreException("Cannot save to store", e);
+ throw new ServerScopedRuntimeException("Cannot save to store", e);
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MessageStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MessageStore.java
index 996d71d51d..626b999d72 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MessageStore.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/MessageStore.java
@@ -41,9 +41,9 @@ public interface MessageStore
* @throws Exception If any error occurs that means the store is unable to configure itself.
*/
void configureMessageStore(VirtualHost virtualHost, MessageStoreRecoveryHandler messageRecoveryHandler,
- TransactionLogRecoveryHandler tlogRecoveryHandler) throws Exception;
+ TransactionLogRecoveryHandler tlogRecoveryHandler);
- void activate() throws Exception;
+ void activate();
public <T extends StorableMessageMetaData> StoredMessage<T> addMessage(T metaData);
@@ -62,7 +62,7 @@ public interface MessageStore
*
* @throws Exception If the close fails.
*/
- void close() throws Exception;
+ void close();
void addEventListener(EventListener eventListener, Event... events);
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/NullMessageStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/NullMessageStore.java
index 57dbfabaa4..9100d623cd 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/NullMessageStore.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/NullMessageStore.java
@@ -21,13 +21,13 @@ package org.apache.qpid.server.store;
import java.util.Map;
import java.util.UUID;
-import org.apache.qpid.AMQStoreException;
+
import org.apache.qpid.server.model.VirtualHost;
public abstract class NullMessageStore implements MessageStore, DurableConfigurationStore
{
@Override
- public void configureConfigStore(VirtualHost virtualHost, ConfigurationRecoveryHandler recoveryHandler) throws Exception
+ public void configureConfigStore(VirtualHost virtualHost, ConfigurationRecoveryHandler recoveryHandler)
{
}
@@ -37,12 +37,12 @@ public abstract class NullMessageStore implements MessageStore, DurableConfigura
}
@Override
- public void update(ConfiguredObjectRecord... records) throws AMQStoreException
+ public void update(ConfiguredObjectRecord... records)
{
}
@Override
- public void update(boolean createIfNecessary, ConfiguredObjectRecord... records) throws AMQStoreException
+ public void update(boolean createIfNecessary, ConfiguredObjectRecord... records)
{
}
@@ -53,7 +53,7 @@ public abstract class NullMessageStore implements MessageStore, DurableConfigura
}
@Override
- public UUID[] removeConfiguredObjects(final UUID... objects) throws AMQStoreException
+ public UUID[] removeConfiguredObjects(final UUID... objects)
{
return objects;
}
@@ -65,12 +65,12 @@ public abstract class NullMessageStore implements MessageStore, DurableConfigura
@Override
public void configureMessageStore(VirtualHost virtualHost, MessageStoreRecoveryHandler recoveryHandler,
- TransactionLogRecoveryHandler tlogRecoveryHandler) throws Exception
+ TransactionLogRecoveryHandler tlogRecoveryHandler)
{
}
@Override
- public void close() throws Exception
+ public void close()
{
}
@@ -93,7 +93,7 @@ public abstract class NullMessageStore implements MessageStore, DurableConfigura
}
@Override
- public void activate() throws Exception
+ public void activate()
{
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/Transaction.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/Transaction.java
index 74b91dec2d..6f7afccac0 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/Transaction.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/Transaction.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.store;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.message.EnqueueableMessage;
public interface Transaction
@@ -32,40 +31,35 @@ public interface Transaction
*
* @param queue The queue to place the message on.
* @param message
- * @throws org.apache.qpid.AMQStoreException If the operation fails for any reason.
*/
- void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException;
+ void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message);
/**
* Extracts a message from a specified queue, in a given transactional context.
*
* @param queue The queue to place the message on.
* @param message The message to dequeue.
- * @throws AMQStoreException If the operation fails for any reason, or if the specified message does not exist.
*/
- void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException;
+ void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message);
/**
* Commits all operations performed within a given transactional context.
*
- * @throws AMQStoreException If the operation fails for any reason.
*/
- void commitTran() throws AMQStoreException;
+ void commitTran();
/**
* Commits all operations performed within a given transactional context.
*
- * @throws AMQStoreException If the operation fails for any reason.
*/
- StoreFuture commitTranAsync() throws AMQStoreException;
+ StoreFuture commitTranAsync();
/**
* Abandons all operations performed within a given transactional context.
*
- * @throws AMQStoreException If the operation fails for any reason.
*/
- void abortTran() throws AMQStoreException;
+ void abortTran();
public static interface Record
@@ -74,8 +68,8 @@ public interface Transaction
EnqueueableMessage getMessage();
}
- void removeXid(long format, byte[] globalId, byte[] branchId) throws AMQStoreException;
+ void removeXid(long format, byte[] globalId, byte[] branchId);
- void recordXid(long format, byte[] globalId, byte[] branchId, Transaction.Record[] enqueues, Transaction.Record[] dequeues)
- throws AMQStoreException;
+ void recordXid(long format, byte[] globalId, byte[] branchId, Transaction.Record[] enqueues,
+ Transaction.Record[] dequeues);
} \ No newline at end of file
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/AsyncAutoCommitTransaction.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/AsyncAutoCommitTransaction.java
index 57c67f54cd..013e9f32ed 100755
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/AsyncAutoCommitTransaction.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/AsyncAutoCommitTransaction.java
@@ -22,13 +22,10 @@ package org.apache.qpid.server.txn;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.message.EnqueueableMessage;
import org.apache.qpid.server.message.MessageInstance;
import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.queue.BaseQueue;
-import org.apache.qpid.server.queue.QueueEntry;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.StoreFuture;
import org.apache.qpid.server.store.Transaction;
@@ -116,11 +113,6 @@ public class AsyncAutoCommitTransaction implements ServerTransaction
addFuture(future, postTransactionAction);
postTransactionAction = null;
}
- catch (AMQException e)
- {
- _logger.error("Error during message dequeue", e);
- throw new RuntimeException("Error during message dequeue", e);
- }
finally
{
rollbackIfNecessary(postTransactionAction, txn);
@@ -199,11 +191,6 @@ public class AsyncAutoCommitTransaction implements ServerTransaction
addFuture(future, postTransactionAction);
postTransactionAction = null;
}
- catch (AMQException e)
- {
- _logger.error("Error during message dequeues", e);
- throw new RuntimeException("Error during message dequeues", e);
- }
finally
{
rollbackIfNecessary(postTransactionAction, txn);
@@ -236,13 +223,7 @@ public class AsyncAutoCommitTransaction implements ServerTransaction
}
addEnqueueFuture(future, postTransactionAction, message.isPersistent());
postTransactionAction = null;
- }
- catch (AMQException e)
- {
- _logger.error("Error during message enqueue", e);
- throw new RuntimeException("Error during message enqueue", e);
- }
- finally
+ }finally
{
rollbackIfNecessary(postTransactionAction, txn);
}
@@ -292,13 +273,7 @@ public class AsyncAutoCommitTransaction implements ServerTransaction
postTransactionAction = null;
- }
- catch (AMQException e)
- {
- _logger.error("Error during message enqueues", e);
- throw new RuntimeException("Error during message enqueues", e);
- }
- finally
+ }finally
{
rollbackIfNecessary(postTransactionAction, txn);
}
@@ -341,17 +316,7 @@ public class AsyncAutoCommitTransaction implements ServerTransaction
{
if (txn != null)
{
- try
- {
- txn.abortTran();
- }
- catch (AMQStoreException e)
- {
- _logger.error("Abort transaction failed", e);
- // Deliberate decision not to re-throw this exception. Rationale: we can only reach here if a previous
- // TransactionLog method has ended in Exception. If we were to re-throw here, we would prevent
- // our caller from receiving the original exception (which is likely to be more revealing of the underlying error).
- }
+ txn.abortTran();
}
if (postTransactionAction != null)
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/AutoCommitTransaction.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/AutoCommitTransaction.java
index 4ea48c6a24..15a5513e11 100755
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/AutoCommitTransaction.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/AutoCommitTransaction.java
@@ -22,13 +22,10 @@ package org.apache.qpid.server.txn;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.message.EnqueueableMessage;
import org.apache.qpid.server.message.MessageInstance;
import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.queue.BaseQueue;
-import org.apache.qpid.server.queue.QueueEntry;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.Transaction;
import org.apache.qpid.server.store.TransactionLogResource;
@@ -95,11 +92,6 @@ public class AutoCommitTransaction implements ServerTransaction
postTransactionAction.postCommit();
postTransactionAction = null;
}
- catch (AMQException e)
- {
- _logger.error("Error during message dequeue", e);
- throw new RuntimeException("Error during message dequeue", e);
- }
finally
{
rollbackIfNecessary(postTransactionAction, txn);
@@ -140,13 +132,7 @@ public class AutoCommitTransaction implements ServerTransaction
}
postTransactionAction.postCommit();
postTransactionAction = null;
- }
- catch (AMQException e)
- {
- _logger.error("Error during message dequeues", e);
- throw new RuntimeException("Error during message dequeues", e);
- }
- finally
+ }finally
{
rollbackIfNecessary(postTransactionAction, txn);
}
@@ -174,11 +160,6 @@ public class AutoCommitTransaction implements ServerTransaction
postTransactionAction.postCommit();
postTransactionAction = null;
}
- catch (AMQException e)
- {
- _logger.error("Error during message enqueue", e);
- throw new RuntimeException("Error during message enqueue", e);
- }
finally
{
rollbackIfNecessary(postTransactionAction, txn);
@@ -225,13 +206,7 @@ public class AutoCommitTransaction implements ServerTransaction
postTransactionAction = null;
- }
- catch (AMQException e)
- {
- _logger.error("Error during message enqueues", e);
- throw new RuntimeException("Error during message enqueues", e);
- }
- finally
+ }finally
{
rollbackIfNecessary(postTransactionAction, txn);
}
@@ -261,17 +236,7 @@ public class AutoCommitTransaction implements ServerTransaction
{
if (txn != null)
{
- try
- {
- txn.abortTran();
- }
- catch (AMQStoreException e)
- {
- _logger.error("Abort transaction failed", e);
- // Deliberate decision not to re-throw this exception. Rationale: we can only reach here if a previous
- // TransactionLog method has ended in Exception. If we were to re-throw here, we would prevent
- // our caller from receiving the original exception (which is likely to be more revealing of the underlying error).
- }
+ txn.abortTran();
}
if (postTransactionAction != null)
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DtxBranch.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DtxBranch.java
index 2505548ab8..fc16f8a367 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DtxBranch.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DtxBranch.java
@@ -28,13 +28,13 @@ import java.util.Map;
import java.util.concurrent.ScheduledFuture;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQStoreException;
+import org.apache.qpid.server.store.AMQStoreException;
import org.apache.qpid.server.message.EnqueueableMessage;
import org.apache.qpid.server.protocol.AMQSessionModel;
-import org.apache.qpid.server.queue.BaseQueue;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.Transaction;
import org.apache.qpid.server.store.TransactionLogResource;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.transport.Xid;
@@ -154,7 +154,7 @@ public class DtxBranch
catch (AMQStoreException e)
{
_logger.error("Unexpected error when attempting to rollback DtxBranch "+ _xid + " due to timeout", e);
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
}
});
@@ -400,15 +400,8 @@ public class DtxBranch
{
if(_transaction != null)
{
- try
- {
- _state = null;
- _transaction.abortTran();
- }
- catch(AMQStoreException e)
- {
- _logger.error("Error while closing DtxBranch " + _xid, e);
- }
+ _state = null;
+ _transaction.abortTran();
}
}
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DtxRegistry.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DtxRegistry.java
index 117beb82ef..90604b643e 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DtxRegistry.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/DtxRegistry.java
@@ -25,7 +25,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.qpid.AMQStoreException;
+import org.apache.qpid.server.store.AMQStoreException;
import org.apache.qpid.server.protocol.AMQSessionModel;
import org.apache.qpid.transport.Xid;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/LocalTransaction.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/LocalTransaction.java
index 4b02d4f8ec..b3d013c99f 100755
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/LocalTransaction.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/txn/LocalTransaction.java
@@ -27,10 +27,8 @@ import org.apache.qpid.server.store.TransactionLogResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.queue.BaseQueue;
-import org.apache.qpid.server.queue.QueueEntry;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.Transaction;
@@ -110,11 +108,9 @@ public class LocalTransaction implements ServerTransaction
beginTranIfNecessary();
_transaction.dequeueMessage(queue, message);
-
}
- catch(AMQException e)
+ catch(RuntimeException e)
{
- _logger.error("Error during message dequeues", e);
tidyUpOnError(e);
}
}
@@ -143,17 +139,16 @@ public class LocalTransaction implements ServerTransaction
beginTranIfNecessary();
_transaction.dequeueMessage(queue, message);
}
-
}
+
}
- catch(AMQException e)
+ catch(RuntimeException e)
{
- _logger.error("Error during message dequeues", e);
tidyUpOnError(e);
}
}
- private void tidyUpOnError(Exception e)
+ private void tidyUpOnError(RuntimeException e)
{
try
{
@@ -168,32 +163,20 @@ public class LocalTransaction implements ServerTransaction
_transaction.abortTran();
}
}
- catch (Exception abortException)
- {
- _logger.error("Abort transaction failed while trying to handle previous error", abortException);
- }
finally
{
- resetDetails();
+ resetDetails();
}
}
- throw new RuntimeException(e);
+ throw e;
}
-
private void beginTranIfNecessary()
{
if(_transaction == null)
{
- try
- {
- _transaction = _transactionLog.newTransaction();
- }
- catch (Exception e)
- {
- tidyUpOnError(e);
- }
+ _transaction = _transactionLog.newTransaction();
}
}
@@ -215,10 +198,8 @@ public class LocalTransaction implements ServerTransaction
beginTranIfNecessary();
_transaction.enqueueMessage(queue, message);
}
- catch (Exception e)
+ catch(RuntimeException e)
{
- _logger.error("Error during message enqueue", e);
-
tidyUpOnError(e);
}
}
@@ -245,14 +226,12 @@ public class LocalTransaction implements ServerTransaction
beginTranIfNecessary();
_transaction.enqueueMessage(queue, message);
+
}
}
-
}
- catch (Exception e)
+ catch(RuntimeException e)
{
- _logger.error("Error during message enqueue", e);
-
tidyUpOnError(e);
}
}
@@ -281,12 +260,10 @@ public class LocalTransaction implements ServerTransaction
doPostTransactionActions();
}
- catch (Exception e)
+ catch(RuntimeException e)
{
- _logger.error("Failed to commit transaction", e);
-
doRollbackActions();
- throw new RuntimeException("Failed to commit transaction", e);
+ throw e;
}
finally
{
@@ -348,14 +325,11 @@ public class LocalTransaction implements ServerTransaction
{
doPostTransactionActions();
deferred.run();
-
}
- catch (Exception e)
+ catch (RuntimeException e)
{
- _logger.error("Failed to commit transaction", e);
-
doRollbackActions();
- throw new RuntimeException("Failed to commit transaction", e);
+ throw e;
}
finally
{
@@ -371,7 +345,6 @@ public class LocalTransaction implements ServerTransaction
try
{
doPostTransactionActions();
-
deferred.run();
}
finally
@@ -382,9 +355,8 @@ public class LocalTransaction implements ServerTransaction
return future;
}
- catch (Exception e)
+ catch (RuntimeException e)
{
- _logger.error("Failed to commit transaction", e);
try
{
doRollbackActions();
@@ -393,8 +365,9 @@ public class LocalTransaction implements ServerTransaction
{
resetDetails();
}
- throw new RuntimeException("Failed to commit transaction", e);
+ throw e;
}
+
}
private void doPostTransactionActions()
@@ -425,11 +398,6 @@ public class LocalTransaction implements ServerTransaction
_transaction.abortTran();
}
}
- catch (AMQException e)
- {
- _logger.error("Failed to rollback transaction", e);
- throw new RuntimeException("Failed to rollback transaction", e);
- }
finally
{
try
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/ConnectionScopedRuntimeException.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/ConnectionScopedRuntimeException.java
index 7161846ef5..a7b527f169 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/ConnectionScopedRuntimeException.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/ConnectionScopedRuntimeException.java
@@ -20,32 +20,29 @@
*/
package org.apache.qpid.server.util;
+import org.apache.log4j.Logger;
+
public class ConnectionScopedRuntimeException extends RuntimeException
{
- public ConnectionScopedRuntimeException()
- {
- }
+ private static final Logger LOGGER = Logger.getLogger(ConnectionScopedRuntimeException.class);
+
public ConnectionScopedRuntimeException(final String message)
{
super(message);
+ LOGGER.error(message);
}
public ConnectionScopedRuntimeException(final String message, final Throwable cause)
{
super(message, cause);
+ LOGGER.error(message,cause);
}
public ConnectionScopedRuntimeException(final Throwable cause)
{
super(cause);
+ LOGGER.error("Exception occurred", cause);
}
- public ConnectionScopedRuntimeException(final String message,
- final Throwable cause,
- final boolean enableSuppression,
- final boolean writableStackTrace)
- {
- super(message, cause, enableSuppression, writableStackTrace);
- }
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/MapJsonSerializer.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/MapJsonSerializer.java
index 2d9ba38555..bd68c9e057 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/MapJsonSerializer.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/MapJsonSerializer.java
@@ -48,7 +48,7 @@ public class MapJsonSerializer
}
catch (Exception e)
{
- throw new RuntimeException("Failure to serialize map:" + attributeMap, e);
+ throw new ConnectionScopedRuntimeException("Failure to serialize map:" + attributeMap, e);
}
return stringWriter.toString();
}
@@ -62,7 +62,7 @@ public class MapJsonSerializer
}
catch (Exception e)
{
- throw new RuntimeException("Failure to deserialize json:" + json, e);
+ throw new ConnectionScopedRuntimeException("Failure to deserialize json:" + json, e);
}
return attributesMap;
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/ServerScopedRuntimeException.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/ServerScopedRuntimeException.java
index 8df7b0489c..93ba639af0 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/ServerScopedRuntimeException.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/util/ServerScopedRuntimeException.java
@@ -20,32 +20,29 @@
*/
package org.apache.qpid.server.util;
+import org.apache.log4j.Logger;
+
public class ServerScopedRuntimeException extends RuntimeException
{
- public ServerScopedRuntimeException()
- {
- }
+ private static final Logger LOGGER = Logger.getLogger(ServerScopedRuntimeException.class);
public ServerScopedRuntimeException(final String message)
{
super(message);
+ LOGGER.error(message);
+
}
public ServerScopedRuntimeException(final String message, final Throwable cause)
{
super(message, cause);
+ LOGGER.error(message, cause);
}
public ServerScopedRuntimeException(final Throwable cause)
{
super(cause);
+ LOGGER.error("Exception occurred", cause);
}
- public ServerScopedRuntimeException(final String message,
- final Throwable cause,
- final boolean enableSuppression,
- final boolean writableStackTrace)
- {
- super(message, cause, enableSuppression, writableStackTrace);
- }
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
index 88cd025728..aa70bb3e8d 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
@@ -33,7 +33,7 @@ import java.util.concurrent.TimeUnit;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
+import org.apache.qpid.server.exchange.AMQUnknownExchangeType;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.server.configuration.ExchangeConfiguration;
import org.apache.qpid.server.configuration.QueueConfiguration;
@@ -70,7 +70,7 @@ import org.apache.qpid.server.store.DurableConfiguredObjectRecoverer;
import org.apache.qpid.server.store.Event;
import org.apache.qpid.server.store.EventListener;
import org.apache.qpid.server.txn.DtxRegistry;
-import org.apache.qpid.server.virtualhost.plugins.QueueExistsException;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public abstract class AbstractVirtualHost implements VirtualHost, IConnectionRegistry.RegistryChangeListener, EventListener
{
@@ -125,7 +125,7 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
StatisticsGatherer brokerStatisticsGatherer,
SecurityManager parentSecurityManager,
VirtualHostConfiguration hostConfig,
- org.apache.qpid.server.model.VirtualHost virtualHost) throws Exception
+ org.apache.qpid.server.model.VirtualHost virtualHost)
{
if (hostConfig == null)
{
@@ -185,7 +185,7 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
}
abstract protected void initialiseStorage(VirtualHostConfiguration hostConfig,
- org.apache.qpid.server.model.VirtualHost virtualHost) throws Exception;
+ org.apache.qpid.server.model.VirtualHost virtualHost);
public IConnectionRegistry getConnectionRegistry()
{
@@ -293,17 +293,36 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
protected void initialiseModel(VirtualHostConfiguration config)
- throws ConfigurationException, AMQException, QpidSecurityException
{
_logger.debug("Loading configuration for virtualhost: " + config.getName());
+
_exchangeRegistry.initialise(_exchangeFactory);
List<String> exchangeNames = config.getExchanges();
for (String exchangeName : exchangeNames)
{
- configureExchange(config.getExchangeConfiguration(exchangeName));
+ try
+ {
+ configureExchange(config.getExchangeConfiguration(exchangeName));
+ }
+ catch (QpidSecurityException e)
+ {
+ throw new ServerScopedRuntimeException("Could not configure exchange " + exchangeName, e);
+ }
+ catch (UnknownExchangeException e)
+ {
+ throw new ServerScopedRuntimeException("Could not configure exchange " + exchangeName, e);
+ }
+ catch (ReservedExchangeNameException e)
+ {
+ throw new ServerScopedRuntimeException("Could not configure exchange " + exchangeName, e);
+ }
+ catch (AMQUnknownExchangeType e)
+ {
+ throw new ServerScopedRuntimeException("Could not configure exchange " + exchangeName, e);
+ }
}
String[] queueNames = config.getQueueNames();
@@ -311,12 +330,24 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
for (Object queueNameObj : queueNames)
{
String queueName = String.valueOf(queueNameObj);
- configureQueue(config.getQueueConfiguration(queueName));
+ try
+ {
+ configureQueue(config.getQueueConfiguration(queueName));
+ }
+ catch (ConfigurationException e)
+ {
+ throw new ServerScopedRuntimeException("Could not configure queue " + queueName, e);
+ }
+ catch (QpidSecurityException e)
+ {
+ throw new ServerScopedRuntimeException("Could not configure queue " + queueName, e);
+ }
}
}
private void configureExchange(ExchangeConfiguration exchangeConfiguration)
- throws AMQException, QpidSecurityException
+ throws QpidSecurityException, UnknownExchangeException, ReservedExchangeNameException,
+ AMQUnknownExchangeType
{
boolean durable = exchangeConfiguration.getDurable();
boolean autodelete = exchangeConfiguration.getAutoDelete();
@@ -333,7 +364,7 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
}
private void configureQueue(QueueConfiguration queueConfiguration)
- throws AMQException, ConfigurationException, QpidSecurityException
+ throws ConfigurationException, QpidSecurityException
{
AMQQueue queue = _queueFactory.createAMQQueueImpl(queueConfiguration);
String queueName = queue.getName();
@@ -384,7 +415,7 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
}
private void configureBinding(AMQQueue queue, Exchange exchange, String routingKey, Map<String,Object> arguments)
- throws AMQException, QpidSecurityException
+ throws QpidSecurityException
{
if (_logger.isInfoEnabled())
{
@@ -491,7 +522,7 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
}
@Override
- public int removeQueue(AMQQueue queue) throws AMQException, QpidSecurityException
+ public int removeQueue(AMQQueue queue) throws QpidSecurityException
{
synchronized (getQueueRegistry())
{
@@ -515,7 +546,7 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
boolean autoDelete,
boolean exclusive,
boolean deleteOnNoConsumer,
- Map<String, Object> arguments) throws AMQException, QpidSecurityException
+ Map<String, Object> arguments) throws QpidSecurityException, QueueExistsException
{
if (queueName == null)
@@ -607,7 +638,8 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
boolean durable,
boolean autoDelete,
String alternateExchangeName)
- throws AMQException, QpidSecurityException
+ throws QpidSecurityException, ExchangeExistsException, ReservedExchangeNameException,
+ UnknownExchangeException, AMQUnknownExchangeType
{
synchronized (_exchangeRegistry)
{
@@ -653,7 +685,8 @@ public abstract class AbstractVirtualHost implements VirtualHost, IConnectionReg
}
@Override
- public void removeExchange(Exchange exchange, boolean force) throws AMQException, QpidSecurityException
+ public void removeExchange(Exchange exchange, boolean force)
+ throws QpidSecurityException, ExchangeIsAlternateException, RequiredExchangeException
{
if(exchange.hasReferrers())
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/BindingRecoverer.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/BindingRecoverer.java
index 7a034647b0..6aa572d81a 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/BindingRecoverer.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/BindingRecoverer.java
@@ -25,7 +25,6 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.binding.Binding;
import org.apache.qpid.server.exchange.Exchange;
import org.apache.qpid.server.exchange.ExchangeRegistry;
@@ -120,10 +119,6 @@ public class BindingRecoverer extends AbstractDurableConfiguredObjectRecoverer<B
}
return _exchange.getBinding(_bindingName, _queue, _bindingArgumentsMap);
}
- catch (AMQException e)
- {
- throw new RuntimeException(e);
- }
catch (QpidSecurityException e)
{
throw new ServerScopedRuntimeException("Security Exception thrown when recovering. The recovery " +
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeExistsException.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeExistsException.java
index f055760efe..4e0e46e57b 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeExistsException.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeExistsException.java
@@ -19,10 +19,9 @@ package org.apache.qpid.server.virtualhost;/*
*
*/
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.exchange.Exchange;
-public class ExchangeExistsException extends AMQException
+public class ExchangeExistsException extends Exception
{
private final Exchange _existing;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeIsAlternateException.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeIsAlternateException.java
index 4be64a3b94..4674a4a534 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeIsAlternateException.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeIsAlternateException.java
@@ -1,4 +1,4 @@
-package org.apache.qpid.server.virtualhost;/*
+/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,10 +18,9 @@ package org.apache.qpid.server.virtualhost;/*
* under the License.
*
*/
+package org.apache.qpid.server.virtualhost;
-import org.apache.qpid.AMQException;
-
-public class ExchangeIsAlternateException extends AMQException
+public class ExchangeIsAlternateException extends Exception
{
public ExchangeIsAlternateException(String name)
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeRecoverer.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeRecoverer.java
index 6375af9933..59ff1ce6a1 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeRecoverer.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ExchangeRecoverer.java
@@ -22,7 +22,7 @@ package org.apache.qpid.server.virtualhost;
import java.util.Map;
import java.util.UUID;
-import org.apache.qpid.AMQException;
+import org.apache.qpid.server.exchange.AMQUnknownExchangeType;
import org.apache.qpid.server.exchange.Exchange;
import org.apache.qpid.server.exchange.ExchangeFactory;
import org.apache.qpid.server.exchange.ExchangeRegistry;
@@ -82,17 +82,22 @@ public class ExchangeRecoverer extends AbstractDurableConfiguredObjectRecoverer<
_exchange = _exchangeFactory.restoreExchange(id, exchangeName, exchangeType, autoDelete);
_exchangeRegistry.registerExchange(_exchange);
}
- }
+ }/*
catch (AMQException e)
{
throw new RuntimeException("Error recovering exchange uuid " + id + " name " + exchangeName, e);
- }
+ }*/
catch (QpidSecurityException e)
{
throw new ServerScopedRuntimeException("Security Exception thrown when recovering. The recovery " +
"thread should not be bound by permissions, this is likely " +
"a programming error.",e);
}
+ catch (AMQUnknownExchangeType e)
+ {
+ throw new ServerScopedRuntimeException("Unknown exchange type found when attempting to restore " +
+ "exchanges, check classpath", e);
+ }
}
@Override
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/plugins/QueueExistsException.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueExistsException.java
index 54f7d0d172..2fe8ce1caf 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/plugins/QueueExistsException.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueExistsException.java
@@ -18,12 +18,11 @@
* under the License.
*
*/
-package org.apache.qpid.server.virtualhost.plugins;
+package org.apache.qpid.server.virtualhost;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.queue.AMQQueue;
-public class QueueExistsException extends AMQException
+public class QueueExistsException extends Exception
{
private final AMQQueue _existing;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueRecoverer.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueRecoverer.java
index f6dd510894..fd836fdd98 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueRecoverer.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/QueueRecoverer.java
@@ -26,7 +26,6 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.exchange.Exchange;
import org.apache.qpid.server.exchange.ExchangeRegistry;
import org.apache.qpid.server.model.Queue;
@@ -127,10 +126,6 @@ public class QueueRecoverer extends AbstractDurableConfiguredObjectRecoverer<AMQ
false, queueArgumentsMap);
}
}
- catch (AMQException e)
- {
- throw new RuntimeException("Error recovering queue uuid " + _id + " name " + queueName, e);
- }
catch (QpidSecurityException e)
{
throw new ServerScopedRuntimeException("Security Exception thrown when recovering. The recovery " +
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/RequiredExchangeException.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/RequiredExchangeException.java
index da4c9825b1..5073c558da 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/RequiredExchangeException.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/RequiredExchangeException.java
@@ -1,4 +1,4 @@
-package org.apache.qpid.server.virtualhost;/*
+/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,10 +18,9 @@ package org.apache.qpid.server.virtualhost;/*
* under the License.
*
*/
+package org.apache.qpid.server.virtualhost;
-import org.apache.qpid.AMQException;
-
-public class RequiredExchangeException extends AMQException
+public class RequiredExchangeException extends Exception
{
public RequiredExchangeException(String name)
{
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ReservedExchangeNameException.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ReservedExchangeNameException.java
index 585f045ad9..2db2227de3 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ReservedExchangeNameException.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/ReservedExchangeNameException.java
@@ -19,9 +19,7 @@ package org.apache.qpid.server.virtualhost;/*
*
*/
-import org.apache.qpid.AMQException;
-
-public class ReservedExchangeNameException extends AMQException
+public class ReservedExchangeNameException extends Exception
{
private final String _name;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHost.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHost.java
index b7e51d88d3..3ab6a57839 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHost.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHost.java
@@ -29,6 +29,7 @@ import org.apache.qpid.server.store.DurableConfigurationStoreCreator;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.MessageStoreCreator;
import org.apache.qpid.server.store.OperationalLoggingListener;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class StandardVirtualHost extends AbstractVirtualHost
{
@@ -39,29 +40,47 @@ public class StandardVirtualHost extends AbstractVirtualHost
StandardVirtualHost(VirtualHostRegistry virtualHostRegistry,
StatisticsGatherer brokerStatisticsGatherer,
org.apache.qpid.server.security.SecurityManager parentSecurityManager,
- VirtualHostConfiguration hostConfig, VirtualHost virtualHost) throws Exception
+ VirtualHostConfiguration hostConfig, VirtualHost virtualHost)
{
super(virtualHostRegistry, brokerStatisticsGatherer, parentSecurityManager, hostConfig, virtualHost);
}
- private MessageStore initialiseMessageStore(VirtualHostConfiguration hostConfig, VirtualHost virtualHost) throws Exception
+ private MessageStore initialiseMessageStore(VirtualHostConfiguration hostConfig, VirtualHost virtualHost)
{
final Object storeTypeAttr = virtualHost.getAttribute(VirtualHost.STORE_TYPE);
String storeType = storeTypeAttr == null ? null : String.valueOf(storeTypeAttr);
MessageStore messageStore = null;
if (storeType == null)
{
- final Class<?> clazz = Class.forName(hostConfig.getMessageStoreClass());
- final Object o = clazz.newInstance();
+ try
+ {
+ final Class<?> clazz = Class.forName(hostConfig.getMessageStoreClass());
+ final Object o = clazz.newInstance();
+
+ if (!(o instanceof MessageStore))
+ {
+ throw new ClassCastException(clazz + " does not implement " + MessageStore.class);
+ }
- if (!(o instanceof MessageStore))
+ messageStore = (MessageStore) o;
+ }
+ catch (ClassNotFoundException e)
{
- throw new ClassCastException(clazz + " does not implement " + MessageStore.class);
+ throw new ServerScopedRuntimeException("Failed to fina virtual host message store implementation, " +
+ "check the classpath and the configuration", e);
+ }
+ catch (InstantiationException e)
+ {
+ throw new ServerScopedRuntimeException("Failed to initialise virtual host store, " +
+ "check the configuration", e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new ServerScopedRuntimeException("Failed to initialise virtual host store, " +
+ "check the configuration", e);
}
-
- messageStore = (MessageStore) o;
}
else
{
@@ -76,7 +95,7 @@ public class StandardVirtualHost extends AbstractVirtualHost
return messageStore;
}
- private DurableConfigurationStore initialiseConfigurationStore(VirtualHost virtualHost) throws Exception
+ private DurableConfigurationStore initialiseConfigurationStore(VirtualHost virtualHost)
{
DurableConfigurationStore configurationStore;
final Object storeTypeAttr = virtualHost.getAttribute(VirtualHost.CONFIG_STORE_TYPE);
@@ -99,7 +118,7 @@ public class StandardVirtualHost extends AbstractVirtualHost
}
- protected void initialiseStorage(VirtualHostConfiguration hostConfig, VirtualHost virtualHost) throws Exception
+ protected void initialiseStorage(VirtualHostConfiguration hostConfig, VirtualHost virtualHost)
{
_messageStore = initialiseMessageStore(hostConfig, virtualHost);
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHostFactory.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHostFactory.java
index 08f35c08f9..c28bcb977f 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHostFactory.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/StandardVirtualHostFactory.java
@@ -46,7 +46,7 @@ public class StandardVirtualHostFactory implements VirtualHostFactory
StatisticsGatherer brokerStatisticsGatherer,
org.apache.qpid.server.security.SecurityManager parentSecurityManager,
VirtualHostConfiguration hostConfig,
- org.apache.qpid.server.model.VirtualHost virtualHost) throws Exception
+ org.apache.qpid.server.model.VirtualHost virtualHost)
{
return new StandardVirtualHost(virtualHostRegistry, brokerStatisticsGatherer, parentSecurityManager, hostConfig, virtualHost);
}
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/UnknownExchangeException.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/UnknownExchangeException.java
index 5704126f62..9b9029d330 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/UnknownExchangeException.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/UnknownExchangeException.java
@@ -1,4 +1,4 @@
-package org.apache.qpid.server.virtualhost;/*
+/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,10 +18,9 @@ package org.apache.qpid.server.virtualhost;/*
* under the License.
*
*/
+package org.apache.qpid.server.virtualhost;
-import org.apache.qpid.AMQException;
-
-public class UnknownExchangeException extends AMQException
+public class UnknownExchangeException extends Exception
{
private final String _exchangeName;
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java
index 1f925d13b5..7cd9045af8 100755
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java
@@ -24,7 +24,8 @@ import java.util.Collection;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ScheduledFuture;
-import org.apache.qpid.AMQException;
+
+import org.apache.qpid.server.exchange.AMQUnknownExchangeType;
import org.apache.qpid.common.Closeable;
import org.apache.qpid.server.configuration.VirtualHostConfiguration;
import org.apache.qpid.server.connection.IConnectionRegistry;
@@ -56,7 +57,7 @@ public interface VirtualHost extends DurableConfigurationStore.Source, Closeable
Collection<AMQQueue> getQueues();
- int removeQueue(AMQQueue queue) throws AMQException, QpidSecurityException;
+ int removeQueue(AMQQueue queue) throws QpidSecurityException;
AMQQueue createQueue(UUID id,
String queueName,
@@ -65,7 +66,7 @@ public interface VirtualHost extends DurableConfigurationStore.Source, Closeable
boolean autoDelete,
boolean exclusive,
boolean deleteOnNoConsumer,
- Map<String, Object> arguments) throws AMQException, QpidSecurityException;
+ Map<String, Object> arguments) throws QueueExistsException, QpidSecurityException;
Exchange createExchange(UUID id,
@@ -74,9 +75,11 @@ public interface VirtualHost extends DurableConfigurationStore.Source, Closeable
boolean durable,
boolean autoDelete,
String alternateExchange)
- throws AMQException, QpidSecurityException;
+ throws QpidSecurityException, ExchangeExistsException, ReservedExchangeNameException,
+ UnknownExchangeException, AMQUnknownExchangeType;
- void removeExchange(Exchange exchange, boolean force) throws AMQException, QpidSecurityException;
+ void removeExchange(Exchange exchange, boolean force) throws QpidSecurityException, ExchangeIsAlternateException,
+ RequiredExchangeException;
MessageDestination getMessageDestination(String name);
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java
index 6e36cdfa94..eac118ba8a 100755
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConfigRecoveryHandler.java
@@ -26,8 +26,7 @@ import java.util.TreeMap;
import java.util.UUID;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQStoreException;
+import org.apache.qpid.server.store.AMQStoreException;
import org.apache.qpid.server.exchange.ExchangeFactory;
import org.apache.qpid.server.exchange.ExchangeRegistry;
import org.apache.qpid.server.logging.actors.CurrentActor;
@@ -47,6 +46,7 @@ import org.apache.qpid.server.store.TransactionLogResource;
import org.apache.qpid.server.txn.DtxBranch;
import org.apache.qpid.server.txn.DtxRegistry;
import org.apache.qpid.server.txn.ServerTransaction;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.transport.Xid;
import org.apache.qpid.transport.util.Functions;
@@ -138,18 +138,8 @@ public class VirtualHostConfigRecoveryHandler implements
public void postCommit()
{
- try
- {
-
- queue.enqueue(message, null);
- ref.release();
- }
- catch (AMQException e)
- {
- _logger.error("Unable to enqueue message " + message.getMessageNumber() + " into " +
- "queue " + queue.getName() + " (from XA transaction)", e);
- throw new RuntimeException(e);
- }
+ queue.enqueue(message, null);
+ ref.release();
}
public void onRollback()
@@ -237,7 +227,7 @@ public class VirtualHostConfigRecoveryHandler implements
{
_logger.error("Unexpected database exception when attempting to prepare a recovered XA transaction " +
xidAsString(id), e);
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
}
@@ -269,74 +259,66 @@ public class VirtualHostConfigRecoveryHandler implements
public void queueEntry(final UUID queueId, long messageId)
{
AMQQueue queue = _virtualHost.getQueue(queueId);
- try
+ if(queue != null)
{
- if(queue != null)
- {
- String queueName = queue.getName();
- ServerMessage message = _recoveredMessages.get(messageId);
- _unusedMessages.remove(messageId);
-
- if(message != null)
- {
+ String queueName = queue.getName();
+ ServerMessage message = _recoveredMessages.get(messageId);
+ _unusedMessages.remove(messageId);
+ if(message != null)
+ {
- if (_logger.isDebugEnabled())
- {
- _logger.debug("On recovery, delivering " + message.getMessageNumber() + " to " + queueName);
- }
-
- Integer count = _queueRecoveries.get(queueName);
- if (count == null)
- {
- count = 0;
- }
-
- queue.enqueue(message,null);
- _queueRecoveries.put(queueName, ++count);
+ if (_logger.isDebugEnabled())
+ {
+ _logger.debug("On recovery, delivering " + message.getMessageNumber() + " to " + queueName);
}
- else
+
+ Integer count = _queueRecoveries.get(queueName);
+ if (count == null)
{
- _logger.warn("Message id " + messageId + " referenced in log as enqueued in queue " + queueName + " is unknown, entry will be discarded");
- Transaction txn = _store.newTransaction();
- txn.dequeueMessage(queue, new DummyMessage(messageId));
- txn.commitTranAsync();
+ count = 0;
}
+
+ queue.enqueue(message,null);
+
+ _queueRecoveries.put(queueName, ++count);
}
else
{
- _logger.warn("Message id " + messageId + " in log references queue with id " + queueId + " which is not in the configuration, entry will be discarded");
+ _logger.warn("Message id " + messageId + " referenced in log as enqueued in queue " + queueName + " is unknown, entry will be discarded");
Transaction txn = _store.newTransaction();
- TransactionLogResource mockQueue =
- new TransactionLogResource()
- {
- @Override
- public String getName()
- {
- return "<<UNKNOWN>>";
- }
-
- @Override
- public UUID getId()
- {
- return queueId;
- }
-
- @Override
- public boolean isDurable()
- {
- return false;
- }
- };
- txn.dequeueMessage(mockQueue, new DummyMessage(messageId));
+ txn.dequeueMessage(queue, new DummyMessage(messageId));
txn.commitTranAsync();
}
-
}
- catch(AMQException e)
+ else
{
- throw new RuntimeException(e);
+ _logger.warn("Message id " + messageId + " in log references queue with id " + queueId + " which is not in the configuration, entry will be discarded");
+ Transaction txn = _store.newTransaction();
+ TransactionLogResource mockQueue =
+ new TransactionLogResource()
+ {
+ @Override
+ public String getName()
+ {
+ return "<<UNKNOWN>>";
+ }
+
+ @Override
+ public UUID getId()
+ {
+ return queueId;
+ }
+
+ @Override
+ public boolean isDurable()
+ {
+ return false;
+ }
+ };
+ txn.dequeueMessage(mockQueue, new DummyMessage(messageId));
+ txn.commitTranAsync();
}
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/updater/TaskExecutorTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/updater/TaskExecutorTest.java
index 27d7dd1241..9dc4fb768e 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/updater/TaskExecutorTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/updater/TaskExecutorTest.java
@@ -42,6 +42,7 @@ import org.apache.qpid.server.logging.actors.CurrentActor;
import org.apache.qpid.server.logging.actors.TestLogActor;
import org.apache.qpid.server.model.State;
import org.apache.qpid.server.security.SecurityManager;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class TaskExecutorTest extends TestCase
{
@@ -90,7 +91,7 @@ public class TaskExecutorTest extends TestCase
{
try
{
- Future<?> f = _executor.submit(new NeverEndingCallable(waitForCallLatch));
+ Future<Void> f = _executor.submit(new NeverEndingCallable(waitForCallLatch));
submitLatch.countDown();
f.get();
}
@@ -100,7 +101,14 @@ public class TaskExecutorTest extends TestCase
{
e = (Exception) e.getCause();
}
- submitExceptions.add(e);
+ if(e instanceof RuntimeException && e.getCause() instanceof Exception)
+ {
+ submitExceptions.add((Exception)e.getCause());
+ }
+ else
+ {
+ submitExceptions.add(e);
+ }
}
}
};
@@ -133,10 +141,10 @@ public class TaskExecutorTest extends TestCase
public void testSubmitAndWait() throws Exception
{
_executor.start();
- Object result = _executor.submitAndWait(new Callable<String>()
+ Object result = _executor.submitAndWait(new TaskExecutor.Task<Object>()
{
@Override
- public String call() throws Exception
+ public String call()
{
return "DONE";
}
@@ -186,11 +194,11 @@ public class TaskExecutorTest extends TestCase
_executor.start();
try
{
- _executor.submitAndWait(new Callable<Void>()
+ _executor.submitAndWait(new TaskExecutor.Task<Object>()
{
@Override
- public Void call() throws Exception
+ public Void call()
{
throw exception;
}
@@ -203,29 +211,6 @@ public class TaskExecutorTest extends TestCase
}
}
- public void testSubmitAndWaitPassesOriginalCheckedException()
- {
- final Exception exception = new Exception();
- _executor.start();
- try
- {
- _executor.submitAndWait(new Callable<Void>()
- {
-
- @Override
- public Void call() throws Exception
- {
- throw exception;
- }
- });
- fail("Exception is expected");
- }
- catch (Exception e)
- {
- assertEquals("Unexpected exception", exception, e.getCause());
- }
- }
-
public void testSubmitAndWaitCurrentActorAndSecurityManagerSubjectAreRespected() throws Exception
{
_executor.start();
@@ -238,10 +223,10 @@ public class TaskExecutorTest extends TestCase
{
CurrentActor.set(actor);
SecurityManager.setThreadSubject(subject);
- _executor.submitAndWait(new Callable<Void>()
+ _executor.submitAndWait(new TaskExecutor.Task<Object>()
{
@Override
- public Void call() throws Exception
+ public Void call()
{
taskLogActor.set(CurrentActor.get());
taskSubject.set(SecurityManager.getThreadSubject());
@@ -258,16 +243,16 @@ public class TaskExecutorTest extends TestCase
assertEquals("Unexpected security manager subject", subject, taskSubject.get());
}
- private class SubjectRetriever implements Callable<Subject>
+ private class SubjectRetriever implements TaskExecutor.Task<Subject>
{
@Override
- public Subject call() throws Exception
+ public Subject call()
{
return Subject.getSubject(AccessController.getContext());
}
}
- private class NeverEndingCallable implements Callable<Void>
+ private class NeverEndingCallable implements TaskExecutor.Task<Void>
{
private CountDownLatch _waitLatch;
@@ -278,7 +263,7 @@ public class TaskExecutorTest extends TestCase
}
@Override
- public Void call() throws Exception
+ public Void call()
{
if (_waitLatch != null)
{
@@ -288,7 +273,14 @@ public class TaskExecutorTest extends TestCase
// wait forever
synchronized (this)
{
- this.wait();
+ try
+ {
+ this.wait();
+ }
+ catch (InterruptedException e)
+ {
+ throw new ServerScopedRuntimeException(e);
+ }
}
return null;
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/consumer/MockConsumer.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/consumer/MockConsumer.java
index 2401aaed23..5a12a411cf 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/consumer/MockConsumer.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/consumer/MockConsumer.java
@@ -21,7 +21,6 @@
package org.apache.qpid.server.consumer;
-import org.apache.qpid.AMQException;
import org.apache.qpid.protocol.AMQConstant;
import org.apache.qpid.server.filter.FilterManager;
import org.apache.qpid.server.filter.Filterable;
@@ -243,7 +242,7 @@ public class MockConsumer implements ConsumerTarget
}
@Override
- public void close() throws AMQException
+ public void close()
{
}
@@ -255,7 +254,7 @@ public class MockConsumer implements ConsumerTarget
@Override
public void checkTransactionStatus(long openWarn, long openClose,
- long idleWarn, long idleClose) throws AMQException
+ long idleWarn, long idleClose)
{
}
@@ -340,7 +339,7 @@ public class MockConsumer implements ConsumerTarget
}
@Override
- public void close(AMQConstant cause, String message) throws AMQException
+ public void close(AMQConstant cause, String message)
{
}
}
@@ -394,13 +393,12 @@ public class MockConsumer implements ConsumerTarget
@Override
public void close(AMQConstant cause, String message)
- throws AMQException
{
}
@Override
public void closeSession(AMQSessionModel session, AMQConstant cause,
- String message) throws AMQException
+ String message)
{
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/DefaultExchangeFactoryTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/DefaultExchangeFactoryTest.java
index f57ef037b3..c5ff2a8900 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/DefaultExchangeFactoryTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/DefaultExchangeFactoryTest.java
@@ -25,7 +25,6 @@ import java.util.Collection;
import java.util.List;
import java.util.UUID;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.plugin.ExchangeType;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.test.utils.QpidTestCase;
@@ -179,7 +178,7 @@ public class DefaultExchangeFactoryTest extends QpidTestCase
@Override
public Exchange newInstance(UUID id, VirtualHost host, String name, boolean durable,
- boolean autoDelete) throws AMQException
+ boolean autoDelete)
{
return null;
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/FanoutExchangeTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/FanoutExchangeTest.java
index 70ac5128c1..8cbc6b49ca 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/FanoutExchangeTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/FanoutExchangeTest.java
@@ -33,8 +33,6 @@ import java.util.Set;
import java.util.UUID;
import junit.framework.TestCase;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQInternalException;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.common.AMQPFilterTypes;
import org.apache.qpid.server.logging.LogActor;
@@ -54,7 +52,7 @@ public class FanoutExchangeTest extends TestCase
private FanoutExchange _exchange;
private VirtualHost _virtualHost;
- public void setUp() throws AMQException
+ public void setUp()
{
CurrentActor.setDefault(mock(LogActor.class));
@@ -85,28 +83,28 @@ public class FanoutExchangeTest extends TestCase
assertFalse("calling isBound(AMQQueue) with null queue should return false", _exchange.isBound((AMQQueue) null));
}
- public void testIsBoundStringMapAMQQueue() throws QpidSecurityException, AMQInternalException
+ public void testIsBoundStringMapAMQQueue() throws QpidSecurityException
{
AMQQueue queue = bindQueue();
assertTrue("Should return true for a bound queue",
_exchange.isBound("matters", null, queue));
}
- public void testIsBoundStringAMQQueue() throws QpidSecurityException, AMQInternalException
+ public void testIsBoundStringAMQQueue() throws QpidSecurityException
{
AMQQueue queue = bindQueue();
assertTrue("Should return true for a bound queue",
_exchange.isBound("matters", queue));
}
- public void testIsBoundAMQQueue() throws QpidSecurityException, AMQInternalException
+ public void testIsBoundAMQQueue() throws QpidSecurityException
{
AMQQueue queue = bindQueue();
assertTrue("Should return true for a bound queue",
_exchange.isBound(queue));
}
- private AMQQueue bindQueue() throws QpidSecurityException, AMQInternalException
+ private AMQQueue bindQueue() throws QpidSecurityException
{
AMQQueue queue = mockQueue();
_exchange.addBinding("matters", queue, null);
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java
index 54b0c3c529..fdaa147ae6 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/HeadersExchangeTest.java
@@ -29,7 +29,6 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
import junit.framework.TestCase;
-import org.apache.qpid.AMQInternalException;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.common.AMQPFilterTypes;
import org.apache.qpid.server.logging.LogActor;
@@ -119,7 +118,7 @@ public class HeadersExchangeTest extends TestCase
}
private void bind(String bindingKey, Map<String, Object> arguments, AMQQueue q)
- throws QpidSecurityException, AMQInternalException
+ throws QpidSecurityException
{
_exchange.addBinding(bindingKey,q,arguments);
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java
index 4a7bc33365..573f4a4aaa 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/exchange/TopicExchangeTest.java
@@ -23,9 +23,7 @@ package org.apache.qpid.server.exchange;
import java.util.List;
import junit.framework.Assert;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.binding.Binding;
-import org.apache.qpid.server.consumer.Consumer;
import org.apache.qpid.server.message.InstanceProperties;
import org.apache.qpid.server.message.MessageReference;
import org.apache.qpid.server.message.ServerMessage;
@@ -311,7 +309,7 @@ public class TopicExchangeTest extends QpidTestCase
}
- private int routeMessage(String routingKey, long messageNumber) throws AMQException
+ private int routeMessage(String routingKey, long messageNumber)
{
ServerMessage message = mock(ServerMessage.class);
when(message.getRoutingKey()).thenReturn(routingKey);
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/logging/actors/AMQPConnectionActorTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/logging/actors/AMQPConnectionActorTest.java
index 8b7f9ec5ca..bee2930fd7 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/logging/actors/AMQPConnectionActorTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/logging/actors/AMQPConnectionActorTest.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.logging.actors;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.logging.LogMessage;
import org.apache.qpid.server.logging.LogSubject;
@@ -79,7 +78,7 @@ public class AMQPConnectionActorTest extends BaseConnectionActorTestCase
logs.get(0).toString().contains("/ch:"));
}
- public void testConnectionLoggingOff() throws Exception, AMQException
+ public void testConnectionLoggingOff() throws Exception
{
setStatusUpdatesEnabled(false);
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/logging/actors/CurrentActorTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/logging/actors/CurrentActorTest.java
index 1fc42fe636..300fcd70d3 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/logging/actors/CurrentActorTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/logging/actors/CurrentActorTest.java
@@ -22,7 +22,6 @@ package org.apache.qpid.server.logging.actors;
import org.apache.commons.configuration.ConfigurationException;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.protocol.AMQSessionModel;
import org.apache.qpid.server.logging.LogActor;
import org.apache.qpid.server.logging.NullRootMessageLogger;
@@ -66,10 +65,9 @@ public class CurrentActorTest extends BaseConnectionActorTestCase
* And then finally validates that removing the Connection actor results
* in there being no actors set.
*
- * @throws AMQException
* @throws org.apache.commons.configuration.ConfigurationException
*/
- public void testLIFO() throws AMQException, ConfigurationException
+ public void testLIFO() throws ConfigurationException
{
assertTrue("Unexpected actor: " + CurrentActor.get(), CurrentActor.get() instanceof TestLogActor);
AMQPConnectionActor connectionActor = new AMQPConnectionActor(getConnection(),
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/AMQQueueFactoryTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/AMQQueueFactoryTest.java
index e59b9f614e..35ffd08863 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/AMQQueueFactoryTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/AMQQueueFactoryTest.java
@@ -36,8 +36,6 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
-
-import org.apache.qpid.AMQException;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.server.configuration.BrokerProperties;
import org.apache.qpid.server.configuration.QueueConfiguration;
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java
index d1bc5effc0..c462468819 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/MockAMQQueue.java
@@ -20,20 +20,17 @@
*/
package org.apache.qpid.server.queue;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.binding.Binding;
import org.apache.qpid.server.configuration.QueueConfiguration;
import org.apache.qpid.server.exchange.Exchange;
import org.apache.qpid.server.filter.FilterManager;
import org.apache.qpid.server.logging.LogSubject;
import org.apache.qpid.server.message.InstanceProperties;
-import org.apache.qpid.server.message.MessageInstance;
import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.protocol.AMQSessionModel;
import org.apache.qpid.server.security.AuthorizationHolder;
import org.apache.qpid.server.consumer.Consumer;
import org.apache.qpid.server.consumer.ConsumerTarget;
-import org.apache.qpid.server.store.StorableMessageMetaData;
import org.apache.qpid.server.txn.ServerTransaction;
import org.apache.qpid.server.util.Action;
import org.apache.qpid.server.virtualhost.VirtualHost;
@@ -213,7 +210,7 @@ public class MockAMQQueue implements AMQQueue
}
@Override
- public boolean resend(final QueueEntry entry, final Consumer consumer) throws AMQException
+ public boolean resend(final QueueEntry entry, final Consumer consumer)
{
return false;
}
@@ -225,7 +222,7 @@ public class MockAMQQueue implements AMQQueue
}
@Override
- public void enqueue(final ServerMessage message, final Action action) throws AMQException
+ public void enqueue(final ServerMessage message, final Action action)
{
}
@@ -241,7 +238,7 @@ public class MockAMQQueue implements AMQQueue
final FilterManager filters,
final Class messageClass,
final String consumerName,
- final EnumSet options) throws AMQException
+ final EnumSet options)
{
return new QueueConsumer(filters, messageClass, options.contains(Consumer.Option.ACQUIRES),
options.contains(Consumer.Option.SEES_REQUEUES), consumerName,
@@ -332,7 +329,7 @@ public class MockAMQQueue implements AMQQueue
return _deleted;
}
- public int delete() throws AMQException
+ public int delete()
{
_deleted = true;
return getMessageCount();
@@ -347,11 +344,6 @@ public class MockAMQQueue implements AMQQueue
{
}
- public boolean resend(QueueEntry entry, QueueConsumer consumer) throws AMQException
- {
- return false;
- }
-
@Override
public void removeQueueDeleteTask(final Action task)
{
@@ -451,7 +443,7 @@ public class MockAMQQueue implements AMQQueue
}
- public void checkMessageStatus() throws AMQException
+ public void checkMessageStatus()
{
}
@@ -461,7 +453,7 @@ public class MockAMQQueue implements AMQQueue
return null;
}
- public void flushConsumer(Consumer sub) throws AMQException
+ public void flushConsumer(Consumer sub)
{
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/MockMessageInstance.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/MockMessageInstance.java
index 8594ba19a3..4df8f91ede 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/MockMessageInstance.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/MockMessageInstance.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.queue;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.filter.Filterable;
import org.apache.qpid.server.message.AMQMessageHeader;
import org.apache.qpid.server.message.InstanceProperties;
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/PriorityQueueTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/PriorityQueueTest.java
index b71e4cd6d3..acddd49c04 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/PriorityQueueTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/PriorityQueueTest.java
@@ -23,9 +23,6 @@ package org.apache.qpid.server.queue;
import java.util.Collections;
import junit.framework.AssertionFailedError;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.logging.LogActor;
-import org.apache.qpid.server.logging.actors.CurrentActor;
import org.apache.qpid.server.message.AMQMessageHeader;
import org.apache.qpid.server.message.MessageInstance;
import org.apache.qpid.server.message.ServerMessage;
@@ -36,7 +33,6 @@ import java.util.EnumSet;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.consumer.Consumer;
-import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class PriorityQueueTest extends SimpleAMQQueueTestBase
@@ -102,7 +98,7 @@ public class PriorityQueueTest extends SimpleAMQQueueTestBase
}
- protected ServerMessage createMessage(Long id, byte i) throws AMQException
+ protected ServerMessage createMessage(Long id, byte i)
{
ServerMessage msg = super.createMessage(id);
@@ -111,7 +107,7 @@ public class PriorityQueueTest extends SimpleAMQQueueTestBase
return msg;
}
- protected ServerMessage createMessage(Long id) throws AMQException
+ protected ServerMessage createMessage(Long id)
{
return createMessage(id, (byte) 0);
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/QueueEntryImplTestBase.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/QueueEntryImplTestBase.java
index b67b2dda32..66e4286df7 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/QueueEntryImplTestBase.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/QueueEntryImplTestBase.java
@@ -20,7 +20,6 @@ package org.apache.qpid.server.queue;
import junit.framework.TestCase;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.consumer.ConsumerTarget;
import org.apache.qpid.server.logging.LogActor;
import org.apache.qpid.server.logging.RootMessageLogger;
@@ -48,7 +47,7 @@ public abstract class QueueEntryImplTestBase extends TestCase
protected QueueEntryImpl _queueEntry2;
protected QueueEntryImpl _queueEntry3;
- public abstract QueueEntryImpl getQueueEntryImpl(int msgId) throws AMQException;
+ public abstract QueueEntryImpl getQueueEntryImpl(int msgId);
public abstract void testCompareTo();
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/QueueEntryListTestBase.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/QueueEntryListTestBase.java
index 3af268c189..07d00daba5 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/QueueEntryListTestBase.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/QueueEntryListTestBase.java
@@ -21,7 +21,6 @@ package org.apache.qpid.server.queue;
import junit.framework.TestCase;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.message.AMQMessageHeader;
import org.apache.qpid.server.message.MessageReference;
import org.apache.qpid.server.message.ServerMessage;
@@ -39,7 +38,7 @@ public abstract class QueueEntryListTestBase<E extends QueueEntry<E,Q,C>, Q exte
public abstract L getTestList(boolean newList);
public abstract long getExpectedFirstMsgId();
public abstract int getExpectedListLength();
- public abstract ServerMessage getTestMessageToAdd() throws AMQException;
+ public abstract ServerMessage getTestMessageToAdd();
public void testGetQueue()
{
@@ -52,9 +51,8 @@ public abstract class QueueEntryListTestBase<E extends QueueEntry<E,Q,C>, Q exte
* Test to add a message with properties specific to the queue type.
* @see QueueEntryListTestBase#getTestList()
* @see QueueEntryListTestBase#getTestMessageToAdd()
- * @throws AMQException
*/
- public void testAddSpecificMessage() throws AMQException
+ public void testAddSpecificMessage()
{
final L list = getTestList();
list.add(getTestMessageToAdd());
@@ -73,9 +71,8 @@ public abstract class QueueEntryListTestBase<E extends QueueEntry<E,Q,C>, Q exte
* Test to add a generic mock message.
* @see QueueEntryListTestBase#getTestList()
* @see QueueEntryListTestBase#getExpectedListLength()
- * @throws AMQException
*/
- public void testAddGenericMessage() throws AMQException
+ public void testAddGenericMessage()
{
final L list = getTestList();
final ServerMessage message = createServerMessage(666l);
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SimpleAMQQueueTestBase.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SimpleAMQQueueTestBase.java
index 9330df5bea..1934349a62 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SimpleAMQQueueTestBase.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SimpleAMQQueueTestBase.java
@@ -34,8 +34,7 @@ import java.util.EnumSet;
import java.util.Map;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQInternalException;
+import org.apache.qpid.server.message.MessageSource;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.server.exchange.DirectExchange;
@@ -129,7 +128,7 @@ abstract class SimpleAMQQueueTestBase<E extends QueueEntryImpl<E,Q,L>, Q extends
assertEquals("Virtual host was wrong", _virtualHost, _queue.getVirtualHost());
}
- public void testBinding() throws QpidSecurityException, AMQInternalException
+ public void testBinding() throws QpidSecurityException
{
_exchange.addBinding(_routingKey, _queue, Collections.EMPTY_MAP);
@@ -456,7 +455,7 @@ abstract class SimpleAMQQueueTestBase<E extends QueueEntryImpl<E,Q,L>, Q extends
Consumer.Option.SEES_REQUEUES));
}
- catch (AMQException e)
+ catch (MessageSource.ExistingExclusiveConsumer e)
{
ex = e;
}
@@ -476,7 +475,7 @@ abstract class SimpleAMQQueueTestBase<E extends QueueEntryImpl<E,Q,L>, Q extends
EnumSet.of(Consumer.Option.EXCLUSIVE));
}
- catch (AMQException e)
+ catch (MessageSource.ExistingConsumerPreventsExclusive e)
{
ex = e;
}
@@ -929,23 +928,11 @@ abstract class SimpleAMQQueueTestBase<E extends QueueEntryImpl<E,Q,L>, Q extends
{
// Create message
ServerMessage message = null;
- try
- {
- message = createMessage((long)i);
- }
- catch (AMQException e)
- {
- fail("Failure to create a test message:" + e.getMessage());
- }
+ message = createMessage((long)i);
+
// Put message on queue
- try
- {
- queue.enqueue(message,null);
- }
- catch (AMQException e)
- {
- fail("Failure to put message on queue:" + e.getMessage());
- }
+ queue.enqueue(message,null);
+
}
try
{
@@ -1024,7 +1011,7 @@ abstract class SimpleAMQQueueTestBase<E extends QueueEntryImpl<E,Q,L>, Q extends
}
- protected ServerMessage createMessage(Long id) throws AMQException
+ protected ServerMessage createMessage(Long id)
{
AMQMessageHeader header = mock(AMQMessageHeader.class);
when(header.getMessageId()).thenReturn(String.valueOf(id));
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SimpleQueueEntryImplTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SimpleQueueEntryImplTest.java
index 36425761be..9457d59300 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SimpleQueueEntryImplTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SimpleQueueEntryImplTest.java
@@ -20,10 +20,6 @@
*/
package org.apache.qpid.server.queue;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.server.logging.LogActor;
-import org.apache.qpid.server.logging.RootMessageLogger;
-import org.apache.qpid.server.logging.actors.CurrentActor;
import org.apache.qpid.server.message.MessageReference;
import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.virtualhost.VirtualHost;
@@ -51,7 +47,7 @@ public class SimpleQueueEntryImplTest extends QueueEntryImplTestBase
}
- public QueueEntryImpl getQueueEntryImpl(int msgId) throws AMQException
+ public QueueEntryImpl getQueueEntryImpl(int msgId)
{
ServerMessage message = mock(ServerMessage.class);
when(message.getMessageNumber()).thenReturn((long)msgId);
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SortedQueueEntryListTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SortedQueueEntryListTest.java
index b6b3843ad2..f8953bb7cc 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SortedQueueEntryListTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SortedQueueEntryListTest.java
@@ -20,7 +20,6 @@
package org.apache.qpid.server.queue;
import java.util.Collections;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.logging.LogActor;
import org.apache.qpid.server.logging.RootMessageLogger;
import org.apache.qpid.server.logging.actors.CurrentActor;
@@ -140,7 +139,7 @@ public class SortedQueueEntryListTest extends QueueEntryListTestBase<SortedQueue
return 67L;
}
- public ServerMessage getTestMessageToAdd() throws AMQException
+ public ServerMessage getTestMessageToAdd()
{
return generateTestMessage(1, "test value");
}
@@ -151,7 +150,7 @@ public class SortedQueueEntryListTest extends QueueEntryListTestBase<SortedQueue
return _testQueue;
}
- private ServerMessage generateTestMessage(final long id, final String keyValue) throws AMQException
+ private ServerMessage generateTestMessage(final long id, final String keyValue)
{
final ServerMessage message = mock(ServerMessage.class);
AMQMessageHeader hdr = mock(AMQMessageHeader.class);
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SortedQueueEntryTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SortedQueueEntryTest.java
index a406c1c26f..25d6dbba60 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SortedQueueEntryTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/SortedQueueEntryTest.java
@@ -22,7 +22,6 @@ package org.apache.qpid.server.queue;
import java.util.Collections;
import java.util.UUID;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.message.AMQMessageHeader;
import org.apache.qpid.server.message.MessageReference;
import org.apache.qpid.server.message.ServerMessage;
@@ -56,7 +55,7 @@ public class SortedQueueEntryTest extends QueueEntryImplTestBase
super.setUp();
}
- public QueueEntryImpl getQueueEntryImpl(int msgId) throws AMQException
+ public QueueEntryImpl getQueueEntryImpl(int msgId)
{
final ServerMessage message = mock(ServerMessage.class);
AMQMessageHeader hdr = mock(AMQMessageHeader.class);
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/StandardQueueEntryListTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/StandardQueueEntryListTest.java
index c053957e2a..2c697cfe2b 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/StandardQueueEntryListTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/StandardQueueEntryListTest.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.queue;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.message.MessageReference;
import org.apache.qpid.server.message.ServerMessage;
import org.apache.qpid.server.virtualhost.VirtualHost;
@@ -112,7 +111,7 @@ public class StandardQueueEntryListTest extends QueueEntryListTestBase<StandardQ
}
@Override
- public ServerMessage getTestMessageToAdd() throws AMQException
+ public ServerMessage getTestMessageToAdd()
{
ServerMessage msg = mock(ServerMessage.class);
when(msg.getMessageNumber()).thenReturn(1l);
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/StandardQueueTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/StandardQueueTest.java
index 6a32eff9ed..c7b812effe 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/StandardQueueTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/queue/StandardQueueTest.java
@@ -20,8 +20,6 @@
*/
package org.apache.qpid.server.queue;
-
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.consumer.Consumer;
import org.apache.qpid.server.consumer.ConsumerTarget;
import org.apache.qpid.server.consumer.MockConsumer;
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/AbstractDurableConfigurationStoreTestCase.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/AbstractDurableConfigurationStoreTestCase.java
index d3ee938586..963309592c 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/AbstractDurableConfigurationStoreTestCase.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/AbstractDurableConfigurationStoreTestCase.java
@@ -36,7 +36,6 @@ import java.util.Map;
import java.util.UUID;
import org.apache.commons.configuration.Configuration;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.common.AMQPFilterTypes;
import org.apache.qpid.server.binding.Binding;
import org.apache.qpid.server.exchange.Exchange;
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/JsonFileConfigStoreTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/JsonFileConfigStoreTest.java
index b6300e6f48..0d3b2c637d 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/JsonFileConfigStoreTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/JsonFileConfigStoreTest.java
@@ -25,10 +25,11 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-import org.apache.qpid.AMQStoreException;
+
import org.apache.qpid.server.model.Binding;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.model.VirtualHost;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.test.utils.QpidTestCase;
import org.mockito.InOrder;
@@ -82,7 +83,7 @@ public class JsonFileConfigStoreTest extends QpidTestCase
_store.configureConfigStore(_virtualHost, _recoveryHandler);
fail("Store should not successfully configure if there is no path set");
}
- catch (AMQStoreException e)
+ catch (ServerScopedRuntimeException e)
{
// pass
}
@@ -97,7 +98,7 @@ public class JsonFileConfigStoreTest extends QpidTestCase
_store.configureConfigStore(_virtualHost, _recoveryHandler);
fail("Store should not successfully configure if there is an invalid path set");
}
- catch (AMQStoreException e)
+ catch (ServerScopedRuntimeException e)
{
// pass
}
@@ -250,7 +251,7 @@ public class JsonFileConfigStoreTest extends QpidTestCase
secondStore.configureConfigStore(_virtualHost, _recoveryHandler);
fail("Should not be able to open a second store with the same path");
}
- catch(AMQStoreException e)
+ catch(ServerScopedRuntimeException e)
{
// pass
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java
index 9dde7d26d0..6b9bb08aa9 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.server.store;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.message.EnqueueableMessage;
import org.apache.qpid.server.queue.AMQQueue;
@@ -56,29 +55,29 @@ public class TestableMemoryMessageStore extends TestMemoryMessageStore
private class TestableTransaction implements Transaction
{
@Override
- public void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException
+ public void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message)
{
getMessages().put(message.getMessageNumber(), (AMQQueue)queue);
}
@Override
- public void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException
+ public void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message)
{
getMessages().remove(message.getMessageNumber());
}
@Override
- public void commitTran() throws AMQStoreException
+ public void commitTran()
{
}
@Override
- public StoreFuture commitTranAsync() throws AMQStoreException
+ public StoreFuture commitTranAsync()
{
return StoreFuture.IMMEDIATE_FUTURE;
}
- public void abortTran() throws AMQStoreException
+ public void abortTran()
{
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/txn/MockStoreTransaction.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/txn/MockStoreTransaction.java
index 17955a8d52..ab18c8f41d 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/txn/MockStoreTransaction.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/txn/MockStoreTransaction.java
@@ -21,13 +21,13 @@
package org.apache.qpid.server.txn;
import org.apache.commons.lang.NotImplementedException;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.message.EnqueueableMessage;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.NullMessageStore;
import org.apache.qpid.server.store.StoreFuture;
import org.apache.qpid.server.store.Transaction;
import org.apache.qpid.server.store.TransactionLogResource;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
/**
* Mock implementation of a (Store) Transaction allow its state to be observed.
@@ -60,12 +60,12 @@ class MockStoreTransaction implements Transaction
return _state;
}
- public void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException
+ public void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message)
{
if (_throwExceptionOnQueueOp)
{
- throw new AMQStoreException("Mocked exception");
+ throw new ServerScopedRuntimeException("Mocked exception");
}
_numberOfEnqueuedMessages++;
@@ -81,27 +81,27 @@ class MockStoreTransaction implements Transaction
return _numberOfEnqueuedMessages;
}
- public void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException
+ public void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message)
{
if (_throwExceptionOnQueueOp)
{
- throw new AMQStoreException("Mocked exception");
+ throw new ServerScopedRuntimeException("Mocked exception");
}
_numberOfDequeuedMessages++;
}
- public void commitTran() throws AMQStoreException
+ public void commitTran()
{
_state = TransactionState.COMMITTED;
}
- public StoreFuture commitTranAsync() throws AMQStoreException
+ public StoreFuture commitTranAsync()
{
throw new NotImplementedException();
}
- public void abortTran() throws AMQStoreException
+ public void abortTran()
{
_state = TransactionState.ABORTED;
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java
index a00baebd5e..fb63fefb88 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java
@@ -30,7 +30,6 @@ import java.util.UUID;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.protocol.AMQConnectionModel;
import org.apache.qpid.server.protocol.AMQSessionModel;
import org.apache.qpid.server.configuration.VirtualHostConfiguration;
@@ -45,7 +44,6 @@ import org.apache.qpid.server.logging.actors.TestLogActor;
import org.apache.qpid.server.model.Broker;
import org.apache.qpid.server.model.UUIDGenerator;
import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.queue.AMQQueueFactory;
import org.apache.qpid.server.security.QpidSecurityException;
import org.apache.qpid.server.security.SecurityManager;
import org.apache.qpid.server.security.SubjectCreator;
@@ -55,6 +53,7 @@ import org.apache.qpid.server.virtualhost.StandardVirtualHostFactory;
import org.apache.qpid.server.virtualhost.VirtualHost;
import org.apache.qpid.server.plugin.VirtualHostFactory;
import org.apache.qpid.server.virtualhost.VirtualHostRegistry;
+import org.apache.qpid.server.virtualhost.QueueExistsException;
public class BrokerTestHelper
{
@@ -139,7 +138,7 @@ public class BrokerTestHelper
return vhostConfig;
}
- public static AMQSessionModel createSession(int channelId, AMQConnectionModel connection) throws AMQException
+ public static AMQSessionModel createSession(int channelId, AMQConnectionModel connection)
{
AMQSessionModel session = mock(AMQSessionModel.class);
when(session.getConnectionModel()).thenReturn(connection);
@@ -181,7 +180,7 @@ public class BrokerTestHelper
}
public static AMQQueue createQueue(String queueName, VirtualHost virtualHost)
- throws AMQException, QpidSecurityException
+ throws QpidSecurityException, QueueExistsException
{
AMQQueue queue = virtualHost.createQueue(UUIDGenerator.generateRandomUUID(), queueName, false, null,
false, false, false, Collections.<String, Object>emptyMap());
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/DurableConfigurationRecovererTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/DurableConfigurationRecovererTest.java
index b71c6a92e6..ffd153b790 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/DurableConfigurationRecovererTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/DurableConfigurationRecovererTest.java
@@ -27,7 +27,7 @@ import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.UUID;
-import org.apache.qpid.AMQStoreException;
+import org.apache.qpid.server.store.AMQStoreException;
import org.apache.qpid.server.configuration.IllegalConfigurationException;
import org.apache.qpid.server.exchange.DirectExchange;
import org.apache.qpid.server.exchange.Exchange;
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java
index 832b89c81a..f7eecc73fc 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java
@@ -23,7 +23,6 @@ package org.apache.qpid.server.virtualhost;
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.ScheduledFuture;
-import org.apache.qpid.AMQException;
import org.apache.qpid.server.configuration.VirtualHostConfiguration;
import org.apache.qpid.server.connection.IConnectionRegistry;
import org.apache.qpid.server.exchange.Exchange;
@@ -147,7 +146,7 @@ public class MockVirtualHost implements VirtualHost
}
@Override
- public int removeQueue(AMQQueue queue) throws AMQException
+ public int removeQueue(AMQQueue queue)
{
return 0;
}
@@ -160,7 +159,7 @@ public class MockVirtualHost implements VirtualHost
boolean autoDelete,
boolean exclusive,
boolean deleteOnNoConsumer,
- Map<String, Object> arguments) throws AMQException
+ Map<String, Object> arguments)
{
return null;
}
@@ -171,13 +170,13 @@ public class MockVirtualHost implements VirtualHost
String type,
boolean durable,
boolean autoDelete,
- String alternateExchange) throws AMQException
+ String alternateExchange)
{
return null;
}
@Override
- public void removeExchange(Exchange exchange, boolean force) throws AMQException
+ public void removeExchange(Exchange exchange, boolean force)
{
}
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/StandardVirtualHostTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/StandardVirtualHostTest.java
index f46349daa4..9dfd8833aa 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/StandardVirtualHostTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/StandardVirtualHostTest.java
@@ -38,6 +38,7 @@ import org.apache.qpid.server.security.SecurityManager;
import org.apache.qpid.server.stats.StatisticsGatherer;
import org.apache.qpid.server.store.TestMemoryMessageStore;
import org.apache.qpid.server.util.BrokerTestHelper;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.test.utils.QpidTestCase;
import java.io.BufferedWriter;
@@ -111,9 +112,11 @@ public class StandardVirtualHostTest extends QpidTestCase
createVirtualHost(queueName, config);
fail("virtualhost creation should have failed due to illegal configuration");
}
- catch (ConfigurationException e)
+ catch (ServerScopedRuntimeException e)
{
- assertEquals("Illegal attempt to bind queue '" + queueName + "' to the default exchange with a key other than the queue name: " + customBinding, e.getMessage());
+ Throwable cause = e.getCause();
+ assertNotNull(cause);
+ assertEquals("Illegal attempt to bind queue '" + queueName + "' to the default exchange with a key other than the queue name: " + customBinding, cause.getMessage());
}
}
@@ -169,9 +172,11 @@ public class StandardVirtualHostTest extends QpidTestCase
createVirtualHost(queueName, config);
fail("virtualhost creation should have failed due to illegal configuration");
}
- catch (ConfigurationException e)
+ catch (ServerScopedRuntimeException e)
{
- assertEquals("Attempt to bind queue '" + queueName + "' to unknown exchange:" + exchangeName, e.getMessage());
+ Throwable cause = e.getCause();
+ assertNotNull(cause);
+ assertEquals("Attempt to bind queue '" + queueName + "' to unknown exchange:" + exchangeName, cause.getMessage());
}
}