You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2014/02/14 11:52:51 UTC

svn commit: r1568235 [5/6] - in /qpid/trunk/qpid/java: amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/transport/ bdbstore/jmx/src/main/java/org/apache/qpid/server/store/berkeleydb/jmx/ bdbstore/jmx/src/test/java/org/apache/qpid/server/store/ber...

Modified: qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/store/TestableMemoryMessageStore.java Fri Feb 14 10:52:47 2014
@@ -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 
     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()
         {
         }
 

Modified: qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/txn/MockStoreTransaction.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/txn/MockStoreTransaction.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/txn/MockStoreTransaction.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/txn/MockStoreTransaction.java Fri Feb 14 10:52:47 2014
@@ -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 Tr
         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 Tr
         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;
     }

Modified: qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/util/BrokerTestHelper.java Fri Feb 14 10:52:47 2014
@@ -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.ac
 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.virtualhos
 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());

Modified: qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/DurableConfigurationRecovererTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/DurableConfigurationRecovererTest.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/DurableConfigurationRecovererTest.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/DurableConfigurationRecovererTest.java Fri Feb 14 10:52:47 2014
@@ -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;

Modified: qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/MockVirtualHost.java Fri Feb 14 10:52:47 2014
@@ -23,7 +23,6 @@ package org.apache.qpid.server.virtualho
 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 
     }
 
     @Override
-    public int removeQueue(AMQQueue queue) throws AMQException
+    public int removeQueue(AMQQueue queue)
     {
         return 0;
     }
@@ -160,7 +159,7 @@ public class MockVirtualHost implements 
                                 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 
                                    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)
     {
     }
 

Modified: qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/StandardVirtualHostTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/StandardVirtualHostTest.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/StandardVirtualHostTest.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/virtualhost/StandardVirtualHostTest.java Fri Feb 14 10:52:47 2014
@@ -38,6 +38,7 @@ import org.apache.qpid.server.security.S
 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 ext
             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 ext
             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());
         }
     }
 

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ConsumerTarget_0_10.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ConsumerTarget_0_10.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ConsumerTarget_0_10.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ConsumerTarget_0_10.java Fri Feb 14 10:52:47 2014
@@ -20,7 +20,6 @@
  */
 package org.apache.qpid.server.protocol.v0_10;
 
-import org.apache.qpid.AMQException;
 import org.apache.qpid.server.exchange.Exchange;
 import org.apache.qpid.server.flow.FlowCreditManager;
 import org.apache.qpid.server.logging.LogActor;
@@ -31,13 +30,13 @@ import org.apache.qpid.server.message.Se
 import org.apache.qpid.server.plugin.MessageConverter;
 import org.apache.qpid.server.protocol.MessageConverterRegistry;
 import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.queue.QueueEntry;
 import org.apache.qpid.server.store.TransactionLogResource;
 import org.apache.qpid.server.consumer.AbstractConsumerTarget;
 import org.apache.qpid.server.consumer.Consumer;
 import org.apache.qpid.server.txn.AutoCommitTransaction;
 import org.apache.qpid.server.txn.ServerTransaction;
 import org.apache.qpid.server.util.Action;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
 import org.apache.qpid.transport.*;
 
 import java.util.Collections;
@@ -507,7 +506,8 @@ public class ConsumerTarget_0_10 extends
                 _creditManager = new WindowCreditManager(0l,0l);
                 break;
             default:
-                throw new RuntimeException("Unknown message flow mode: " + flowMode);
+                // this should never happen, as 0-10 is finalised and so the enum should never change
+                throw new ConnectionScopedRuntimeException("Unknown message flow mode: " + flowMode);
         }
         _flowMode = flowMode;
         updateState(State.ACTIVE, State.SUSPENDED);
@@ -532,7 +532,7 @@ public class ConsumerTarget_0_10 extends
         }
     }
 
-    public void flush() throws AMQException
+    public void flush()
     {
         flushCreditState(true);
         getConsumer().flush();

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/MessageConverter_v0_10.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/MessageConverter_v0_10.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/MessageConverter_v0_10.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/MessageConverter_v0_10.java Fri Feb 14 10:52:47 2014
@@ -32,6 +32,8 @@ import org.apache.qpid.server.message.Se
 import org.apache.qpid.server.plugin.MessageConverter;
 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.server.util.ServerScopedRuntimeException;
 import org.apache.qpid.server.virtualhost.VirtualHost;
 import org.apache.qpid.transport.DeliveryProperties;
 import org.apache.qpid.transport.Header;
@@ -183,7 +185,7 @@ public class MessageConverter_v0_10 impl
             }
             catch (IOException e)
             {
-                throw new RuntimeException(e);
+                throw new ConnectionScopedRuntimeException(e);
             }
         }
     }

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/MessageConverter_v0_10_to_Internal.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/MessageConverter_v0_10_to_Internal.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/MessageConverter_v0_10_to_Internal.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/MessageConverter_v0_10_to_Internal.java Fri Feb 14 10:52:47 2014
@@ -27,6 +27,7 @@ import org.apache.qpid.server.message.in
 import org.apache.qpid.server.plugin.MessageConverter;
 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.server.virtualhost.VirtualHost;
 import org.apache.qpid.transport.DeliveryProperties;
 import org.apache.qpid.transport.Header;
@@ -247,11 +248,11 @@ public class MessageConverter_v0_10_to_I
                 }
                 catch (TypedBytesFormatException e)
                 {
-                    throw new RuntimeException(e);  // TODO - Implement
+                    throw new ConnectionScopedRuntimeException(e);
                 }
                 catch (EOFException e)
                 {
-                    throw new RuntimeException(e);  // TODO - Implement
+                    throw new ConnectionScopedRuntimeException(e);  // TODO - Implement
                 }
             }
             return list;

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerConnection.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerConnection.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerConnection.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerConnection.java Fri Feb 14 10:52:47 2014
@@ -28,13 +28,11 @@ import java.util.List;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicLong;
 import javax.security.auth.Subject;
-import org.apache.qpid.AMQException;
 import org.apache.qpid.protocol.AMQConstant;
 import org.apache.qpid.server.logging.LogActor;
 import org.apache.qpid.server.logging.LogSubject;
 import org.apache.qpid.server.logging.actors.AMQPConnectionActor;
 import org.apache.qpid.server.logging.actors.CurrentActor;
-import org.apache.qpid.server.logging.actors.GenericActor;
 import org.apache.qpid.server.logging.messages.ConnectionMessages;
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.model.Port;
@@ -44,6 +42,7 @@ import org.apache.qpid.server.protocol.A
 import org.apache.qpid.server.security.AuthorizationHolder;
 import org.apache.qpid.server.security.auth.AuthenticatedPrincipal;
 import org.apache.qpid.server.stats.StatisticsCounter;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
 import org.apache.qpid.server.virtualhost.VirtualHost;
 import org.apache.qpid.transport.Connection;
 import org.apache.qpid.transport.ConnectionCloseCode;
@@ -52,7 +51,6 @@ import org.apache.qpid.transport.Executi
 import org.apache.qpid.transport.Method;
 import org.apache.qpid.transport.ProtocolEvent;
 import org.apache.qpid.transport.Session;
-import org.apache.qpid.transport.network.NetworkConnection;
 
 import static org.apache.qpid.server.logging.subjects.LogSubjectFormat.CONNECTION_FORMAT;
 import static org.apache.qpid.server.logging.subjects.LogSubjectFormat.SOCKET_FORMAT;
@@ -199,7 +197,7 @@ public class ServerConnection extends Co
         _onOpenTask = task;
     }
 
-    public void closeSession(AMQSessionModel session, AMQConstant cause, String message) throws AMQException
+    public void closeSession(AMQSessionModel session, AMQConstant cause, String message)
     {
         ExecutionException ex = new ExecutionException();
         ExecutionErrorCode code = ExecutionErrorCode.INTERNAL_ERROR;
@@ -224,6 +222,26 @@ public class ServerConnection extends Co
     }
 
     @Override
+    public void exception(final Throwable t)
+    {
+        try
+        {
+            super.exception(t);
+        }
+        finally
+        {
+            if(t instanceof Error)
+            {
+                throw (Error) t;
+            }
+            if(t instanceof ServerScopedRuntimeException)
+            {
+                throw (ServerScopedRuntimeException) t;
+            }
+        }
+    }
+
+    @Override
     public void received(ProtocolEvent event)
     {
         _lastIoTime.set(System.currentTimeMillis());
@@ -294,7 +312,7 @@ public class ServerConnection extends Co
         return _actor;
     }
 
-    public void close(AMQConstant cause, String message) throws AMQException
+    public void close(AMQConstant cause, String message)
     {
         closeSubscriptions();
         ConnectionCloseCode replyCode = ConnectionCloseCode.NORMAL;

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSession.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSession.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSession.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSession.java Fri Feb 14 10:52:47 2014
@@ -41,8 +41,7 @@ import java.util.concurrent.atomic.Atomi
 import java.util.concurrent.atomic.AtomicReference;
 
 import javax.security.auth.Subject;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQStoreException;
+import org.apache.qpid.server.store.AMQStoreException;
 import org.apache.qpid.protocol.AMQConstant;
 import org.apache.qpid.server.TransactionTimeoutHelper;
 import org.apache.qpid.server.TransactionTimeoutHelper.CloseAction;
@@ -148,7 +147,7 @@ public class ServerSession extends Sessi
         _transactionTimeoutHelper = new TransactionTimeoutHelper(_logSubject, new CloseAction()
         {
             @Override
-            public void doTimeoutAction(String reason) throws AMQException
+            public void doTimeoutAction(String reason)
             {
                 getConnectionModel().closeSession(ServerSession.this, AMQConstant.RESOURCE_ERROR, reason);
             }
@@ -679,7 +678,7 @@ public class ServerSession extends Sessi
         return (LogSubject) this;
     }
 
-    public void checkTransactionStatus(long openWarn, long openClose, long idleWarn, long idleClose) throws AMQException
+    public void checkTransactionStatus(long openWarn, long openClose, long idleWarn, long idleClose)
     {
         _transactionTimeoutHelper.checkIdleOrOpenTimes(_transaction, openWarn, openClose, idleWarn, idleClose);
     }

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSessionDelegate.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSessionDelegate.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSessionDelegate.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSessionDelegate.java Fri Feb 14 10:52:47 2014
@@ -25,11 +25,11 @@ import java.util.LinkedHashMap;
 import java.util.UUID;
 import org.apache.log4j.Logger;
 
-import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQStoreException;
-import org.apache.qpid.AMQUnknownExchangeType;
+import org.apache.qpid.server.store.AMQStoreException;
+import org.apache.qpid.server.exchange.AMQUnknownExchangeType;
 import org.apache.qpid.server.exchange.Exchange;
 import org.apache.qpid.server.exchange.HeadersExchange;
+import org.apache.qpid.server.filter.AMQInvalidArgumentException;
 import org.apache.qpid.server.filter.FilterManager;
 import org.apache.qpid.server.filter.FilterManagerFactory;
 import org.apache.qpid.server.logging.messages.ExchangeMessages;
@@ -66,7 +66,7 @@ import org.apache.qpid.server.virtualhos
 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.plugins.QueueExistsException;
+import org.apache.qpid.server.virtualhost.QueueExistsException;
 import org.apache.qpid.transport.*;
 
 import java.nio.ByteBuffer;
@@ -253,7 +253,7 @@ public class ServerSessionDelegate exten
                     {
                         filterManager = FilterManagerFactory.createManager(method.getArguments());
                     }
-                    catch (AMQException amqe)
+                    catch (AMQInvalidArgumentException amqe)
                     {
                         exception(session, method, ExecutionErrorCode.ILLEGAL_ARGUMENT, "Exception Creating FilterManager");
                         return;
@@ -298,10 +298,6 @@ public class ServerSessionDelegate exten
                     {
                         exception(session, method, ExecutionErrorCode.RESOURCE_LOCKED, "Queue has an existing consumer - can't subscribe exclusively");
                     }
-                    catch (AMQException e)
-                    {
-                        exception(session, method, e, "Cannot subscribe to queue '" + queueName + "' with destination '" + destination);
-                    }
                     catch (QpidSecurityException e)
                     {
                         exception(session, method, ExecutionErrorCode.UNAUTHORIZED_ACCESS, e.getMessage());
@@ -435,15 +431,7 @@ public class ServerSessionDelegate exten
         }
         else
         {
-
-            try
-            {
-                sub.flush();
-            }
-            catch (AMQException e)
-            {
-                exception(session, method, e, "Cannot flush subscription '" + destination);
-            }
+            sub.flush();
         }
     }
 
@@ -787,10 +775,6 @@ public class ServerSessionDelegate exten
                                     + " to " + method.getAlternateExchange() +".");
                 }
             }
-            catch (AMQException e)
-            {
-                exception(session, method, e, "Cannot declare exchange '" + exchangeName);
-            }
             catch (QpidSecurityException e)
             {
                 exception(session, method, ExecutionErrorCode.UNAUTHORIZED_ACCESS, e.getMessage());
@@ -801,26 +785,6 @@ public class ServerSessionDelegate exten
 
     }
 
-    // TODO decouple AMQException and AMQConstant error codes
-    private void exception(Session session, Method method, AMQException exception, String message)
-    {
-        ExecutionErrorCode errorCode = ExecutionErrorCode.INTERNAL_ERROR;
-        if (exception.getErrorCode() != null)
-        {
-            try
-            {
-                errorCode = ExecutionErrorCode.get(exception.getErrorCode().getCode());
-            }
-            catch (IllegalArgumentException iae)
-            {
-                // ignore, already set to INTERNAL_ERROR
-            }
-        }
-        String description = message + "': " + exception.getMessage();
-
-        exception(session, method, errorCode, description);
-    }
-
     private void exception(Session session, Method method, ExecutionErrorCode errorCode, String description)
     {
         ExecutionException ex = new ExecutionException();
@@ -903,10 +867,6 @@ public class ServerSessionDelegate exten
         {
             exception(session, method, ExecutionErrorCode.NOT_ALLOWED, "Exchange '"+method.getExchange()+"' cannot be deleted");
         }
-        catch (AMQException e)
-        {
-            exception(session, method, e, "Cannot delete exchange '" + method.getExchange() );
-        }
         catch (QpidSecurityException e)
         {
             exception(session, method, ExecutionErrorCode.UNAUTHORIZED_ACCESS, e.getMessage());
@@ -1001,10 +961,6 @@ public class ServerSessionDelegate exten
                     {
                         exchange.addBinding(method.getBindingKey(), queue, method.getArguments());
                     }
-                    catch (AMQException e)
-                    {
-                        exception(session, method, e, "Cannot add binding '" + method.getBindingKey());
-                    }
                     catch (QpidSecurityException e)
                     {
                         exception(session, method, ExecutionErrorCode.UNAUTHORIZED_ACCESS, e.getMessage());
@@ -1058,10 +1014,6 @@ public class ServerSessionDelegate exten
                 {
                     exchange.removeBinding(method.getBindingKey(), queue, null);
                 }
-                catch (AMQException e)
-                {
-                    exception(session, method, e, "Cannot remove binding '" + method.getBindingKey());
-                }
                 catch (QpidSecurityException e)
                 {
                     exception(session, method, ExecutionErrorCode.UNAUTHORIZED_ACCESS, e.getMessage());
@@ -1289,10 +1241,6 @@ public class ServerSessionDelegate exten
                                 {
                                     virtualHost.removeQueue(q);
                                 }
-                                catch (AMQException e)
-                                {
-                                    exception(session, method, e, "Cannot delete '" + method.getQueue());
-                                }
                                 catch (QpidSecurityException e)
                                 {
                                     exception(session, method, ExecutionErrorCode.UNAUTHORIZED_ACCESS, e.getMessage());
@@ -1345,10 +1293,6 @@ public class ServerSessionDelegate exten
                     exception(session, method, errorCode, description);
                 }
             }
-            catch (AMQException e)
-            {
-                exception(session, method, e, "Cannot declare queue '" + queueName);
-            }
             catch (QpidSecurityException e)
             {
                 exception(session, method, ExecutionErrorCode.UNAUTHORIZED_ACCESS, e.getMessage());
@@ -1426,10 +1370,6 @@ public class ServerSessionDelegate exten
                     {
                         virtualHost.removeQueue(queue);
                     }
-                    catch (AMQException e)
-                    {
-                        exception(session, method, e, "Cannot delete queue '" + queueName);
-                    }
                     catch (QpidSecurityException e)
                     {
                         exception(session, method, ExecutionErrorCode.UNAUTHORIZED_ACCESS, e.getMessage());
@@ -1461,10 +1401,6 @@ public class ServerSessionDelegate exten
                 {
                     queue.clearQueue();
                 }
-                catch (AMQException e)
-                {
-                    exception(session, method, e, "Cannot purge queue '" + queueName);
-                }
                 catch (QpidSecurityException e)
                 {
                     exception(session, method, ExecutionErrorCode.UNAUTHORIZED_ACCESS, e.getMessage());

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java Fri Feb 14 10:52:47 2014
@@ -29,6 +29,7 @@ import java.util.concurrent.locks.Lock;
 import org.apache.log4j.Logger;
 import org.apache.qpid.AMQConnectionException;
 import org.apache.qpid.AMQException;
+import org.apache.qpid.server.filter.AMQInvalidArgumentException;
 import org.apache.qpid.server.security.QpidSecurityException;
 import org.apache.qpid.common.AMQPFilterTypes;
 import org.apache.qpid.framing.AMQMethodBody;
@@ -81,6 +82,7 @@ import org.apache.qpid.server.txn.LocalT
 import org.apache.qpid.server.txn.LocalTransaction.ActivityTimeAccessor;
 import org.apache.qpid.server.txn.ServerTransaction;
 import org.apache.qpid.server.util.Action;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
 import org.apache.qpid.server.virtualhost.VirtualHost;
 import org.apache.qpid.transport.TransportException;
 
@@ -186,9 +188,16 @@ public class AMQChannel implements AMQSe
         _transactionTimeoutHelper = new TransactionTimeoutHelper(_logSubject, new CloseAction()
         {
             @Override
-            public void doTimeoutAction(String reason) throws AMQException
+            public void doTimeoutAction(String reason)
             {
-                closeConnection(reason);
+                try
+                {
+                    closeConnection(reason);
+                }
+                catch (AMQException e)
+                {
+                    throw new ConnectionScopedRuntimeException(e);
+                }
             }
         });
     }
@@ -516,7 +525,8 @@ public class AMQChannel implements AMQSe
      */
     public AMQShortString consumeFromSource(AMQShortString tag, MessageSource source, boolean acks,
                                             FieldTable filters, boolean exclusive, boolean noLocal)
-            throws AMQException, QpidSecurityException
+            throws AMQException, QpidSecurityException, MessageSource.ExistingConsumerPreventsExclusive,
+                   MessageSource.ExistingExclusiveConsumer, AMQInvalidArgumentException
     {
         if (tag == null)
         {
@@ -579,17 +589,22 @@ public class AMQChannel implements AMQSe
                                       AMQShortString.toString(tag),
                                       options);
         }
-        catch (AMQException e)
+        catch (QpidSecurityException e)
         {
             _tag2SubscriptionTargetMap.remove(tag);
             throw e;
         }
-        catch (RuntimeException e)
+        catch (MessageSource.ExistingExclusiveConsumer e)
         {
             _tag2SubscriptionTargetMap.remove(tag);
             throw e;
         }
-        catch (QpidSecurityException e)
+        catch (MessageSource.ExistingConsumerPreventsExclusive e)
+        {
+            _tag2SubscriptionTargetMap.remove(tag);
+            throw e;
+        }
+        catch (AMQInvalidArgumentException e)
         {
             _tag2SubscriptionTargetMap.remove(tag);
             throw e;
@@ -601,9 +616,8 @@ public class AMQChannel implements AMQSe
      * Unsubscribe a consumer from a queue.
      * @param consumerTag
      * @return true if the consumerTag had a mapped queue that could be unregistered.
-     * @throws AMQException
      */
-    public boolean unsubscribeConsumer(AMQShortString consumerTag) throws AMQException
+    public boolean unsubscribeConsumer(AMQShortString consumerTag)
     {
 
         ConsumerTarget_0_8 target = _tag2SubscriptionTargetMap.remove(consumerTag);
@@ -622,16 +636,14 @@ public class AMQChannel implements AMQSe
 
     /**
      * Called from the protocol session to close this channel and clean up. T
-     *
-     * @throws AMQException if there is an error during closure
      */
     @Override
-    public void close() throws AMQException
+    public void close()
     {
         close(null, null);
     }
 
-    public void close(AMQConstant cause, String message) throws AMQException
+    public void close(AMQConstant cause, String message)
     {
         if(!_closing.compareAndSet(false, true))
         {
@@ -651,17 +663,13 @@ public class AMQChannel implements AMQSe
         {
             requeue();
         }
-        catch (AMQException e)
-        {
-            _logger.error("Caught AMQException whilst attempting to requeue:" + e);
-        }
         catch (TransportException e)
         {
             _logger.error("Caught TransportException whilst attempting to requeue:" + e);
         }
     }
 
-    private void unsubscribeAllConsumers() throws AMQException
+    private void unsubscribeAllConsumers()
     {
         if (_logger.isInfoEnabled())
         {
@@ -724,9 +732,8 @@ public class AMQChannel implements AMQSe
      * Called to attempt re-delivery all outstanding unacknowledged messages on the channel. May result in delivery to
      * this same channel or to other subscribers.
      *
-     * @throws org.apache.qpid.AMQException if the requeue fails
      */
-    public void requeue() throws AMQException
+    public void requeue()
     {
         // we must create a new map since all the messages will get a new delivery tag when they are redelivered
         Collection<MessageInstance> messagesToBeDelivered = _unacknowledgedMessageMap.cancelAllMessages();
@@ -756,9 +763,8 @@ public class AMQChannel implements AMQSe
      *
      * @param deliveryTag The message to requeue
      *
-     * @throws AMQException If something goes wrong.
      */
-    public void requeue(long deliveryTag) throws AMQException
+    public void requeue(long deliveryTag)
     {
         MessageInstance unacked = _unacknowledgedMessageMap.remove(deliveryTag);
 
@@ -1455,7 +1461,7 @@ public class AMQChannel implements AMQSe
         return getProtocolSession().getVirtualHost();
     }
 
-    public void checkTransactionStatus(long openWarn, long openClose, long idleWarn, long idleClose) throws AMQException
+    public void checkTransactionStatus(long openWarn, long openClose, long idleWarn, long idleClose)
     {
         _transactionTimeoutHelper.checkIdleOrOpenTimes(_transaction, openWarn, openClose, idleWarn, idleClose);
     }

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java Fri Feb 14 10:52:47 2014
@@ -46,28 +46,11 @@ import org.apache.log4j.Logger;
 import org.apache.qpid.AMQChannelException;
 import org.apache.qpid.AMQConnectionException;
 import org.apache.qpid.AMQException;
+import org.apache.qpid.framing.*;
 import org.apache.qpid.server.security.QpidSecurityException;
 import org.apache.qpid.codec.AMQCodecFactory;
 import org.apache.qpid.common.QpidProperties;
 import org.apache.qpid.common.ServerPropertyNames;
-import org.apache.qpid.framing.AMQBody;
-import org.apache.qpid.framing.AMQDataBlock;
-import org.apache.qpid.framing.AMQFrame;
-import org.apache.qpid.framing.AMQMethodBody;
-import org.apache.qpid.framing.AMQProtocolHeaderException;
-import org.apache.qpid.framing.AMQShortString;
-import org.apache.qpid.framing.ChannelCloseBody;
-import org.apache.qpid.framing.ChannelCloseOkBody;
-import org.apache.qpid.framing.ConnectionCloseBody;
-import org.apache.qpid.framing.ContentBody;
-import org.apache.qpid.framing.ContentHeaderBody;
-import org.apache.qpid.framing.FieldTable;
-import org.apache.qpid.framing.FieldTableFactory;
-import org.apache.qpid.framing.HeartbeatBody;
-import org.apache.qpid.framing.MethodDispatcher;
-import org.apache.qpid.framing.MethodRegistry;
-import org.apache.qpid.framing.ProtocolInitiation;
-import org.apache.qpid.framing.ProtocolVersion;
 import org.apache.qpid.properties.ConnectionStartProperties;
 import org.apache.qpid.protocol.AMQConstant;
 import org.apache.qpid.protocol.AMQMethodEvent;
@@ -95,6 +78,8 @@ import org.apache.qpid.server.protocol.v
 import org.apache.qpid.server.protocol.v0_8.state.AMQStateManager;
 import org.apache.qpid.server.stats.StatisticsCounter;
 import org.apache.qpid.server.consumer.Consumer;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
 import org.apache.qpid.server.virtualhost.VirtualHost;
 import org.apache.qpid.transport.Sender;
 import org.apache.qpid.transport.TransportException;
@@ -303,9 +288,24 @@ public class AMQProtocolEngine implement
             }
             receivedComplete();
         }
-        catch (Exception e)
+        catch (ConnectionScopedRuntimeException e)
+        {
+            _logger.error("Unexpected exception", e);
+            closeProtocolSession();
+        }
+        catch (AMQProtocolVersionException e)
+        {
+            _logger.error("Unexpected protocol version", e);
+            closeProtocolSession();
+        }
+        catch (AMQFrameDecodingException e)
         {
-            _logger.error("Unexpected exception when processing datablocks", e);
+            _logger.error("Frame decoding", e);
+            closeProtocolSession();
+        }
+        catch (IOException e)
+        {
+            _logger.error("I/O Exception", e);
             closeProtocolSession();
         }
         finally
@@ -314,34 +314,14 @@ public class AMQProtocolEngine implement
         }
     }
 
-    private void receivedComplete() throws AMQException
+    private void receivedComplete()
     {
-        Exception exception = null;
         for (AMQChannel channel : _channelsForCurrentMessage)
         {
-            try
-            {
-                channel.receivedComplete();
-            }
-            catch(Exception exceptionForThisChannel)
-            {
-                if(exception == null)
-                {
-                    exception = exceptionForThisChannel;
-                }
-                _logger.error("Error informing channel that receiving is complete. Channel: " + channel, exceptionForThisChannel);
-            }
+            channel.receivedComplete();
         }
 
         _channelsForCurrentMessage.clear();
-
-        if(exception != null)
-        {
-            throw new AMQException(
-                    AMQConstant.INTERNAL_ERROR,
-                    "Error informing channel that receiving is complete: " + exception.getMessage(),
-                    exception);
-        }
     }
 
     /**
@@ -549,7 +529,7 @@ public class AMQProtocolEngine implement
         }
         catch (IOException e)
         {
-            throw new RuntimeException(e);
+            throw new ServerScopedRuntimeException(e);
         }
 
         final ByteBuffer buf;
@@ -812,16 +792,15 @@ public class AMQProtocolEngine implement
      *
      * @param channelId id of the channel to close
      *
-     * @throws AMQException             if an error occurs closing the channel
      * @throws IllegalArgumentException if the channel id is not valid
      */
     @Override
-    public void closeChannel(int channelId) throws AMQException
+    public void closeChannel(int channelId)
     {
         closeChannel(channelId, null, null);
     }
 
-    public void closeChannel(int channelId, AMQConstant cause, String message) throws AMQException
+    public void closeChannel(int channelId, AMQConstant cause, String message)
     {
         final AMQChannel channel = getChannel(channelId);
         if (channel == null)
@@ -903,7 +882,7 @@ public class AMQProtocolEngine implement
      *
      * @throws AMQException if an error occurs while closing any channel
      */
-    private void closeAllChannels() throws AMQException
+    private void closeAllChannels()
     {
         for (AMQChannel channel : getChannels())
         {
@@ -921,7 +900,7 @@ public class AMQProtocolEngine implement
 
     /** This must be called when the session is _closed in order to free up any resources managed by the session. */
     @Override
-    public void closeSession() throws AMQException
+    public void closeSession()
     {
         if(_closing.compareAndSet(false,true))
         {
@@ -996,7 +975,7 @@ public class AMQProtocolEngine implement
         }
     }
 
-    private void closeConnection(int channelId, AMQConnectionException e) throws AMQException
+    private void closeConnection(int channelId, AMQConnectionException e)
     {
         try
         {
@@ -1033,7 +1012,7 @@ public class AMQProtocolEngine implement
         {
             _stateManager.changeState(AMQState.CONNECTION_CLOSED);
         }
-        catch (AMQException e)
+        catch (ConnectionScopedRuntimeException e)
         {
             _logger.info(e.getMessage());
         }
@@ -1234,9 +1213,9 @@ public class AMQProtocolEngine implement
                 closeProtocolSession();
             }
         }
-        catch (AMQException e)
+        catch (ConnectionScopedRuntimeException e)
         {
-           _logger.error("Could not close protocol engine", e);
+            _logger.error("Could not close protocol engine", e);
         }
         catch (TransportException e)
         {
@@ -1269,15 +1248,30 @@ public class AMQProtocolEngine implement
         }
         else
         {
-            _logger.error("Exception caught in " + this + ", closing connection explicitly: " + throwable, throwable);
+            try
+            {
+                _logger.error("Exception caught in " + this + ", closing connection explicitly: " + throwable, throwable);
 
 
-            MethodRegistry methodRegistry = MethodRegistry.getMethodRegistry(getProtocolVersion());
-            ConnectionCloseBody closeBody = methodRegistry.createConnectionCloseBody(200,new AMQShortString(throwable.getMessage()),0,0);
+                MethodRegistry methodRegistry = MethodRegistry.getMethodRegistry(getProtocolVersion());
+                ConnectionCloseBody closeBody = methodRegistry.createConnectionCloseBody(200,new AMQShortString(throwable.getMessage()),0,0);
 
-            writeFrame(closeBody.generateFrame(0));
+                writeFrame(closeBody.generateFrame(0));
 
-            _sender.close();
+                _sender.close();
+            }
+            finally
+            {
+                if(throwable instanceof Error)
+                {
+                    throw (Error) throwable;
+                }
+                if(throwable instanceof ServerScopedRuntimeException)
+                {
+                    throw (ServerScopedRuntimeException) throwable;
+                }
+
+            }
         }
     }
 
@@ -1441,15 +1435,8 @@ public class AMQProtocolEngine implement
         {
             writeFrame(responseBody.generateFrame(0));
 
-            try
-            {
+            closeSession();
 
-                closeSession();
-            }
-            catch (AMQException ex)
-            {
-                throw new RuntimeException(ex);
-            }
         }
         finally
         {
@@ -1483,15 +1470,7 @@ public class AMQProtocolEngine implement
         try
         {
             writeFrame(responseBody.generateFrame(channelId));
-
-            try
-            {
-                closeChannel(channelId);
-            }
-            catch (AMQException ex)
-            {
-                throw new RuntimeException(ex);
-            }
+            closeChannel(channelId);
         }
         finally
         {
@@ -1507,7 +1486,7 @@ public class AMQProtocolEngine implement
         return getContextKey().toString();
     }
 
-    public void closeSession(AMQSessionModel session, AMQConstant cause, String message) throws AMQException
+    public void closeSession(AMQSessionModel session, AMQConstant cause, String message)
     {
         int channelId = ((AMQChannel)session).getChannelId();
         closeChannel(channelId, cause, message);
@@ -1522,7 +1501,7 @@ public class AMQProtocolEngine implement
         writeFrame(responseBody.generateFrame(channelId));
     }
 
-    public void close(AMQConstant cause, String message) throws AMQException
+    public void close(AMQConstant cause, String message)
     {
         closeConnection(0, new AMQConnectionException(cause, message, 0, 0,
 		                getProtocolOutputConverter().getProtocolMajorVersion(),

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolSession.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolSession.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolSession.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolSession.java Fri Feb 14 10:52:47 2014
@@ -71,7 +71,7 @@ public interface AMQProtocolSession exte
 
     public static interface Task
     {
-        public void doTask(AMQProtocolSession session) throws AMQException;
+        public void doTask(AMQProtocolSession session);
     }
 
     /**
@@ -152,7 +152,7 @@ public interface AMQProtocolSession exte
     void initHeartbeats(int delay);
 
     /** This must be called when the session is _closed in order to free up any resources managed by the session. */
-    void closeSession() throws AMQException;
+    void closeSession();
 
     void closeProtocolSession();
 

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageConverter_Internal_to_v0_8.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageConverter_Internal_to_v0_8.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageConverter_Internal_to_v0_8.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageConverter_Internal_to_v0_8.java Fri Feb 14 10:52:47 2014
@@ -29,6 +29,7 @@ import org.apache.qpid.server.message.in
 import org.apache.qpid.server.plugin.MessageConverter;
 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.server.virtualhost.VirtualHost;
 import org.apache.qpid.transport.codec.BBEncoder;
 
@@ -236,7 +237,7 @@ public class MessageConverter_Internal_t
             }
             catch (IOException e)
             {
-                throw new RuntimeException(e);
+                throw new ConnectionScopedRuntimeException(e);
             }
         }
     }

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageConverter_v0_8_to_Internal.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageConverter_v0_8_to_Internal.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageConverter_v0_8_to_Internal.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageConverter_v0_8_to_Internal.java Fri Feb 14 10:52:47 2014
@@ -22,6 +22,7 @@ package org.apache.qpid.server.protocol.
 
 import org.apache.qpid.server.message.internal.InternalMessage;
 import org.apache.qpid.server.plugin.MessageConverter;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
 import org.apache.qpid.server.virtualhost.VirtualHost;
 import org.apache.qpid.transport.codec.BBDecoder;
 import org.apache.qpid.typedmessage.TypedBytesContentReader;
@@ -124,11 +125,11 @@ public class MessageConverter_v0_8_to_In
                 }
                 catch (TypedBytesFormatException e)
                 {
-                    throw new RuntimeException(e);  // TODO - Implement
+                    throw new ConnectionScopedRuntimeException(e);
                 }
                 catch (EOFException e)
                 {
-                    throw new RuntimeException(e);  // TODO - Implement
+                    throw new ConnectionScopedRuntimeException(e);
                 }
             }
             return list;

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageMetaData.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageMetaData.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageMetaData.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageMetaData.java Fri Feb 14 10:52:47 2014
@@ -22,6 +22,8 @@ package org.apache.qpid.server.protocol.
 
 import java.util.Collection;
 import org.apache.qpid.AMQException;
+import org.apache.qpid.framing.AMQFrameDecodingException;
+import org.apache.qpid.framing.AMQProtocolVersionException;
 import org.apache.qpid.framing.AMQShortString;
 import org.apache.qpid.framing.BasicContentHeaderProperties;
 import org.apache.qpid.framing.ContentHeaderBody;
@@ -32,6 +34,7 @@ import org.apache.qpid.server.message.AM
 import org.apache.qpid.server.plugin.MessageMetaDataType;
 import org.apache.qpid.server.store.StorableMessageMetaData;
 import org.apache.qpid.server.util.ByteBufferOutputStream;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
 import org.apache.qpid.util.ByteBufferInputStream;
 
 import java.io.DataInputStream;
@@ -132,7 +135,7 @@ public class MessageMetaData implements 
         catch (IOException e)
         {
             // This shouldn't happen as we are not actually using anything that can throw an IO Exception
-            throw new RuntimeException(e);
+            throw new ConnectionScopedRuntimeException(e);
         }
 
         return dest.position()-oldPosition;
@@ -196,17 +199,21 @@ public class MessageMetaData implements 
                         };
                 return new MessageMetaData(publishBody, chb, arrivalTime);
             }
-            catch (AMQException e)
+            catch (IOException e)
             {
-                throw new RuntimeException(e);
+                throw new ConnectionScopedRuntimeException(e);
             }
-            catch (IOException e)
+            catch (AMQProtocolVersionException e)
             {
-                throw new RuntimeException(e);
+                throw new ConnectionScopedRuntimeException(e);
+            }
+            catch (AMQFrameDecodingException e)
+            {
+                throw new ConnectionScopedRuntimeException(e);
             }
 
         }
-    };
+    }
 
     public AMQMessageHeader getMessageHeader()
     {

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/BasicConsumeMethodHandler.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/BasicConsumeMethodHandler.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/BasicConsumeMethodHandler.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/BasicConsumeMethodHandler.java Fri Feb 14 10:52:47 2014
@@ -28,6 +28,7 @@ import org.apache.qpid.framing.AMQShortS
 import org.apache.qpid.framing.BasicConsumeBody;
 import org.apache.qpid.framing.MethodRegistry;
 import org.apache.qpid.protocol.AMQConstant;
+import org.apache.qpid.server.filter.AMQInvalidArgumentException;
 import org.apache.qpid.server.message.MessageSource;
 import org.apache.qpid.server.protocol.v0_8.AMQChannel;
 import org.apache.qpid.server.protocol.v0_8.AMQProtocolSession;
@@ -149,7 +150,7 @@ public class BasicConsumeMethodHandler i
                     }
 
                 }
-                catch (org.apache.qpid.AMQInvalidArgumentException ise)
+                catch (AMQInvalidArgumentException ise)
                 {
                     _logger.debug("Closing connection due to invalid selector");
 

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/BasicGetMethodHandler.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/BasicGetMethodHandler.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/BasicGetMethodHandler.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/BasicGetMethodHandler.java Fri Feb 14 10:52:47 2014
@@ -31,6 +31,7 @@ import org.apache.qpid.framing.MethodReg
 import org.apache.qpid.protocol.AMQConstant;
 import org.apache.qpid.server.message.InstanceProperties;
 import org.apache.qpid.server.message.MessageInstance;
+import org.apache.qpid.server.message.MessageSource;
 import org.apache.qpid.server.message.ServerMessage;
 import org.apache.qpid.server.protocol.v0_8.AMQChannel;
 import org.apache.qpid.server.flow.FlowCreditManager;
@@ -124,6 +125,17 @@ public class BasicGetMethodHandler imple
                     throw body.getConnectionException(AMQConstant.ACCESS_REFUSED,
                                                       e.getMessage());
                 }
+                catch (MessageSource.ExistingExclusiveConsumer e)
+                {
+                    throw body.getConnectionException(AMQConstant.NOT_ALLOWED,
+                                                      "Queue has an exclusive consumer");
+                }
+                catch (MessageSource.ExistingConsumerPreventsExclusive e)
+                {
+                    throw body.getConnectionException(AMQConstant.INTERNAL_ERROR,
+                                                      "The GET request has been evaluated as an exclusive consumer, " +
+                                                      "this is likely due to a programming error in the Qpid broker");
+                }
             }
         }
     }
@@ -132,7 +144,8 @@ public class BasicGetMethodHandler imple
                                      final AMQProtocolSession session,
                                      final AMQChannel channel,
                                      final boolean acks)
-            throws AMQException, QpidSecurityException
+            throws AMQException, QpidSecurityException, MessageSource.ExistingConsumerPreventsExclusive,
+                   MessageSource.ExistingExclusiveConsumer
     {
 
         final FlowCreditManager singleMessageCredit = new MessageOnlyCreditManager(1L);

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/ChannelOpenHandler.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/ChannelOpenHandler.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/ChannelOpenHandler.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/ChannelOpenHandler.java Fri Feb 14 10:52:47 2014
@@ -35,6 +35,7 @@ import org.apache.qpid.server.protocol.v
 import org.apache.qpid.server.protocol.v0_8.AMQProtocolSession;
 import org.apache.qpid.server.protocol.v0_8.state.AMQStateManager;
 import org.apache.qpid.server.protocol.v0_8.state.StateAwareMethodListener;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
 import org.apache.qpid.server.virtualhost.VirtualHost;
 
 import java.io.ByteArrayOutputStream;
@@ -99,7 +100,7 @@ public class ChannelOpenHandler implemen
             catch (IOException e)
             {
                 // This *really* shouldn't happen as we're not doing any I/O
-                throw new RuntimeException("I/O exception when writing to byte array", e);
+                throw new ConnectionScopedRuntimeException("I/O exception when writing to byte array", e);
             }
 
             // should really associate this channelId to the session
@@ -123,7 +124,7 @@ public class ChannelOpenHandler implemen
             catch (IOException e)
             {
                 // This *really* shouldn't happen as we're not doing any I/O
-                throw new RuntimeException("I/O exception when writing to byte array", e);
+                throw new ConnectionScopedRuntimeException("I/O exception when writing to byte array", e);
             }
 
             // should really associate this channelId to the session

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/ExchangeDeclareHandler.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/ExchangeDeclareHandler.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/ExchangeDeclareHandler.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/ExchangeDeclareHandler.java Fri Feb 14 10:52:47 2014
@@ -24,7 +24,7 @@ import org.apache.log4j.Logger;
 
 import org.apache.qpid.AMQConnectionException;
 import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQUnknownExchangeType;
+import org.apache.qpid.server.exchange.AMQUnknownExchangeType;
 import org.apache.qpid.framing.AMQMethodBody;
 import org.apache.qpid.framing.AMQShortString;
 import org.apache.qpid.framing.ExchangeDeclareBody;
@@ -38,6 +38,7 @@ import org.apache.qpid.server.protocol.v
 import org.apache.qpid.server.security.QpidSecurityException;
 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;
 
 public class ExchangeDeclareHandler implements StateAwareMethodListener<ExchangeDeclareBody>
@@ -129,6 +130,11 @@ public class ExchangeDeclareHandler impl
             {
                 throw body.getConnectionException(AMQConstant.ACCESS_REFUSED, e.getMessage());
             }
+            catch (UnknownExchangeException e)
+            {
+                // note - since 0-8/9/9-1 can't set the alt. exchange this exception should never occur
+                throw body.getConnectionException(AMQConstant.NOT_FOUND, "Unknown alternate exchange",e);
+            }
         }
 
 

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/QueueDeclareHandler.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/QueueDeclareHandler.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/QueueDeclareHandler.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/handler/QueueDeclareHandler.java Fri Feb 14 10:52:47 2014
@@ -34,21 +34,17 @@ import org.apache.qpid.server.model.UUID
 import org.apache.qpid.server.protocol.v0_8.AMQProtocolSession;
 import org.apache.qpid.server.protocol.AMQSessionModel;
 import org.apache.qpid.server.queue.AMQQueue;
-import org.apache.qpid.server.queue.AMQQueueFactory;
 import org.apache.qpid.server.queue.QueueArgumentsConverter;
-import org.apache.qpid.server.queue.QueueRegistry;
 import org.apache.qpid.server.protocol.v0_8.state.AMQStateManager;
 import org.apache.qpid.server.protocol.v0_8.state.StateAwareMethodListener;
 import org.apache.qpid.server.security.QpidSecurityException;
-import org.apache.qpid.server.store.DurableConfigurationStoreHelper;
-import org.apache.qpid.server.store.DurableConfigurationStore;
 import org.apache.qpid.server.util.Action;
 import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
 import org.apache.qpid.server.virtualhost.VirtualHost;
 
 import java.util.Map;
 import java.util.UUID;
-import org.apache.qpid.server.virtualhost.plugins.QueueExistsException;
+import org.apache.qpid.server.virtualhost.QueueExistsException;
 
 public class QueueDeclareHandler implements StateAwareMethodListener<QueueDeclareBody>
 {
@@ -131,7 +127,7 @@ public class QueueDeclareHandler impleme
                         final AMQQueue q = queue;
                         final AMQProtocolSession.Task sessionCloseTask = new AMQProtocolSession.Task()
                         {
-                            public void doTask(AMQProtocolSession session) throws AMQException
+                            public void doTask(AMQProtocolSession session)
                             {
                                 q.setExclusiveOwningSession(null);
                             }
@@ -219,7 +215,7 @@ public class QueueDeclareHandler impleme
                                    QueueDeclareBody body,
                                    final VirtualHost virtualHost,
                                    final AMQProtocolSession session)
-            throws AMQException, QpidSecurityException
+            throws AMQException, QpidSecurityException, QueueExistsException
     {
 
         final boolean durable = body.getDurable();
@@ -241,7 +237,7 @@ public class QueueDeclareHandler impleme
             final AMQProtocolSession.Task deleteQueueTask =
                     new AMQProtocolSession.Task()
                     {
-                        public void doTask(AMQProtocolSession session) throws AMQException
+                        public void doTask(AMQProtocolSession session)
                         {
                             if (virtualHost.getQueue(queueName.toString()) == queue)
                             {

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/state/AMQStateManager.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/state/AMQStateManager.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/state/AMQStateManager.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/state/AMQStateManager.java Fri Feb 14 10:52:47 2014
@@ -52,8 +52,6 @@ public class AMQStateManager implements 
     /** The current state */
     private AMQState _currentState;
 
-    private CopyOnWriteArraySet<StateListener> _stateListeners = new CopyOnWriteArraySet<StateListener>();
-
     public AMQStateManager(Broker broker, AMQProtocolSession protocolSession)
     {
         _broker = broker;
@@ -72,30 +70,17 @@ public class AMQStateManager implements 
         return _broker;
     }
 
-    public AMQState getCurrentState()
-    {
-        return _currentState;
-    }
-
-    public void changeState(AMQState newState) throws AMQException
+    public void changeState(AMQState newState)
     {
         _logger.debug("State changing to " + newState + " from old state " + _currentState);
         final AMQState oldState = _currentState;
         _currentState = newState;
 
-        for (StateListener l : _stateListeners)
-        {
-            l.stateChanged(oldState, newState);
-        }
     }
 
     public void error(Exception e)
     {
         _logger.error("State manager received error notification[Current State:" + _currentState + "]: " + e, e);
-        for (StateListener l : _stateListeners)
-        {
-            l.error(e);
-        }
     }
 
     public <B extends AMQMethodBody> boolean methodReceived(AMQMethodEvent<B> evt) throws AMQException
@@ -121,28 +106,6 @@ public class AMQStateManager implements 
 
     }
 
-    private <B extends AMQMethodBody> void checkChannel(AMQMethodEvent<B> evt, AMQProtocolSession protocolSession)
-        throws AMQException
-    {
-        if ((evt.getChannelId() != 0) && !(evt.getMethod() instanceof ChannelOpenBody)
-                && (protocolSession.getChannel(evt.getChannelId()) == null)
-                && !protocolSession.channelAwaitingClosure(evt.getChannelId()))
-        {
-            throw evt.getMethod().getChannelNotFoundException(evt.getChannelId());
-        }
-    }
-
-    public void addStateListener(StateListener listener)
-    {
-        _logger.debug("Adding state listener");
-        _stateListeners.add(listener);
-    }
-
-    public void removeStateListener(StateListener listener)
-    {
-        _stateListeners.remove(listener);
-    }
-
     public VirtualHostRegistry getVirtualHostRegistry()
     {
         return _broker.getVirtualHostRegistry();

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/test/java/org/apache/qpid/server/protocol/v0_8/AckTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/test/java/org/apache/qpid/server/protocol/v0_8/AckTest.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/test/java/org/apache/qpid/server/protocol/v0_8/AckTest.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/test/java/org/apache/qpid/server/protocol/v0_8/AckTest.java Fri Feb 14 10:52:47 2014
@@ -139,28 +139,20 @@ public class AckTest extends QpidTestCas
             final StoredMessage storedMessage = _messageStore.addMessage(mmd);
             final AMQMessage message = new AMQMessage(storedMessage);
             ServerTransaction txn = new AutoCommitTransaction(_messageStore);
-            txn.enqueue(_queue, message, new ServerTransaction.Action() {
-                public void postCommit()
-                {
-                    try
-                    {
-
-                        _queue.enqueue(message,null);
-                    }
-                    catch (AMQException e)
-                    {
-                         throw new RuntimeException(e);
-                    }
-                }
-
-                public void onRollback()
-                {
-                    //To change body of implemented methods use File | Settings | File Templates.
-                }
-            });
+            txn.enqueue(_queue, message,
+                        new ServerTransaction.Action()
+                        {
+                            public void postCommit()
+                            {
+                                _queue.enqueue(message,null);
+                            }
+
+                            public void onRollback()
+                            {
+                                //To change body of implemented methods use File | Settings | File Templates.
+                            }
+                        });
 
-            // we manually send the message to the subscription
-            //_subscription.send(new QueueEntry(_queue,msg), _queue);
         }
         try
         {

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/test/java/org/apache/qpid/server/protocol/v0_8/InternalTestProtocolSession.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/test/java/org/apache/qpid/server/protocol/v0_8/InternalTestProtocolSession.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/test/java/org/apache/qpid/server/protocol/v0_8/InternalTestProtocolSession.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/test/java/org/apache/qpid/server/protocol/v0_8/InternalTestProtocolSession.java Fri Feb 14 10:52:47 2014
@@ -223,7 +223,7 @@ public class InternalTestProtocolSession
         //  Then the AMQMinaProtocolSession can join on the returning future without a NPE.
     }
 
-    public void closeSession(AMQSessionModel session, AMQConstant cause, String message) throws AMQException
+    public void closeSession(AMQSessionModel session, AMQConstant cause, String message)
     {
         super.closeSession(session, cause, message);
 

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Connection_1_0.java Fri Feb 14 10:52:47 2014
@@ -22,7 +22,6 @@ package org.apache.qpid.server.protocol.
 
 import java.text.MessageFormat;
 import java.util.Collection;
-import org.apache.qpid.AMQException;
 import org.apache.qpid.amqp_1_0.transport.ConnectionEndpoint;
 import org.apache.qpid.amqp_1_0.transport.ConnectionEventListener;
 import org.apache.qpid.amqp_1_0.transport.SessionEndpoint;
@@ -152,7 +151,7 @@ public class Connection_1_0 implements C
         private volatile boolean _stopped;
 
         @Override
-        public void close(AMQConstant cause, String message) throws AMQException
+        public void close(AMQConstant cause, String message)
         {
             _conn.close();
         }
@@ -170,7 +169,7 @@ public class Connection_1_0 implements C
         }
 
         @Override
-        public void closeSession(AMQSessionModel session, AMQConstant cause, String message) throws AMQException
+        public void closeSession(AMQSessionModel session, AMQConstant cause, String message)
         {
             // TODO
         }

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java Fri Feb 14 10:52:47 2014
@@ -20,7 +20,6 @@
  */
 package org.apache.qpid.server.protocol.v1_0;
 
-import org.apache.qpid.AMQException;
 import org.apache.qpid.amqp_1_0.codec.ValueHandler;
 import org.apache.qpid.amqp_1_0.messaging.SectionEncoder;
 import org.apache.qpid.amqp_1_0.messaging.SectionEncoderImpl;
@@ -46,6 +45,7 @@ import org.apache.qpid.server.protocol.M
 import org.apache.qpid.server.consumer.AbstractConsumerTarget;
 import org.apache.qpid.server.consumer.Consumer;
 import org.apache.qpid.server.txn.ServerTransaction;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
 
 import java.nio.ByteBuffer;
 import java.util.List;
@@ -187,7 +187,7 @@ class ConsumerTarget_1_0 extends Abstrac
             catch (AmqpErrorException e)
             {
                 //TODO
-                throw new RuntimeException(e);
+                throw new ConnectionScopedRuntimeException(e);
             }
 
             Header header = new Header();

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ExchangeDestination.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ExchangeDestination.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ExchangeDestination.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ExchangeDestination.java Fri Feb 14 10:52:47 2014
@@ -20,8 +20,6 @@
  */
 package org.apache.qpid.server.protocol.v1_0;
 
-import java.util.List;
-import org.apache.qpid.AMQException;
 import org.apache.qpid.amqp_1_0.type.Outcome;
 import org.apache.qpid.amqp_1_0.type.messaging.Accepted;
 import org.apache.qpid.amqp_1_0.type.messaging.Rejected;
@@ -29,8 +27,6 @@ import org.apache.qpid.amqp_1_0.type.mes
 import org.apache.qpid.amqp_1_0.type.messaging.TerminusExpiryPolicy;
 import org.apache.qpid.server.exchange.Exchange;
 import org.apache.qpid.server.message.InstanceProperties;
-import org.apache.qpid.server.message.MessageReference;
-import org.apache.qpid.server.queue.BaseQueue;
 import org.apache.qpid.server.txn.ServerTransaction;
 
 public class ExchangeDestination implements ReceivingDestination, SendingDestination

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_Internal_to_v1_0.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_Internal_to_v1_0.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_Internal_to_v1_0.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_Internal_to_v1_0.java Fri Feb 14 10:52:47 2014
@@ -31,6 +31,7 @@ import org.apache.qpid.amqp_1_0.type.mes
 import org.apache.qpid.amqp_1_0.type.messaging.Header;
 import org.apache.qpid.amqp_1_0.type.messaging.Properties;
 import org.apache.qpid.server.message.internal.InternalMessage;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -132,7 +133,7 @@ public class MessageConverter_Internal_t
             }
             catch (IOException e)
             {
-                throw new RuntimeException(e);
+                throw new ConnectionScopedRuntimeException(e);
             }
         }
     }

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_to_1_0.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_to_1_0.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_to_1_0.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_to_1_0.java Fri Feb 14 10:52:47 2014
@@ -39,6 +39,7 @@ import org.apache.qpid.server.message.Se
 import org.apache.qpid.server.plugin.MessageConverter;
 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.server.virtualhost.VirtualHost;
 import org.apache.qpid.transport.codec.BBDecoder;
 import org.apache.qpid.typedmessage.TypedBytesContentReader;
@@ -140,11 +141,11 @@ public abstract class MessageConverter_t
                 }
                 catch (TypedBytesFormatException e)
                 {
-                    throw new RuntimeException(e);  // TODO - Implement
+                    throw new ConnectionScopedRuntimeException(e);
                 }
                 catch (EOFException e)
                 {
-                    throw new RuntimeException(e);  // TODO - Implement
+                    throw new ConnectionScopedRuntimeException(e);
                 }
             }
             return new AmqpValue(list);

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_v1_0_to_Internal.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_v1_0_to_Internal.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_v1_0_to_Internal.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_v1_0_to_Internal.java Fri Feb 14 10:52:47 2014
@@ -30,6 +30,7 @@ import org.apache.qpid.amqp_1_0.type.mes
 import org.apache.qpid.amqp_1_0.type.messaging.Data;
 import org.apache.qpid.server.message.internal.InternalMessage;
 import org.apache.qpid.server.plugin.MessageConverter;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
 import org.apache.qpid.server.virtualhost.VirtualHost;
 import org.apache.qpid.transport.codec.BBDecoder;
 import org.apache.qpid.typedmessage.TypedBytesContentReader;
@@ -96,7 +97,7 @@ public class MessageConverter_v1_0_to_In
                 {
                     if(previousSection != null && (previousSection.getClass() != section.getClass() || section instanceof AmqpValue))
                     {
-                        throw new RuntimeException("Message is badly formed and has multiple body section which are not all Data or not all AmqpSequence");
+                        throw new ConnectionScopedRuntimeException("Message is badly formed and has multiple body section which are not all Data or not all AmqpSequence");
                     }
                     else
                     {
@@ -149,7 +150,7 @@ public class MessageConverter_v1_0_to_In
         }
         catch (AmqpErrorException e)
         {
-            throw new RuntimeException(e);
+            throw new ConnectionScopedRuntimeException(e);
         }
 
 
@@ -257,11 +258,11 @@ public class MessageConverter_v1_0_to_In
                 }
                 catch (TypedBytesFormatException e)
                 {
-                    throw new RuntimeException(e);  // TODO - Implement
+                    throw new ConnectionScopedRuntimeException(e);
                 }
                 catch (EOFException e)
                 {
-                    throw new RuntimeException(e);  // TODO - Implement
+                    throw new ConnectionScopedRuntimeException(e);
                 }
             }
             return list;

Modified: qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageMetaData_1_0.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageMetaData_1_0.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageMetaData_1_0.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageMetaData_1_0.java Fri Feb 14 10:52:47 2014
@@ -43,6 +43,7 @@ import org.apache.qpid.amqp_1_0.type.mes
 import org.apache.qpid.server.message.AMQMessageHeader;
 import org.apache.qpid.server.plugin.MessageMetaDataType;
 import org.apache.qpid.server.store.StorableMessageMetaData;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
 
 public class MessageMetaData_1_0 implements StorableMessageMetaData
 {
@@ -394,7 +395,7 @@ public class MessageMetaData_1_0 impleme
                 catch (AmqpErrorException e)
                 {
                     //TODO
-                    throw new RuntimeException(e);
+                    throw new ConnectionScopedRuntimeException(e);
                 }
 
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org