qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r1568235 [2/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...
Date Fri, 14 Feb 2014 10:52:51 GMT
Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/ChangeAttributesTask.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/ChangeAttributesTask.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/ChangeAttributesTask.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/ChangeAttributesTask.java Fri Feb 14 10:52:47 2014
@@ -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 implem
     }
 
     @Override
-    public Void call() throws Exception
+    public Void call()
     {
         _object.setAttributes(_attributes);
         return null;

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

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

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

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/TaskExecutor.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/TaskExecutor.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/TaskExecutor.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/configuration/updater/TaskExecutor.java Fri Feb 14 10:52:47 2014
@@ -42,6 +42,7 @@ import org.apache.qpid.server.logging.Lo
 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();
         }

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

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

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

Copied: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AMQUnknownExchangeType.java (from r1568014, qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQUnknownExchangeType.java)
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AMQUnknownExchangeType.java?p2=qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AMQUnknownExchangeType.java&p1=qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQUnknownExchangeType.java&r1=1568014&r2=1568235&rev=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQUnknownExchangeType.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AMQUnknownExchangeType.java Fri Feb 14 10:52:47 2014
@@ -19,7 +19,7 @@
  *
  */
 
-package org.apache.qpid;
+package org.apache.qpid.server.exchange;
 
 /**
  * AMQUnknownExchangeType represents coding error where unknown exchange type requested from exchange factory.
@@ -29,15 +29,13 @@ package org.apache.qpid;
  * <tr><td> Represents unknown exchange type request.
  * <tr><td>
  *
- * @todo Not an AMQP exception as no status code.
- *
  * @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 AMQException
+public class AMQUnknownExchangeType extends Exception
 {
     public AMQUnknownExchangeType(String message, Throwable cause)
     {
-        super(null, message, cause);
+        super(message, cause);
     }
 }

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/AbstractExchange.java Fri Feb 14 10:52:47 2014
@@ -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 i
                            String name,
                            boolean durable,
                            boolean autoDelete)
-            throws AMQException
     {
         _virtualHost = host;
         _name = name;
@@ -137,7 +134,7 @@ public abstract class AbstractExchange i
         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 i
 
                 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 i
 
     @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 i
     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 i
     @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 i
                                 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 i
 
         }
 
-        public void onClose(final Exchange exchange) throws QpidSecurityException, AMQInternalException
+        public void onClose(final Exchange exchange) throws QpidSecurityException
         {
             removeBinding(this);
         }

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchange.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchange.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchange.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/DefaultExchange.java Fri Feb 14 10:52:47 2014
@@ -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 
                            VirtualHost host,
                            String name,
                            boolean durable,
-                           boolean autoDelete) throws AMQException
+                           boolean autoDelete)
     {
         _id = id;
         _virtualHost = host;
@@ -122,34 +120,34 @@ public class DefaultExchange implements 
 
     @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 
                     {
                         q.enqueue(message, postEnqueueAction);
                     }
-                    catch (AMQException e)
-                    {
-                        // TODO
-                        throw new RuntimeException(e);
-                    }
                     finally
                     {
                         _reference.release();

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

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

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

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

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/Exchange.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/Exchange.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/Exchange.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/Exchange.java Fri Feb 14 10:52:47 2014
@@ -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 Exchan
 
 
     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 Exchan
      * @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 Exchan
      * @param bindingKey
      * @param queue
      * @return
-     * @throws AMQException
      */
 
     boolean isBound(String bindingKey, AMQQueue queue);
@@ -115,14 +110,12 @@ public interface Exchange extends Exchan
      * 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();
 

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

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

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

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/FanoutExchange.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/FanoutExchange.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/FanoutExchange.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/FanoutExchange.java Fri Feb 14 10:52:47 2014
@@ -27,8 +27,8 @@ import java.util.concurrent.CopyOnWriteA
 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;

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

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

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersExchangeType.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersExchangeType.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersExchangeType.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersExchangeType.java Fri Feb 14 10:52:47 2014
@@ -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 impleme
     }
 
     public HeadersExchange newInstance(UUID id, VirtualHost host, String name, boolean durable,
-                                       boolean autoDelete) throws AMQException
+                                       boolean autoDelete)
     {
         HeadersExchange exch = new HeadersExchange();
 

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/TopicExchange.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/TopicExchange.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/TopicExchange.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/TopicExchange.java Fri Feb 14 10:52:47 2014
@@ -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.Se
 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 Abstr
         }
         catch (AMQInvalidArgumentException e)
         {
-            throw new RuntimeException(e);
+            // TODO - this seems incorrect, handling of invalid bindings should be propagated more cleanly
+            throw new ConnectionScopedRuntimeException(e);
         }
     }
 

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

Added: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/AMQInvalidArgumentException.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/AMQInvalidArgumentException.java?rev=1568235&view=auto
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/AMQInvalidArgumentException.java (added)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/filter/AMQInvalidArgumentException.java Fri Feb 14 10:52:47 2014
@@ -0,0 +1,43 @@
+/*
+ *
+ * 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;
+
+public class AMQInvalidArgumentException extends Exception
+{
+    public AMQInvalidArgumentException(final Throwable cause)
+    {
+        super(cause);
+    }
+
+    public AMQInvalidArgumentException(final String message, final Throwable cause)
+    {
+        super(message, cause);
+    }
+
+    public AMQInvalidArgumentException(final String message)
+    {
+        super(message);
+    }
+
+    public AMQInvalidArgumentException()
+    {
+    }
+}

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

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

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

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

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessage.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessage.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessage.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessage.java Fri Feb 14 10:52:47 2014
@@ -25,6 +25,7 @@ import org.apache.qpid.server.message.Ab
 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 Abs
         }
         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 Abs
         }
         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 Abs
         }
         catch (IOException e)
         {
-            throw new RuntimeException(e);
+            throw new ConnectionScopedRuntimeException("Unexpected IO Exception on operation in memory", e);
         }
     }
 

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaData.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaData.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaData.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaData.java Fri Feb 14 10:52:47 2014
@@ -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 imp
         }
         catch (IOException e)
         {
-            throw new RuntimeException(e);
+            throw new ConnectionScopedRuntimeException("Unexpected IO Exception on in memory operation", e);
         }
     }
 

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaDataType.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaDataType.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaDataType.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/message/internal/InternalMessageMetaDataType.java Fri Feb 14 10:52:47 2014
@@ -23,6 +23,7 @@ package org.apache.qpid.server.message.i
 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
         }
         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);
         }
 
     }

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractAdapter.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractAdapter.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractAdapter.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AbstractAdapter.java Fri Feb 14 10:52:47 2014
@@ -131,7 +131,7 @@ public abstract class AbstractAdapter im
         }
         else
         {
-            return (State)_taskExecutor.submitAndWait(new ChangeStateTask(this, currentState, desiredState));
+            return _taskExecutor.submitAndWait(new ChangeStateTask(this, currentState, desiredState));
         }
     }
 

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AmqpPortAdapter.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AmqpPortAdapter.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AmqpPortAdapter.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AmqpPortAdapter.java Fri Feb 14 10:52:47 2014
@@ -47,6 +47,7 @@ import org.apache.qpid.server.plugin.Tra
 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 Por
         }
         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);
         }
     }
 

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderAdapter.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderAdapter.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderAdapter.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/AuthenticationProviderAdapter.java Fri Feb 14 10:52:47 2014
@@ -554,8 +554,9 @@ public abstract class AuthenticationProv
                 }
                 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;
+
                 }
             }
 

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BindingAdapter.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BindingAdapter.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BindingAdapter.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/BindingAdapter.java Fri Feb 14 10:52:47 2014
@@ -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 Abstr
         {
             throw new AccessControlException(e.getMessage());
         }
-        catch(AMQInternalException e)
-        {
-            throw new IllegalStateException(e);
-        }
     }
 
     @Override

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

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ExchangeAdapter.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ExchangeAdapter.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ExchangeAdapter.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ExchangeAdapter.java Fri Feb 14 10:52:47 2014
@@ -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.Stat
 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 Abst
         {
             throw new AccessControlException(e.toString());
         }
-        catch(AMQInternalException e)
-        {
-            throw new IllegalStateException(e);
-        }
     }
 
     public void delete()
@@ -167,7 +162,7 @@ final class ExchangeAdapter extends Abst
         {
             throw new UnsupportedOperationException("'" + getName() + "' is a reserved exchange and can't be deleted");
         }
-        catch(AMQException e)
+        catch(ExchangeIsAlternateException e)
         {
             throw new IllegalStateException(e);
         }

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProvider.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProvider.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProvider.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileSystemPreferencesProvider.java Fri Feb 14 10:52:47 2014
@@ -246,7 +246,7 @@ public class FileSystemPreferencesProvid
                     _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 FileSystemPreferencesProvid
                     }
                     else
                     {
-                        throw new RuntimeException(e);
+                        throw e;
                     }
                 }
             }

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

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/QueueAdapter.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/QueueAdapter.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/QueueAdapter.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/QueueAdapter.java Fri Feb 14 10:52:47 2014
@@ -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 AMQQu
         {
             _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 AMQQu
         {
             if (_queue.isDurable())
             {
-                try
-                {
-                    DurableConfigurationStoreHelper.updateQueue(_queue.getVirtualHost().getDurableConfigurationStore(),
-                            _queue);
-                }
-                catch (AMQStoreException e)
-                {
-                    throw new IllegalStateException(e);
-                }
+                DurableConfigurationStoreHelper.updateQueue(_queue.getVirtualHost().getDurableConfigurationStore(),
+                        _queue);
             }
         }
     }

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAdapter.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAdapter.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAdapter.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/VirtualHostAdapter.java Fri Feb 14 10:52:47 2014
@@ -40,7 +40,7 @@ import org.apache.commons.configuration.
 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.LocalT
 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 ex
         {
             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 ex
         {
             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 ex
                 {
                     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 ex
 
                                     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 ex
                                                          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);

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

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

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

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

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

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueue.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueue.java?rev=1568235&r1=1568234&r2=1568235&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueue.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AMQQueue.java Fri Feb 14 10:52:47 2014
@@ -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 Queu
 
     boolean isDeleted();
 
-    int delete() throws AMQException, QpidSecurityException;
+    int delete() throws QpidSecurityException;
 
     void requeue(E entry);
 
@@ -103,7 +102,7 @@ public interface AMQQueue<E extends Queu
 
     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 Queu
 
     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();
 



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


Mime
View raw message