summaryrefslogtreecommitdiff
path: root/qpid/java/common
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2012-07-16 17:40:50 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2012-07-16 17:40:50 +0000
commitcd62dd33516f7119e560d9ad9f1dbf8ad4558ab1 (patch)
tree84e4aecca1b5e24cdd7037d1549e08fa2c68b141 /qpid/java/common
parent551cf1ecc6072d41ffce35ed94746555163244d0 (diff)
downloadqpid-python-cd62dd33516f7119e560d9ad9f1dbf8ad4558ab1.tar.gz
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
Diffstat (limited to 'qpid/java/common')
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpid/AMQException.java20
1 files changed, 19 insertions, 1 deletions
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.
*
@@ -49,8 +51,24 @@ public class AMQException extends Exception
*/
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;
}
/**