You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ru...@apache.org on 2007/05/21 17:11:27 UTC

svn commit: r540165 [2/3] - in /incubator/qpid/trunk/qpid/java: broker/src/main/grammar/ broker/src/main/java/org/apache/qpid/server/ broker/src/main/java/org/apache/qpid/server/ack/ broker/src/main/java/org/apache/qpid/server/exchange/ broker/src/main...

Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java (original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQQueue.java Mon May 21 08:11:23 2007
@@ -21,9 +21,9 @@
 package org.apache.qpid.server.queue;
 
 import java.text.MessageFormat;
-import java.util.List;
-import java.util.Hashtable;
 import java.util.Collection;
+import java.util.Hashtable;
+import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.Executor;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -40,11 +40,11 @@
 import org.apache.qpid.framing.FieldTable;
 import org.apache.qpid.server.AMQChannel;
 import org.apache.qpid.server.exception.InternalErrorException;
-import org.apache.qpid.server.messageStore.StorableMessage;
-import org.apache.qpid.server.messageStore.StorableQueue;
 import org.apache.qpid.server.exchange.Exchange;
 import org.apache.qpid.server.management.Managable;
 import org.apache.qpid.server.management.ManagedObject;
+import org.apache.qpid.server.messageStore.StorableMessage;
+import org.apache.qpid.server.messageStore.StorableQueue;
 import org.apache.qpid.server.protocol.AMQProtocolSession;
 import org.apache.qpid.server.store.StoreContext;
 import org.apache.qpid.server.virtualhost.VirtualHost;
@@ -55,49 +55,7 @@
  */
 public class AMQQueue implements Managable, Comparable, StorableQueue
 {
-    /**
-     * ExistingExclusiveSubscription signals a failure to create a subscription, because an exclusive subscription
-     * already exists.
-     *
-     * <p/><table id="crc"><caption>CRC Card</caption>
-     * <tr><th> Responsibilities <th> Collaborations
-     * <tr><td> Represent failure to create a subscription, because an exclusive subscription already exists.
-     * </table>
-     *
-     * @todo Not an AMQP exception as no status code.
-     *
-     * @todo Move to top level, used outside this class.
-     */
-    public static int s_queueID =0;
-    public static final class ExistingExclusiveSubscription extends AMQException
-    {
-
-        public ExistingExclusiveSubscription()
-        {
-            super("");
-        }
-    }
-
-    /**
-     * ExistingSubscriptionPreventsExclusive signals a failure to create an exclusize subscription, as a subscription
-     * already exists.
-     *
-     * <p/><table id="crc"><caption>CRC Card</caption>
-     * <tr><th> Responsibilities <th> Collaborations
-     * <tr><td> Represent failure to create an exclusize subscription, as a subscription already exists.
-     * </table>
-     *
-     * @todo Not an AMQP exception as no status code.
-     *
-     * @todo Move to top level, used outside this class.
-     */
-    public static final class ExistingSubscriptionPreventsExclusive extends AMQException
-    {
-        public ExistingSubscriptionPreventsExclusive()
-        {
-            super("");
-        }
-    }
+    public static int s_queueID = 0;
 
     private static final Logger _logger = Logger.getLogger(AMQQueue.class);
 
@@ -108,7 +66,6 @@
     // The list of enqueued messages.
     Hashtable<Long, StorableMessage> _messages = new Hashtable<Long, StorableMessage>();
 
-
     /**
      * null means shared
      */
@@ -236,12 +193,10 @@
         _subscribers = subscribers;
         _subscriptionFactory = subscriptionFactory;
         _deliveryMgr = new ConcurrentSelectorDeliveryManager(_subscribers, this);
-        _queueId = s_queueID++; 
+        _queueId = s_queueID++;
     }
 
-    private AMQQueueMBean createMBean()
-            throws
-            AMQException
+    private AMQQueueMBean createMBean() throws AMQException
     {
         try
         {
@@ -249,7 +204,7 @@
         }
         catch (JMException ex)
         {
-            throw new AMQException("AMQQueue MBean creation has failed ", ex);
+            throw new AMQException(null, "AMQQueue MBean creation has failed ", ex);
         }
     }
 
@@ -443,9 +398,7 @@
     /**
      * Removes the AMQMessage from the top of the queue.
      */
-    public synchronized void deleteMessageFromTop(StoreContext storeContext)
-            throws
-            AMQException
+    public synchronized void deleteMessageFromTop(StoreContext storeContext) throws AMQException
     {
         _deliveryMgr.removeAMessageFromTop(storeContext);
     }
@@ -453,16 +406,12 @@
     /**
      * removes all the messages from the queue.
      */
-    public synchronized long clearQueue(StoreContext storeContext)
-            throws
-            AMQException
+    public synchronized long clearQueue(StoreContext storeContext) throws AMQException
     {
         return _deliveryMgr.clearAllMessages(storeContext);
     }
 
-    public void bind(AMQShortString routingKey, FieldTable arguments, Exchange exchange)
-            throws
-            AMQException
+    public void bind(AMQShortString routingKey, FieldTable arguments, Exchange exchange) throws AMQException
     {
         exchange.registerQueue(routingKey, this, arguments);
         if (isDurable() && exchange.isDurable())
@@ -470,18 +419,17 @@
             try
             {
                 _virtualHost.getMessageStore().bindQueue(exchange, routingKey, this, arguments);
-            } catch (InternalErrorException e)
+            }
+            catch (InternalErrorException e)
             {
-               throw new AMQException("Problem binding queue ", e);
+                throw new AMQException(null, "Problem binding queue ", e);
             }
         }
 
         _bindings.addBinding(routingKey, arguments, exchange);
     }
 
-    public void unBind(AMQShortString routingKey, FieldTable arguments, Exchange exchange)
-            throws
-            AMQException
+    public void unBind(AMQShortString routingKey, FieldTable arguments, Exchange exchange) throws AMQException
     {
         exchange.deregisterQueue(routingKey, this, arguments);
         if (isDurable() && exchange.isDurable())
@@ -489,9 +437,10 @@
             try
             {
                 _virtualHost.getMessageStore().unbindQueue(exchange, routingKey, this, arguments);
-            } catch (InternalErrorException e)
+            }
+            catch (InternalErrorException e)
             {
-                throw new AMQException("problem unbinding queue", e);
+                throw new AMQException(null, "problem unbinding queue", e);
             }
         }
 
@@ -506,14 +455,16 @@
             if (isExclusive())
             {
                 decrementSubscriberCount();
-                throw new ExistingExclusiveSubscription();
-            } else if (exclusive)
+                throw new ExistingExclusiveSubscriptionException();
+            }
+            else if (exclusive)
             {
                 decrementSubscriberCount();
-                throw new ExistingSubscriptionPreventsExclusive();
+                throw new ExistingSubscriptionPreventsExclusiveException();
             }
 
-        } else if (exclusive)
+        }
+        else if (exclusive)
         {
             setExclusive(true);
         }
@@ -559,9 +510,7 @@
         return _subscriberCount.decrementAndGet();
     }
 
-    public void unregisterProtocolSession(AMQProtocolSession ps, int channel, AMQShortString consumerTag)
-            throws
-            AMQException
+    public void unregisterProtocolSession(AMQProtocolSession ps, int channel, AMQShortString consumerTag) throws AMQException
     {
         if (_logger.isDebugEnabled())
         {
@@ -576,8 +525,8 @@
                         _subscribers.removeSubscriber(_subscriptionFactory.createSubscription(channel, ps, consumerTag)))
                 == null)
         {
-            throw new AMQException("Protocol session with channel " + channel + " and consumer tag " + consumerTag
-                + " and protocol session key " + ps.getKey() + " not registered with queue " + this);
+            throw new AMQException(null, "Protocol session with channel " + channel + " and consumer tag " + consumerTag
+                + " and protocol session key " + ps.getKey() + " not registered with queue " + this, null);
         }
 
         removedSubscription.close();
@@ -609,21 +558,21 @@
         return !_deliveryMgr.hasQueuedMessages();
     }
 
-    public int delete(boolean checkUnused, boolean checkEmpty)
-            throws
-            AMQException
+    public int delete(boolean checkUnused, boolean checkEmpty) throws AMQException
     {
         if (checkUnused && !_subscribers.isEmpty())
         {
             _logger.info("Will not delete " + this + " as it is in use.");
 
             return 0;
-        } else if (checkEmpty && _deliveryMgr.hasQueuedMessages())
+        }
+        else if (checkEmpty && _deliveryMgr.hasQueuedMessages())
         {
             _logger.info("Will not delete " + this + " as it is not empty.");
 
             return 0;
-        } else
+        }
+        else
         {
             delete();
 
@@ -631,9 +580,7 @@
         }
     }
 
-    public void delete()
-            throws
-            AMQException
+    public void delete() throws AMQException
     {
         if (!_deleted.getAndSet(true))
         {
@@ -650,9 +597,7 @@
         }
     }
 
-    protected void autodelete()
-            throws
-            AMQException
+    protected void autodelete() throws AMQException
     {
         if (_logger.isDebugEnabled())
         {
@@ -662,9 +607,7 @@
         delete();
     }
 
-    public void processGet(StoreContext storeContext, AMQMessage msg, boolean deliverFirst)
-            throws
-            AMQException
+    public void processGet(StoreContext storeContext, AMQMessage msg, boolean deliverFirst) throws AMQException
     {
         // fixme not sure what this is doing. should we be passing deliverFirst through here?
         // This code is not used so when it is perhaps it should
@@ -687,9 +630,7 @@
     // return _deliveryMgr;
     // }
 
-    public void process(StoreContext storeContext, AMQMessage msg, boolean deliverFirst)
-            throws
-            AMQException
+    public void process(StoreContext storeContext, AMQMessage msg, boolean deliverFirst) throws AMQException
     {
         _deliveryMgr.deliver(storeContext, getName(), msg, deliverFirst);
         try
@@ -705,9 +646,7 @@
         }
     }
 
-    void dequeue(StoreContext storeContext, AMQMessage msg)
-            throws
-            FailedDequeueException
+    void dequeue(StoreContext storeContext, AMQMessage msg) throws FailedDequeueException
     {
         try
         {
@@ -737,9 +676,7 @@
         return _subscribers;
     }
 
-    protected void updateReceivedMessageCount(AMQMessage msg)
-            throws
-            AMQException
+    protected void updateReceivedMessageCount(AMQMessage msg) throws AMQException
     {
         if (!msg.isRedelivered())
         {
@@ -752,7 +689,7 @@
         }
         catch (JMException e)
         {
-            throw new AMQException("Unable to get notification from manage queue: " + e, e);
+            throw new AMQException(null, "Unable to get notification from manage queue: " + e, e);
         }
     }
 
@@ -783,9 +720,7 @@
         return "Queue(" + _name + ")@" + System.identityHashCode(this);
     }
 
-    public boolean performGet(AMQProtocolSession session, AMQChannel channel, boolean acks)
-            throws
-            AMQException
+    public boolean performGet(AMQProtocolSession session, AMQChannel channel, boolean acks) throws AMQException
     {
         return _deliveryMgr.performGet(session, channel, acks);
     }
@@ -802,9 +737,7 @@
 
     public static interface Task
     {
-        public void doTask(AMQQueue queue)
-                throws
-                AMQException;
+        public void doTask(AMQQueue queue) throws AMQException;
     }
 
     public void addQueueDeleteTask(Task task)
@@ -837,9 +770,9 @@
         _deliveryMgr.subscriberHasPendingResend(hasContent, subscription, msg);
     }
 
-    //========================================================================
+    // ========================================================================
     // Interface StorableQueue
-    //========================================================================
+    // ========================================================================
 
     public int getQueueID()
     {
@@ -861,9 +794,9 @@
         _messages.put(m.getMessageId(), m);
     }
 
-    //========================================================================
+    // ========================================================================
     // Used by the Store
-    //========================================================================
+    // ========================================================================
 
     /**
      * Get the list of enqueud messages

Added: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/ExistingExclusiveSubscriptionException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/ExistingExclusiveSubscriptionException.java?view=auto&rev=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/ExistingExclusiveSubscriptionException.java (added)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/ExistingExclusiveSubscriptionException.java Mon May 21 08:11:23 2007
@@ -0,0 +1,22 @@
+package org.apache.qpid.server.queue;
+
+import org.apache.qpid.AMQException;
+
+/**
+ * ExistingExclusiveSubscriptionException signals a failure to create a subscription, because an exclusive subscription
+ * already exists.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Represent failure to create a subscription, because an exclusive subscription already exists.
+ * </table>
+ *
+ * @todo Not an AMQP exception as no status code.
+ */
+public final class ExistingExclusiveSubscriptionException extends AMQException
+{
+    public ExistingExclusiveSubscriptionException()
+    {
+        super(null, "", null);
+    }
+}

Added: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/ExistingSubscriptionPreventsExclusiveException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/ExistingSubscriptionPreventsExclusiveException.java?view=auto&rev=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/ExistingSubscriptionPreventsExclusiveException.java (added)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/ExistingSubscriptionPreventsExclusiveException.java Mon May 21 08:11:23 2007
@@ -0,0 +1,22 @@
+package org.apache.qpid.server.queue;
+
+import org.apache.qpid.AMQException;
+
+/**
+ * ExistingSubscriptionPreventsExclusiveException signals a failure to create an exclusize subscription, as a subscription
+ * already exists.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Represent failure to create an exclusize subscription, as a subscription already exists.
+ * </table>
+ *
+ * @todo Not an AMQP exception as no status code.
+ */
+public final class ExistingSubscriptionPreventsExclusiveException extends AMQException
+{
+    public ExistingSubscriptionPreventsExclusiveException()
+    {
+        super(null, "", null);
+    }
+}

Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/FailedDequeueException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/FailedDequeueException.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/FailedDequeueException.java (original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/FailedDequeueException.java Mon May 21 08:11:23 2007
@@ -38,13 +38,8 @@
  */
 public class FailedDequeueException extends AMQException
 {
-    public FailedDequeueException(String queue)
+    public FailedDequeueException(String queue, Throwable cause)
     {
-        super("Failed to dequeue message from " + queue);
-    }
-
-    public FailedDequeueException(String queue, AMQException e)
-    {
-        super("Failed to dequeue message from " + queue, e);
+        super(null, "Failed to dequeue message from " + queue, cause);
     }
 }

Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/MessageCleanupException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/MessageCleanupException.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/MessageCleanupException.java (original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/MessageCleanupException.java Mon May 21 08:11:23 2007
@@ -40,13 +40,8 @@
  */
 public class MessageCleanupException extends AMQException
 {
-    public MessageCleanupException(long messageId, AMQException e)
+    public MessageCleanupException(String message, Throwable cause)
     {
-        super("Failed to cleanup message with id " + messageId, e);
-    }
-
-    public MessageCleanupException(String message)
-    {
-        super(message);
+        super(null, message, cause);
     }
 }

Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/NoConsumersException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/NoConsumersException.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/NoConsumersException.java (original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/NoConsumersException.java Mon May 21 08:11:23 2007
@@ -35,9 +35,9 @@
  */
 public class NoConsumersException extends RequiredDeliveryException
 {
-    public NoConsumersException(AMQMessage message)
+    public NoConsumersException(AMQMessage message, Throwable cause)
     {
-        super("Immediate delivery is not possible.", message);
+        super("Immediate delivery is not possible.", message, cause);
     }
 
     public AMQConstant getReplyCode()

Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/StorableMessageHandle.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/StorableMessageHandle.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/StorableMessageHandle.java (original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/StorableMessageHandle.java Mon May 21 08:11:23 2007
@@ -175,7 +175,7 @@
             }
         } catch (Exception e)
         {
-            throw new AMQException("PRoblem during message enqueue", e);
+            throw new AMQException(null, "PRoblem during message enqueue", e);
         }
     }
 
@@ -191,7 +191,7 @@
             }
         } catch (Exception e)
         {
-            throw new AMQException("PRoblem during message dequeue", e);
+            throw new AMQException(null, "PRoblem during message dequeue", e);
         }
     }
 

Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java (original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java Mon May 21 08:11:23 2007
@@ -108,7 +108,7 @@
         AMQChannel channel = protocolSession.getChannel(channelId);
         if (channel == null)
         {
-            throw new AMQException(AMQConstant.NOT_FOUND, "channel :" + channelId + " not found in protocol session");
+            throw new AMQException(AMQConstant.NOT_FOUND, "channel :" + channelId + " not found in protocol session", null);
         }
 
         this.channel = channel;

Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/DistributedTransactionalContext.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/DistributedTransactionalContext.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/DistributedTransactionalContext.java (original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/DistributedTransactionalContext.java Mon May 21 08:11:23 2007
@@ -87,7 +87,7 @@
                     _storeContext.setPayload(xid);
                 } catch (Exception e)
                 {
-                    throw new AMQException("Problem during transaction begin", e);
+                    throw new AMQException(null, "Problem during transaction begin", e);
                 }
             }
         }
@@ -105,7 +105,7 @@
             }
         } catch (Exception e)
         {
-            throw new AMQException("Problem during transaction commit", e);
+            throw new AMQException(null, "Problem during transaction commit", e);
         }
         finally
         {
@@ -125,7 +125,7 @@
             }
         } catch (Exception e)
         {
-            throw new AMQException("Problem during transaction rollback", e);
+            throw new AMQException(null, "Problem during transaction rollback", e);
         }
         finally
         {
@@ -152,7 +152,7 @@
             _transactionManager.getTransaction((Xid) _storeContext.getPayload()).addRecord(new EnqueueRecord(_storeContext, message, queue, deliverFirst));
         } catch (Exception e)
         {
-            throw new AMQException("Problem during transaction rollback", e);
+            throw new AMQException(null, "Problem during transaction rollback", e);
         }
     }
 
@@ -196,7 +196,7 @@
             {
                 if (!unacknowledgedMessageMap.contains(deliveryTag))
                 {
-                    throw new AMQException("Multiple ack on delivery tag " + deliveryTag + " not known for channel");
+                    throw new AMQException(null, "Multiple ack on delivery tag " + deliveryTag + " not known for channel", null);
                 }
 
                 LinkedList<UnacknowledgedMessage> acked = new LinkedList<UnacknowledgedMessage>();
@@ -219,7 +219,7 @@
             if (msg == null)
             {
                 _log.info("Single ack on delivery tag " + deliveryTag);
-                throw new AMQException("Single ack on delivery tag " + deliveryTag);
+                throw new AMQException(null, "Single ack on delivery tag " + deliveryTag, null);
             }
 
             if (_log.isDebugEnabled())
@@ -250,7 +250,7 @@
             _transactionManager.getTransaction((Xid) _storeContext.getPayload()).addRecord(new DequeueRecord());
         } catch (Exception e)
         {
-            throw new AMQException("Problem during message dequeue", e);
+            throw new AMQException(null, "Problem during message dequeue", e);
         }
     }
 

Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/LocalTransactionalContext.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/LocalTransactionalContext.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/LocalTransactionalContext.java (original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/LocalTransactionalContext.java Mon May 21 08:11:23 2007
@@ -126,7 +126,7 @@
     {
         if (!unacknowledgedMessageMap.contains(deliveryTag))
         {
-            throw new AMQException("Ack with delivery tag " + deliveryTag + " not known for channel");
+            throw new AMQException(null, "Ack with delivery tag " + deliveryTag + " not known for channel", null);
         }
     }
 

Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/NonTransactionalContext.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/NonTransactionalContext.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/NonTransactionalContext.java (original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/txn/NonTransactionalContext.java Mon May 21 08:11:23 2007
@@ -149,7 +149,7 @@
             {
                 if (!unacknowledgedMessageMap.contains(deliveryTag))
                 {
-                    throw new AMQException("Multiple ack on delivery tag " + deliveryTag + " not known for channel");
+                    throw new AMQException(null, "Multiple ack on delivery tag " + deliveryTag + " not known for channel", null);
                 }
 
                 LinkedList<UnacknowledgedMessage> acked = new LinkedList<UnacknowledgedMessage>();
@@ -182,8 +182,8 @@
             {
                 _log.info("Single ack on delivery tag " + deliveryTag + " not known for channel:" +
                           _channel.getChannelId());
-                throw new AMQException("Single ack on delivery tag " + deliveryTag + " not known for channel:" +
-                                       _channel.getChannelId());
+                throw new AMQException(null, "Single ack on delivery tag " + deliveryTag + " not known for channel:" +
+                                       _channel.getChannelId(), null);
             }
 
             if (!_browsedAcks.contains(deliveryTag))

Modified: incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/FileMessageFactory.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/FileMessageFactory.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/FileMessageFactory.java (original)
+++ incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/FileMessageFactory.java Mon May 21 08:11:23 2007
@@ -6,9 +6,9 @@
  * 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
@@ -19,12 +19,13 @@
 
 package org.apache.qpid.example.publisher;
 
-import org.apache.qpid.example.shared.FileUtils;
-import org.apache.qpid.example.shared.Statics;
-
 import java.io.*;
+
 import javax.jms.*;
 
+import org.apache.qpid.example.shared.FileUtils;
+import org.apache.qpid.example.shared.Statics;
+
 public class FileMessageFactory
 {
     protected final Session _session;
@@ -47,8 +48,7 @@
         }
         catch (IOException e)
         {
-            MessageFactoryException mfe = new MessageFactoryException(e.toString());
-            mfe.initCause(e);
+            MessageFactoryException mfe = new MessageFactoryException(e.toString(), e);
             throw mfe;
         }
     }
@@ -64,7 +64,8 @@
     {
         TextMessage msg = _session.createTextMessage();
         msg.setText(_payload);
-        msg.setStringProperty(Statics.FILENAME_PROPERTY,new File(_filename).getName());
+        msg.setStringProperty(Statics.FILENAME_PROPERTY, new File(_filename).getName());
+
         return msg;
     }
 
@@ -79,6 +80,7 @@
     {
         TextMessage msg = session.createTextMessage();
         msg.setText(textMsg);
+
         return msg;
     }
 
@@ -116,6 +118,7 @@
         catch (JMSException e)
         {
             e.printStackTrace(System.out);
+
             return e.toString();
         }
     }
@@ -124,13 +127,13 @@
     {
         try
         {
-            return m instanceof TextMessage && ((TextMessage) m).getText().equals(s);
+            return (m instanceof TextMessage) && ((TextMessage) m).getText().equals(s);
         }
         catch (JMSException e)
         {
             e.printStackTrace(System.out);
+
             return false;
         }
     }
 }
-

Modified: incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/MessageFactoryException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/MessageFactoryException.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/MessageFactoryException.java (original)
+++ incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/MessageFactoryException.java Mon May 21 08:11:23 2007
@@ -22,33 +22,8 @@
 
 public class MessageFactoryException extends Exception
 {
-
-    private int _errorCode;
-
-    public MessageFactoryException(String message)
-    {
-        super(message);
-    }
-
     public MessageFactoryException(String msg, Throwable t)
     {
         super(msg, t);
-    }
-
-    public MessageFactoryException(int errorCode, String msg, Throwable t)
-    {
-        super(msg + " [error code " + errorCode + ']', t);
-        _errorCode = errorCode;
-    }
-
-    public MessageFactoryException(int errorCode, String msg)
-    {
-        super(msg + " [error code " + errorCode + ']');
-        _errorCode = errorCode;
-    }
-
-    public int getErrorCode()
-    {
-        return _errorCode;
     }
 }

Modified: incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/UndeliveredMessageException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/UndeliveredMessageException.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/UndeliveredMessageException.java (original)
+++ incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/UndeliveredMessageException.java Mon May 21 08:11:23 2007
@@ -25,33 +25,8 @@
  */
 public class UndeliveredMessageException extends Exception
 {
-
-    private int _errorCode;
-
-    public UndeliveredMessageException(String message)
-    {
-        super(message);
-    }
-
     public UndeliveredMessageException(String msg, Throwable t)
     {
         super(msg, t);
-    }
-
-    public UndeliveredMessageException(int errorCode, String msg, Throwable t)
-    {
-        super(msg + " [error code " + errorCode + ']', t);
-        _errorCode = errorCode;
-    }
-
-    public UndeliveredMessageException(int errorCode, String msg)
-    {
-        super(msg + " [error code " + errorCode + ']');
-        _errorCode = errorCode;
-    }
-
-    public int getErrorCode()
-    {
-        return _errorCode;
     }
 }

Modified: incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/shared/ConnectionException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/shared/ConnectionException.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/shared/ConnectionException.java (original)
+++ incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/shared/ConnectionException.java Mon May 21 08:11:23 2007
@@ -22,33 +22,8 @@
 
 public class ConnectionException extends Exception
 {
-
-    private int _errorCode;
-
-    public ConnectionException(String message)
-    {
-        super(message);
-    }
-
     public ConnectionException(String msg, Throwable t)
     {
         super(msg, t);
-    }
-
-    public ConnectionException(int errorCode, String msg, Throwable t)
-    {
-        super(msg + " [error code " + errorCode + ']', t);
-        _errorCode = errorCode;
-    }
-
-    public ConnectionException(int errorCode, String msg)
-    {
-        super(msg + " [error code " + errorCode + ']');
-        _errorCode = errorCode;
-    }
-
-    public int getErrorCode()
-    {
-        return _errorCode;
     }
 }

Modified: incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/shared/ContextException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/shared/ContextException.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/shared/ContextException.java (original)
+++ incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/shared/ContextException.java Mon May 21 08:11:23 2007
@@ -22,33 +22,8 @@
 
 public class ContextException extends Exception
 {
-
-    private int _errorCode;
-
-    public ContextException(String message)
-    {
-        super(message);
-    }
-
     public ContextException(String msg, Throwable t)
     {
         super(msg, t);
-    }
-
-    public ContextException(int errorCode, String msg, Throwable t)
-    {
-        super(msg + " [error code " + errorCode + ']', t);
-        _errorCode = errorCode;
-    }
-
-    public ContextException(int errorCode, String msg)
-    {
-        super(msg + " [error code " + errorCode + ']');
-        _errorCode = errorCode;
-    }
-
-    public int getErrorCode()
-    {
-        return _errorCode;
     }
 }

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQAuthenticationException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQAuthenticationException.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQAuthenticationException.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQAuthenticationException.java Mon May 21 08:11:23 2007
@@ -35,8 +35,8 @@
  */
 public class AMQAuthenticationException extends AMQException
 {
-    public AMQAuthenticationException(AMQConstant error, String msg)
+    public AMQAuthenticationException(AMQConstant error, String msg, Throwable cause)
     {
-        super(error, msg);
+        super(error, msg, cause);
     }
 }

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java Mon May 21 08:11:23 2007
@@ -65,6 +65,7 @@
 import org.apache.qpid.jms.ConnectionListener;
 import org.apache.qpid.jms.ConnectionURL;
 import org.apache.qpid.jms.FailoverPolicy;
+import org.apache.qpid.protocol.AMQConstant;
 import org.apache.qpid.url.URLSyntaxException;
 
 public class AMQConnection extends Closeable implements Connection, QueueConnection, TopicConnection, Referenceable
@@ -96,8 +97,7 @@
     private AMQProtocolHandler _protocolHandler;
 
     /** Maps from session id (Integer) to AMQSession instance */
-    private final Map<Integer,AMQSession> _sessions = new LinkedHashMap<Integer,AMQSession>();
-
+    private final Map<Integer, AMQSession> _sessions = new LinkedHashMap<Integer, AMQSession>();
 
     private String _clientName;
 
@@ -225,6 +225,10 @@
         this(new AMQConnectionURL(connection), sslConfig);
     }
 
+    /**
+     * @todo Some horrible stuff going on here with setting exceptions to be non-null to detect if an exception
+     *       was thrown during the connection! Intention not clear. Use a flag anyway, not exceptions... Will fix soon.
+     */
     public AMQConnection(ConnectionURL connectionURL, SSLConfiguration sslConfig) throws AMQException
     {
         if (_logger.isInfoEnabled())
@@ -321,16 +325,20 @@
                 message = "Unable to Connect";
             }
 
-            AMQException e = new AMQConnectionFailureException(message);
+            AMQException e = new AMQConnectionFailureException(message, null);
 
             if (lastException != null)
             {
                 if (lastException instanceof UnresolvedAddressException)
                 {
-                    e = new AMQUnresolvedAddressException(message, _failoverPolicy.getCurrentBrokerDetails().toString());
+                    e = new AMQUnresolvedAddressException(message, _failoverPolicy.getCurrentBrokerDetails().toString(),
+                            null);
                 }
 
-                e.initCause(lastException);
+                if (e.getCause() != null)
+                {
+                    e.initCause(lastException);
+                }
             }
 
             throw e;
@@ -509,7 +517,7 @@
                             AMQSession session =
                                 new AMQSession(AMQConnection.this, channelId, transacted, acknowledgeMode, prefetchHigh,
                                     prefetchLow);
-                            //_protocolHandler.addSessionByChannel(channelId, session);
+                            // _protocolHandler.addSessionByChannel(channelId, session);
                             registerSession(channelId, session);
 
                             boolean success = false;
@@ -590,7 +598,7 @@
         catch (AMQException e)
         {
             deregisterSession(channelId);
-            throw new AMQException("Error reopening channel " + channelId + " after failover: " + e, e);
+            throw new AMQException(null, "Error reopening channel " + channelId + " after failover: " + e, e);
         }
     }
 
@@ -1047,7 +1055,6 @@
      */
     public void exceptionReceived(Throwable cause)
     {
-
         if (_logger.isDebugEnabled())
         {
             _logger.debug("exceptionReceived done by:" + Thread.currentThread().getName(), cause);
@@ -1060,11 +1067,18 @@
         }
         else
         {
+            AMQConstant code = null;
+
             if (cause instanceof AMQException)
             {
+                code = ((AMQException) cause).getErrorCode();
+            }
+
+            if (code != null)
+            {
                 je =
-                    new JMSException(Integer.toString(((AMQException) cause).getErrorCode().getCode()),
-                        "Exception thrown against " + toString() + ": " + cause);
+                    new JMSException(Integer.toString(code.getCode()), "Exception thrown against " + toString() + ": "
+                        + cause);
             }
             else
             {
@@ -1135,7 +1149,7 @@
         for (Iterator it = sessions.iterator(); it.hasNext();)
         {
             AMQSession s = (AMQSession) it.next();
-            //_protocolHandler.addSessionByChannel(s.getChannelId(), s);
+            // _protocolHandler.addSessionByChannel(s.getChannelId(), s);
             reopenChannel(s.getChannelId(), s.getDefaultPrefetchHigh(), s.getDefaultPrefetchLow(), s.getTransacted());
             s.resubscribe();
         }
@@ -1222,7 +1236,6 @@
     {
         _taskPool.execute(task);
     }
-
 
     public AMQSession getSession(int channelId)
     {

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQNoConsumersException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQNoConsumersException.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQNoConsumersException.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQNoConsumersException.java Mon May 21 08:11:23 2007
@@ -33,8 +33,8 @@
  */
 public class AMQNoConsumersException extends AMQUndeliveredException
 {
-    public AMQNoConsumersException(String msg, Object bounced)
+    public AMQNoConsumersException(String msg, Object bounced, Throwable cause)
     {
-        super(AMQConstant.NO_CONSUMERS, msg, bounced);
+        super(AMQConstant.NO_CONSUMERS, msg, bounced, cause);
     }
 }

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQNoRouteException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQNoRouteException.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQNoRouteException.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQNoRouteException.java Mon May 21 08:11:23 2007
@@ -33,8 +33,8 @@
  */
 public class AMQNoRouteException extends AMQUndeliveredException
 {
-    public AMQNoRouteException(String msg, Object bounced)
+    public AMQNoRouteException(String msg, Object bounced, Throwable cause)
     {
-        super(AMQConstant.NO_ROUTE, msg, bounced);
+        super(AMQConstant.NO_ROUTE, msg, bounced, cause);
     }
 }

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java Mon May 21 08:11:23 2007
@@ -781,7 +781,7 @@
             }
             else
             {
-                amqe = new AMQException("Closing session forcibly", e);
+                amqe = new AMQException(null, "Closing session forcibly", e);
             }
             _connection.deregisterSession(_channelId);
             closeProducersAndConsumers(amqe);
@@ -1928,15 +1928,15 @@
                             //@TODO should this be moved to an exception handler of sorts. Somewhere errors are converted to correct execeptions.
                             if (errorCode == AMQConstant.NO_CONSUMERS)
                             {
-                                _connection.exceptionReceived(new AMQNoConsumersException("Error: " + reason, bouncedMessage));
+                                _connection.exceptionReceived(new AMQNoConsumersException("Error: " + reason, bouncedMessage, null));
                             }
                             else if (errorCode == AMQConstant.NO_ROUTE)
                             {
-                                _connection.exceptionReceived(new AMQNoRouteException("Error: " + reason, bouncedMessage));
+                                _connection.exceptionReceived(new AMQNoRouteException("Error: " + reason, bouncedMessage, null));
                             }
                             else
                             {
-                                _connection.exceptionReceived(new AMQUndeliveredException(errorCode, "Error: " + reason, bouncedMessage));
+                                _connection.exceptionReceived(new AMQUndeliveredException(errorCode, "Error: " + reason, bouncedMessage, null));
                             }
 
                         }
@@ -2118,7 +2118,7 @@
         }
         catch (JMSException e) //thrown by getMessageSelector
         {
-            throw new AMQException(e.getMessage(), e);
+            throw new AMQException(null, e.getMessage(), e);
         }
     }
 

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/failover/FailoverHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/failover/FailoverHandler.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/failover/FailoverHandler.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/failover/FailoverHandler.java Mon May 21 08:11:23 2007
@@ -93,11 +93,11 @@
                 _amqProtocolHandler.setStateManager(existingStateManager);
                 if (_host != null)
                 {
-                    _amqProtocolHandler.getConnection().exceptionReceived(new AMQDisconnectedException("Redirect was vetoed by client"));
+                    _amqProtocolHandler.getConnection().exceptionReceived(new AMQDisconnectedException("Redirect was vetoed by client", null));
                 }
                 else
                 {
-                    _amqProtocolHandler.getConnection().exceptionReceived(new AMQDisconnectedException("Failover was vetoed by client"));
+                    _amqProtocolHandler.getConnection().exceptionReceived(new AMQDisconnectedException("Failover was vetoed by client", null));
                 }
                 _amqProtocolHandler.getFailoverLatch().countDown();
                 _amqProtocolHandler.setFailoverLatch(null);
@@ -124,7 +124,7 @@
                 _amqProtocolHandler.setStateManager(existingStateManager);
                 _amqProtocolHandler.getConnection().exceptionReceived(
                         new AMQDisconnectedException("Server closed connection and no failover " +
-                                "was successful"));
+                                "was successful", null));
             }
             else
             {

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java Mon May 21 08:11:23 2007
@@ -70,27 +70,27 @@
             }
             if (errorCode == AMQConstant.NO_CONSUMERS)
             {
-                throw new AMQNoConsumersException("Error: " + reason, null);
+                throw new AMQNoConsumersException("Error: " + reason, null, null);
             }
             else if (errorCode == AMQConstant.NO_ROUTE)
             {
-                throw new AMQNoRouteException("Error: " + reason, null);
+                throw new AMQNoRouteException("Error: " + reason, null, null);
             }
             else if (errorCode == AMQConstant.INVALID_ARGUMENT)
             {
                 _logger.debug("Broker responded with Invalid Argument.");
 
-                throw new org.apache.qpid.AMQInvalidArgumentException(String.valueOf(reason));
+                throw new org.apache.qpid.AMQInvalidArgumentException(String.valueOf(reason), null);
             }
             else if (errorCode == AMQConstant.INVALID_ROUTING_KEY)
             {
                 _logger.debug("Broker responded with Invalid Routing Key.");
 
-                throw new AMQInvalidRoutingKeyException(String.valueOf(reason));
+                throw new AMQInvalidRoutingKeyException(String.valueOf(reason), null);
             }
             else
             {
-                throw new AMQChannelClosedException(errorCode, "Error: " + reason);
+                throw new AMQChannelClosedException(errorCode, "Error: " + reason, null);
             }
 
         }

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionCloseMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionCloseMethodHandler.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionCloseMethodHandler.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionCloseMethodHandler.java Mon May 21 08:11:23 2007
@@ -77,14 +77,14 @@
                     //todo this is a bit of a fudge (could be conssidered such as each new connection needs a new state manager or at least a fresh state.
                     stateManager.changeState(AMQState.CONNECTION_NOT_STARTED);
 
-                    throw new AMQAuthenticationException(errorCode, reason == null ? null : reason.toString());
+                    throw new AMQAuthenticationException(errorCode, reason == null ? null : reason.toString(), null);
                 }
                 else
                 {
                     _logger.info("Connection close received with error code " + errorCode);
 
 
-                    throw new AMQConnectionClosedException(errorCode, "Error: " + reason);
+                    throw new AMQConnectionClosedException(errorCode, "Error: " + reason, null);
                 }
             }
         }

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionSecureMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionSecureMethodHandler.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionSecureMethodHandler.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionSecureMethodHandler.java Mon May 21 08:11:23 2007
@@ -46,7 +46,7 @@
         SaslClient client = protocolSession.getSaslClient();
         if (client == null)
         {
-            throw new AMQException("No SASL client set up - cannot proceed with authentication");
+            throw new AMQException(null, "No SASL client set up - cannot proceed with authentication", null);
         }
 
         ConnectionSecureBody body = (ConnectionSecureBody) evt.getMethod();
@@ -65,7 +65,7 @@
         }
         catch (SaslException e)
         {
-            throw new AMQException("Error processing SASL challenge: " + e, e);
+            throw new AMQException(null, "Error processing SASL challenge: " + e, e);
         }
 
 

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java Mon May 21 08:11:23 2007
@@ -92,7 +92,7 @@
 
                 if (body.mechanisms == null)
                 {
-                    throw new AMQException("mechanism not specified in ConnectionStart method frame");
+                    throw new AMQException(null, "mechanism not specified in ConnectionStart method frame", null);
                 }
                 else
                 {
@@ -102,7 +102,7 @@
 
                 if (mechanism == null)
                 {
-                    throw new AMQException("No supported security mechanism found, passed: " + new String(body.mechanisms));
+                    throw new AMQException(null, "No supported security mechanism found, passed: " + new String(body.mechanisms), null);
                 }
 
                 byte[] saslResponse;
@@ -113,10 +113,9 @@
                                               createCallbackHandler(mechanism, protocolSession));
                     if (sc == null)
                     {
-                        throw new AMQException(
-                            "Client SASL configuration error: no SaslClient could be created for mechanism " + mechanism
+                        throw new AMQException(null, "Client SASL configuration error: no SaslClient could be created for mechanism " + mechanism
                             + ". Please ensure all factories are registered. See DynamicSaslRegistrar for "
-                            + " details of how to register non-standard SASL client providers.");
+                            + " details of how to register non-standard SASL client providers.", null);
                     }
 
                     protocolSession.setSaslClient(sc);
@@ -125,12 +124,12 @@
                 catch (SaslException e)
                 {
                     protocolSession.setSaslClient(null);
-                    throw new AMQException("Unable to create SASL client: " + e, e);
+                    throw new AMQException(null, "Unable to create SASL client: " + e, e);
                 }
 
                 if (body.locales == null)
                 {
-                    throw new AMQException("Locales is not defined in Connection Start method");
+                    throw new AMQException(null, "Locales is not defined in Connection Start method", null);
                 }
 
                 final String locales = new String(body.locales, "utf8");
@@ -142,7 +141,7 @@
                 }
                 else
                 {
-                    throw new AMQException("No locales sent from server, passed: " + locales);
+                    throw new AMQException(null, "No locales sent from server, passed: " + locales, null);
                 }
 
                 stateManager.changeState(AMQState.CONNECTION_NOT_TUNED);
@@ -170,7 +169,7 @@
             }
             catch (UnsupportedEncodingException e)
             {
-                throw new AMQException("Unable to decode data: " + e, e);
+                throw new AMQException(null, "Unable to decode data: " + e, e);
             }
         }
         else
@@ -235,7 +234,7 @@
         }
         catch (Exception e)
         {
-            throw new AMQException("Unable to create callback handler: " + e, e);
+            throw new AMQException(null, "Unable to create callback handler: " + e, e);
         }
     }
 }

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessage.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessage.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessage.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessage.java Mon May 21 08:11:23 2007
@@ -67,7 +67,7 @@
         }                                                        
         catch (JMSException je)
         {
-            throw new AMQException("Error populating MapMessage from ByteBuffer", je);
+            throw new AMQException(null, "Error populating MapMessage from ByteBuffer", je);
             
         }
 

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/MessageFactoryRegistry.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/MessageFactoryRegistry.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/MessageFactoryRegistry.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/MessageFactoryRegistry.java Mon May 21 08:11:23 2007
@@ -99,7 +99,7 @@
         MessageFactory mf = _mimeShortStringToFactoryMap.get(contentTypeShortString);
         if (mf == null)
         {
-            throw new AMQException("Unsupport MIME type of " + properties.getContentTypeAsString());
+            throw new AMQException(null, "Unsupport MIME type of " + properties.getContentTypeAsString(), null);
         }
         else
         {
@@ -117,7 +117,7 @@
         MessageFactory mf = _mimeStringToFactoryMap.get(mimeType);
         if (mf == null)
         {
-            throw new AMQException("Unsupport MIME type of " + mimeType);
+            throw new AMQException(null, "Unsupport MIME type of " + mimeType, null);
         }
         else
         {

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java Mon May 21 08:11:23 2007
@@ -195,7 +195,7 @@
                     _logger.info("sessionClose() not allowed to failover");
                     _connection.exceptionReceived(
                             new AMQDisconnectedException("Server closed connection and reconnection " +
-                                                         "not permitted."));
+                                                         "not permitted.", null));
                 }
                 else
                 {
@@ -263,7 +263,7 @@
             _logger.error("Exception caught by protocol handler: " + cause, cause);
             // we notify the state manager of the error in case we have any clients waiting on a state
             // change. Those "waiters" will be interrupted and can handle the exception
-            AMQException amqe = new AMQException("Protocol handler error: " + cause, cause);
+            AMQException amqe = new AMQException(null, "Protocol handler error: " + cause, cause);
             propagateExceptionToWaiters(amqe);
             _connection.exceptionReceived(cause);
         }
@@ -334,7 +334,7 @@
                     }
                     if (!wasAnyoneInterested)
                     {
-                        throw new AMQException("AMQMethodEvent " + evt + " was not processed by any listener.  Listeners:" + _frameListeners);
+                        throw new AMQException(null, "AMQMethodEvent " + evt + " was not processed by any listener.  Listeners:" + _frameListeners, null);
                     }
                 }
                 catch (AMQException e)

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java Mon May 21 08:11:23 2007
@@ -238,13 +238,12 @@
         UnprocessedMessage msg = (UnprocessedMessage) _channelId2UnprocessedMsgMap.get(channelId);
         if (msg == null)
         {
-            throw new AMQException("Error: received content header without having received a BasicDeliver frame first");
+            throw new AMQException(null, "Error: received content header without having received a BasicDeliver frame first", null);
         }
 
         if (msg.getContentHeader() != null)
         {
-            throw new AMQException(
-                "Error: received duplicate content header or did not receive correct number of content body frames");
+            throw new AMQException(null, "Error: received duplicate content header or did not receive correct number of content body frames", null);
         }
 
         msg.setContentHeader(contentHeader);
@@ -259,13 +258,13 @@
         UnprocessedMessage msg = (UnprocessedMessage) _channelId2UnprocessedMsgMap.get(channelId);
         if (msg == null)
         {
-            throw new AMQException("Error: received content body without having received a JMSDeliver frame first");
+            throw new AMQException(null, "Error: received content body without having received a JMSDeliver frame first", null);
         }
 
         if (msg.getContentHeader() == null)
         {
             _channelId2UnprocessedMsgMap.remove(channelId);
-            throw new AMQException("Error: received content body without having received a ContentHeader frame first");
+            throw new AMQException(null, "Error: received content body without having received a ContentHeader frame first", null);
         }
 
         /*try
@@ -365,11 +364,11 @@
             final AMQSession session = getSession(channelId);
             try
             {
-                session.closed(new AMQException(code, text));
+                session.closed(new AMQException(code, text, null));
             }
             catch (JMSException e)
             {
-                throw new AMQException("JMSException received while closing session", e);
+                throw new AMQException(null, "JMSException received while closing session", e);
             }
 
             return true;

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/BlockingMethodFrameListener.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/BlockingMethodFrameListener.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/BlockingMethodFrameListener.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/BlockingMethodFrameListener.java Mon May 21 08:11:23 2007
@@ -109,7 +109,7 @@
                         _lock.wait(timeout);
                         if (!_ready)
                         {
-                            _error = new AMQTimeoutException("Server did not respond in a timely fashion");
+                            _error = new AMQTimeoutException("Server did not respond in a timely fashion", null);
                             _ready = true;
                         }
                     }
@@ -138,7 +138,7 @@
             }
             else
             {
-                throw new AMQException("Woken up due to " + _error.getClass(), _error);
+                throw new AMQException(null, "Woken up due to " + _error.getClass(), _error);
             }
         }
 

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/state/AMQStateManager.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/state/AMQStateManager.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/state/AMQStateManager.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/state/AMQStateManager.java Mon May 21 08:11:23 2007
@@ -248,7 +248,7 @@
             if (_currentState != s)
             {
                 _logger.warn("State not achieved within permitted time.  Current state " + _currentState + ", desired state: " + s);
-                throw new AMQException("State not achieved within permitted time.  Current state " + _currentState + ", desired state: " + s);
+                throw new AMQException(null, "State not achieved within permitted time.  Current state " + _currentState + ", desired state: " + s, null);
             }
         }
 

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/state/StateWaiter.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/state/StateWaiter.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/state/StateWaiter.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/state/StateWaiter.java Mon May 21 08:11:23 2007
@@ -76,7 +76,7 @@
             }
             else
             {
-                throw new AMQException("Error: " + _throwable, _throwable); // FIXME: this will wrap FailoverException in throwable which will prevent it being caught.
+                throw new AMQException(null, "Error: " + _throwable, _throwable); // FIXME: this will wrap FailoverException in throwable which will prevent it being caught.
             }
         }
     }

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/transport/AMQNoTransportForProtocolException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/transport/AMQNoTransportForProtocolException.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/transport/AMQNoTransportForProtocolException.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/transport/AMQNoTransportForProtocolException.java Mon May 21 08:11:23 2007
@@ -31,19 +31,16 @@
  * <tr><th> Responsibilities <th> Collaborations
  * <tr><td> Represent absence of a transport medium.
  * </table>
+ *
+ * @todo Error code never used. This is not an AMQException.
  */
 public class AMQNoTransportForProtocolException extends AMQTransportConnectionException
 {
     BrokerDetails _details;
 
-    public AMQNoTransportForProtocolException(BrokerDetails details)
+    public AMQNoTransportForProtocolException(BrokerDetails details, String message, Throwable cause)
     {
-        this(details, "No Transport exists for specified broker protocol");
-    }
-
-    public AMQNoTransportForProtocolException(BrokerDetails details, String message)
-    {
-        super(null, message, null);
+        super(null, message, cause);
 
         _details = details;
     }

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/transport/AMQTransportConnectionException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/transport/AMQTransportConnectionException.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/transport/AMQTransportConnectionException.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/transport/AMQTransportConnectionException.java Mon May 21 08:11:23 2007
@@ -31,6 +31,8 @@
  * <tr><th> Responsibilities <th> Collaborations
  * <tr><td> Represent failure to connect through the transport medium.
  * </table>
+ *
+ * @todo Error code never used. This is not an AMQException.
  */
 public class AMQTransportConnectionException extends AMQException
 {

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/transport/TransportConnection.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/transport/TransportConnection.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/transport/TransportConnection.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/transport/TransportConnection.java Mon May 21 08:11:23 2007
@@ -67,7 +67,7 @@
 
         if (transport == -1)
         {
-            throw new AMQNoTransportForProtocolException(details);
+            throw new AMQNoTransportForProtocolException(details, null, null);
         }
 
         if (transport == _currentInstance)

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/vmbroker/AMQVMBrokerCreationException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/vmbroker/AMQVMBrokerCreationException.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/vmbroker/AMQVMBrokerCreationException.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/vmbroker/AMQVMBrokerCreationException.java Mon May 21 08:11:23 2007
@@ -30,20 +30,12 @@
  * <tr><th> Responsibilities <th> Collaborations
  * <tr><td> Represent failure to create an in VM broker.
  * </table>
+ *
+ * @todo Error code never used. This is not an AMQException.
  */
 public class AMQVMBrokerCreationException extends AMQTransportConnectionException
 {
     private int _port;
-
-    /**
-     * @param port
-     *
-     * @deprecated
-     */
-    public AMQVMBrokerCreationException(int port)
-    {
-        this(null, port, "Unable to create vm broker", null);
-    }
 
     public AMQVMBrokerCreationException(AMQConstant errorCode, int port, String message, Throwable cause)
     {

Modified: incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseMethodHandlerNoCloseOk.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseMethodHandlerNoCloseOk.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseMethodHandlerNoCloseOk.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseMethodHandlerNoCloseOk.java Mon May 21 08:11:23 2007
@@ -67,27 +67,27 @@
             _logger.error("Channel close received with errorCode " + errorCode + ", and reason " + reason);
             if (errorCode == AMQConstant.NO_CONSUMERS)
             {
-                throw new AMQNoConsumersException("Error: " + reason, null);
+                throw new AMQNoConsumersException("Error: " + reason, null, null);
             }
             else if (errorCode == AMQConstant.NO_ROUTE)
             {
-                throw new AMQNoRouteException("Error: " + reason, null);
+                throw new AMQNoRouteException("Error: " + reason, null, null);
             }
             else if (errorCode == AMQConstant.INVALID_ARGUMENT)
             {
                 _logger.debug("Broker responded with Invalid Argument.");
 
-                throw new AMQInvalidArgumentException(String.valueOf(reason));
+                throw new AMQInvalidArgumentException(String.valueOf(reason), null);
             }
             else if (errorCode == AMQConstant.INVALID_ROUTING_KEY)
             {
                 _logger.debug("Broker responded with Invalid Routing Key.");
 
-                throw new AMQInvalidRoutingKeyException(String.valueOf(reason));
+                throw new AMQInvalidRoutingKeyException(String.valueOf(reason), null);
             }
             else
             {
-                throw new AMQChannelClosedException(errorCode, "Error: " + reason);
+                throw new AMQChannelClosedException(errorCode, "Error: " + reason, null);
             }
 
         }

Modified: incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/AMQConnectionWaitException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/AMQConnectionWaitException.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/AMQConnectionWaitException.java (original)
+++ incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/AMQConnectionWaitException.java Mon May 21 08:11:23 2007
@@ -34,9 +34,8 @@
  */
 public class AMQConnectionWaitException extends AMQException
 {
-    public AMQConnectionWaitException(String s, Throwable e)
+    public AMQConnectionWaitException(String s, Throwable cause)
     {
-        super(s, e);
-
+        super(null, s, cause);
     }
 }

Modified: incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/AMQUnexpectedBodyTypeException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/AMQUnexpectedBodyTypeException.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/AMQUnexpectedBodyTypeException.java (original)
+++ incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/AMQUnexpectedBodyTypeException.java Mon May 21 08:11:23 2007
@@ -39,8 +39,9 @@
  */
 public class AMQUnexpectedBodyTypeException extends AMQException
 {
-    public AMQUnexpectedBodyTypeException(Class<? extends AMQBody> expectedClass, AMQBody body)
+    public AMQUnexpectedBodyTypeException(Class<? extends AMQBody> expectedClass, AMQBody body, Throwable cause)
     {
-        super("Unexpected body type.  Expected: " + expectedClass.getName() + "; got: " + body.getClass().getName());
+        super(null, "Unexpected body type.  Expected: " + expectedClass.getName() + "; got: " + body.getClass().getName(),
+            cause);
     }
 }

Modified: incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/AMQUnexpectedFrameTypeException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/AMQUnexpectedFrameTypeException.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/AMQUnexpectedFrameTypeException.java (original)
+++ incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/AMQUnexpectedFrameTypeException.java Mon May 21 08:11:23 2007
@@ -38,8 +38,8 @@
  */
 public class AMQUnexpectedFrameTypeException extends AMQException
 {
-    public AMQUnexpectedFrameTypeException(String s)
+    public AMQUnexpectedFrameTypeException(String s, Throwable cause)
     {
-        super(s);
+        super(null, s, cause);
     }
 }

Modified: incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/ClusteredProtocolHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/ClusteredProtocolHandler.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/ClusteredProtocolHandler.java (original)
+++ incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/ClusteredProtocolHandler.java Mon May 21 08:11:23 2007
@@ -107,7 +107,7 @@
                 buffer(session, msg);
                 break;
             default:
-                throw new AMQException("Received message while in state: " + state);
+                throw new AMQException(null, "Received message while in state: " + state, null);
         }
         JoinState latest = _groupMgr.getState();
         if (!latest.equals(state))

Modified: incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/DefaultGroupManager.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/DefaultGroupManager.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/DefaultGroupManager.java (original)
+++ incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/DefaultGroupManager.java Mon May 21 08:11:23 2007
@@ -176,7 +176,7 @@
         }
         catch (Exception e)
         {
-            throw new AMQException("Could not connect to leader: " + e, e);
+            throw new AMQException(null, "Could not connect to leader: " + e, e);
         }
     }
 
@@ -259,7 +259,7 @@
         catch (Exception e)
         {
             e.printStackTrace();
-            throw new AMQException("Could not connect to prospect: " + e, e);
+            throw new AMQException(null, "Could not connect to prospect: " + e, e);
         }
     }
 

Modified: incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/MinaBrokerProxy.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/MinaBrokerProxy.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/MinaBrokerProxy.java (original)
+++ incubator/qpid/trunk/qpid/java/cluster/src/main/java/org/apache/qpid/server/cluster/MinaBrokerProxy.java Mon May 21 08:11:23 2007
@@ -207,7 +207,7 @@
         }
         else
         {
-            throw new AMQUnexpectedBodyTypeException(AMQMethodBody.class, body);
+            throw new AMQUnexpectedBodyTypeException(AMQMethodBody.class, body, null);
         }
     }
 
@@ -260,7 +260,7 @@
             }
             else
             {
-                throw new AMQUnexpectedFrameTypeException("Received message of unrecognised type: " + object);
+                throw new AMQUnexpectedFrameTypeException("Received message of unrecognised type: " + object, null);
             }
         }
 

Modified: incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQChannelClosedException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQChannelClosedException.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQChannelClosedException.java (original)
+++ incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQChannelClosedException.java Mon May 21 08:11:23 2007
@@ -34,8 +34,8 @@
  */
 public class AMQChannelClosedException extends AMQException
 {
-    public AMQChannelClosedException(AMQConstant errorCode, String msg)
+    public AMQChannelClosedException(AMQConstant errorCode, String msg, Throwable cause)
     {
-        super(errorCode, msg);
+        super(errorCode, msg, cause);
     }
 }

Modified: incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQChannelException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQChannelException.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQChannelException.java (original)
+++ incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQChannelException.java Mon May 21 08:11:23 2007
@@ -7,9 +7,9 @@
  * 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
@@ -39,22 +39,17 @@
 {
     private final int _classId;
     private final int _methodId;
-    /* AMQP version for which exception ocurred */
+
+    /** AMQP version for which exception ocurred, major code. */
     private final byte major;
-    private final byte minor;
 
-    public AMQChannelException(AMQConstant errorCode, String msg, int classId, int methodId, byte major, byte minor, Throwable t)
-    {
-        super(errorCode, msg, t);
-        _classId = classId;
-        _methodId = methodId;
-        this.major = major;
-        this.minor = minor;
-    }
+    /** AMQP version for which exception ocurred, minor code. */
+    private final byte minor;
 
-    public AMQChannelException(AMQConstant errorCode, String msg, int classId, int methodId, byte major, byte minor)
+    public AMQChannelException(AMQConstant errorCode, String msg, int classId, int methodId, byte major, byte minor,
+        Throwable cause)
     {
-        super(errorCode, msg);
+        super(errorCode, msg, cause);
         _classId = classId;
         _methodId = methodId;
         this.major = major;
@@ -63,6 +58,7 @@
 
     public AMQFrame getCloseFrame(int channel)
     {
-        return ChannelCloseBody.createAMQFrame(channel, major, minor, _classId, _methodId, getErrorCode().getCode(), new AMQShortString(getMessage()));
+        return ChannelCloseBody.createAMQFrame(channel, major, minor, _classId, _methodId, getErrorCode().getCode(),
+                new AMQShortString(getMessage()));
     }
 }

Modified: incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionClosedException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionClosedException.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionClosedException.java (original)
+++ incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionClosedException.java Mon May 21 08:11:23 2007
@@ -34,8 +34,8 @@
  */
 public class AMQConnectionClosedException extends AMQException
 {
-    public AMQConnectionClosedException(AMQConstant errorCode, String msg)
+    public AMQConnectionClosedException(AMQConstant errorCode, String msg, Throwable cause)
     {
-        super(errorCode, msg);
+        super(errorCode, msg, cause);
     }
 }

Modified: incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionException.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionException.java (original)
+++ incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionException.java Mon May 21 08:11:23 2007
@@ -40,24 +40,19 @@
 {
     private final int _classId;
     private final int _methodId;
-    /* AMQP version for which exception ocurred */
+
+    /** AMQP version for which exception ocurred, major code. */
     private final byte major;
+
+    /** AMQP version for which exception ocurred, minor code. */
     private final byte minor;
+
     boolean _closeConnetion;
 
     public AMQConnectionException(AMQConstant errorCode, String msg, int classId, int methodId, byte major, byte minor,
-        Throwable t)
+        Throwable cause)
     {
-        super(errorCode, msg, t);
-        _classId = classId;
-        _methodId = methodId;
-        this.major = major;
-        this.minor = minor;
-    }
-
-    public AMQConnectionException(AMQConstant errorCode, String msg, int classId, int methodId, byte major, byte minor)
-    {
-        super(errorCode, msg);
+        super(errorCode, msg, cause);
         _classId = classId;
         _methodId = methodId;
         this.major = major;
@@ -69,5 +64,4 @@
         return ConnectionCloseBody.createAMQFrame(channel, major, minor, _classId, _methodId, getErrorCode().getCode(),
                 new AMQShortString(getMessage()));
     }
-
 }

Modified: incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionFailureException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionFailureException.java?view=diff&rev=540165&r1=540164&r2=540165
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionFailureException.java (original)
+++ incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionFailureException.java Mon May 21 08:11:23 2007
@@ -12,8 +12,8 @@
  */
 public class AMQConnectionFailureException extends AMQException
 {
-    public AMQConnectionFailureException(String message)
+    public AMQConnectionFailureException(String message, Throwable cause)
     {
-        super(message);
+        super(null, message, cause);
     }
 }