From cd62dd33516f7119e560d9ad9f1dbf8ad4558ab1 Mon Sep 17 00:00:00 2001 From: Rajith Muditha Attapattu Date: Mon, 16 Jul 2012 17:40:50 +0000 Subject: QPID-3575 SessionExceptions (0-10 code path) are now marked as soft errors. When a Session receives an exception it is closed and the exception is notified via the ConnectionListener as well. However the exception is marked as a soft-error, therefore the connection will not be closed. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1362161 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/org/apache/qpid/AMQException.java | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'qpid/java/common') diff --git a/qpid/java/common/src/main/java/org/apache/qpid/AMQException.java b/qpid/java/common/src/main/java/org/apache/qpid/AMQException.java index 86d439d269..2d54e35191 100644 --- a/qpid/java/common/src/main/java/org/apache/qpid/AMQException.java +++ b/qpid/java/common/src/main/java/org/apache/qpid/AMQException.java @@ -40,6 +40,8 @@ public class AMQException extends Exception /** Holds the AMQ error code constant associated with this exception. */ private AMQConstant _errorCode; + private boolean _isHardError; + /** * Creates an exception with an optional error code, optional message and optional underlying cause. * @@ -48,9 +50,25 @@ public class AMQException extends Exception * @param cause The underlying cause of the exception. May be null if not to be set. */ public AMQException(AMQConstant errorCode, String msg, Throwable cause) + { + // isHardError is defaulted to true to avoid unnessacery modification to + // existing code. + this(errorCode,true,msg,cause); + } + + /** + * Creates an exception with an optional error code, optional message and optional underlying cause. + * + * @param errorCode The error code. May be null if not to be set. + * @param isHardError Denotes if the underlying error is considered a hard error. + * @param msg The exception message. May be null if not to be set. + * @param cause The underlying cause of the exception. May be null if not to be set. + */ + public AMQException(AMQConstant errorCode, boolean isHardError, String msg, Throwable cause) { super(((msg == null) ? "" : msg), cause); _errorCode = errorCode; + _isHardError = isHardError; } /* @@ -92,7 +110,7 @@ public class AMQException extends Exception public boolean isHardError() { - return true; + return _isHardError; } /** -- cgit v1.2.1