diff options
author | Robert Gemmell <robbie@apache.org> | 2010-05-24 14:18:15 +0000 |
---|---|---|
committer | Robert Gemmell <robbie@apache.org> | 2010-05-24 14:18:15 +0000 |
commit | dbad61e399419976bde5fd8ebec0f7db5a3d2dbd (patch) | |
tree | 156c7abceefd586131470ccf04e4ae3c31d6f2ba /qpid/java/common | |
parent | d433e14eb2d7c32b2b7b043f0ecbae1951c3296c (diff) | |
download | qpid-python-dbad61e399419976bde5fd8ebec0f7db5a3d2dbd.tar.gz |
QPID-2608: AMQPException messages contain duplicate error code
Applied patch from Andrew Kennedy <andrew.international@gmail.com>
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@947649 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/common')
-rw-r--r-- | qpid/java/common/src/main/java/org/apache/qpid/AMQException.java | 18 |
1 files changed, 10 insertions, 8 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 be335c5dba..b0c6fccc9e 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 @@ -20,8 +20,6 @@ */ package org.apache.qpid; -import javax.management.JMException; - import org.apache.qpid.protocol.AMQConstant; /** @@ -50,7 +48,7 @@ public class AMQException extends Exception */ public AMQException(AMQConstant errorCode, String msg, Throwable cause) { - super(((msg == null) ? "" : msg) + ((errorCode == null) ? "" : (" [error code " + errorCode + "]")), cause); + super(((msg == null) ? "" : msg), cause); _errorCode = errorCode; } @@ -58,13 +56,13 @@ public class AMQException extends Exception * Deprecated constructors brought from M2.1 */ @Deprecated - public AMQException (String msg) + public AMQException(String msg) { this(null, (msg == null) ? "" : msg); } @Deprecated - public AMQException (AMQConstant errorCode, String msg) + public AMQException(AMQConstant errorCode, String msg) { this(errorCode, (msg == null) ? "" : msg, null); } @@ -75,6 +73,11 @@ public class AMQException extends Exception this(null, msg, cause); } + @Override + public String toString() + { + return getClass().getName() + ": " + getMessage() + (_errorCode == null ? "" : " [error code " + _errorCode + "]"); + } /** * Gets the AMQ protocol exception code associated with this exception. @@ -94,11 +97,10 @@ public class AMQException extends Exception /** * Rethrown this exception as a new exception. * - * Attempt to create a new exception of the same class if they hav the default constructor of: + * Attempt to create a new exception of the same class if they have the default constructor of: * {AMQConstant.class, String.class, Throwable.class} - * + * <p> * Individual subclasses may override as requried to create a new instance. - * */ public AMQException cloneForCurrentThread() { |