From fed24c803a9c901f3fdc680c136230326a166580 Mon Sep 17 00:00:00 2001 From: Aidan Skinner Date: Thu, 3 Jul 2008 14:33:10 +0000 Subject: QPID-962 Exception handling was... unpleasing... Fix up of patch from rhs AMQConnection.java: Refactor listener and stack exceptions in a list. Add get lastException, which can now be any Exception. Don't set connected, let the delegate decide. AMQConnectionDelegate_8_0.java, AMQConnectionDelete_0_10.java: set _connected to true if we suceed AMQProtocolHandler.java: attainState can now throw any sort of Exception AMQStateManager.java: attainState can now throw any Exception ConnectionTest.java: check that exception cause is not null AMQConnectionFailureException.java: Add ability to store a Collection of Exceptions in case there are multiple possible causes of the failure. Which there shouldn't be, but it can happen. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@673688 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/qpid/AMQConnectionFailureException.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'qpid/java/common/src/main') diff --git a/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionFailureException.java b/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionFailureException.java index 6cdd57d6f2..fa69f7f91b 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionFailureException.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/AMQConnectionFailureException.java @@ -21,6 +21,10 @@ package org.apache.qpid; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; + import org.apache.qpid.protocol.AMQConstant; /** @@ -35,6 +39,8 @@ import org.apache.qpid.protocol.AMQConstant; */ public class AMQConnectionFailureException extends AMQException { + Collection _exceptions; + public AMQConnectionFailureException(String message, Throwable cause) { super(null, message, cause); @@ -44,4 +50,16 @@ public class AMQConnectionFailureException extends AMQException { super(errorCode, message, cause); } + + public AMQConnectionFailureException(String message, Collection exceptions) + { + // Blah, I hate ? but java won't let super() be anything other than the first thing, sorry... + super (null, message, exceptions.isEmpty() ? null : exceptions.iterator().next()); + this._exceptions = exceptions; + } + + public Collection getLinkedExceptions() + { + return _exceptions; + } } -- cgit v1.2.1