diff options
author | Keith Wall <kwall@apache.org> | 2015-02-25 08:47:18 +0000 |
---|---|---|
committer | Keith Wall <kwall@apache.org> | 2015-02-25 08:47:18 +0000 |
commit | 65f4c572e9bf9a25c8657a72d14fed7cd05b46f7 (patch) | |
tree | 02cfb6518234b2ce2ab6b1b354acfec4a7530e5e | |
parent | fb03abb7226ab42a6090a967c1748373c3d57e21 (diff) | |
download | qpid-python-65f4c572e9bf9a25c8657a72d14fed7cd05b46f7.tar.gz |
QPID-6411: [AMQP 1.0 JMS Client ] NPE during session#unsubscribe is link is refused but detach contains no error condition
svn merge -c 1662051 https://svn.apache.org/repos/asf/qpid/trunk
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/0.32@1662184 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Receiver.java | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Receiver.java b/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Receiver.java index be43601e63..5d4374fec5 100644 --- a/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Receiver.java +++ b/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Receiver.java @@ -38,8 +38,10 @@ import org.apache.qpid.amqp_1_0.transport.ReceivingLinkListener; import org.apache.qpid.amqp_1_0.type.AmqpErrorException; import org.apache.qpid.amqp_1_0.type.Binary; import org.apache.qpid.amqp_1_0.type.DeliveryState; +import org.apache.qpid.amqp_1_0.type.ErrorCondition; import org.apache.qpid.amqp_1_0.type.Outcome; import org.apache.qpid.amqp_1_0.type.Section; +import org.apache.qpid.amqp_1_0.type.Symbol; import org.apache.qpid.amqp_1_0.type.UnsignedInteger; import org.apache.qpid.amqp_1_0.type.messaging.Accepted; import org.apache.qpid.amqp_1_0.type.messaging.Modified; @@ -58,6 +60,20 @@ import org.apache.qpid.amqp_1_0.type.transport.Transfer; public class Receiver implements DeliveryStateHandler { + private static final ErrorCondition UNKNOWN_ERROR_CONDITION = new ErrorCondition() + { + @Override + public Symbol getValue() + { + return Symbol.valueOf("Unknown"); + } + + @Override + public String toString() + { + return getValue().toString(); + } + }; private ReceivingLinkEndpoint _endpoint; private int _id; private static final UnsignedInteger DEFAULT_INITIAL_CREDIT = UnsignedInteger.valueOf(100); @@ -196,16 +212,20 @@ public class Receiver implements DeliveryStateHandler { throw new ConnectionErrorException(AmqpError.INTERNAL_ERROR,"Interrupted while waiting for detach following failed attach"); } - throw new ConnectionErrorException(getError().getCondition(), - getError().getDescription() == null - ? "AMQP error: '" + getError().getCondition().toString() + + Error error = getError() == null + ? new Error(UNKNOWN_ERROR_CONDITION, "Unknown") + : getError(); + + + ErrorCondition condition = error.getCondition() == null ? UNKNOWN_ERROR_CONDITION : error.getCondition(); + + throw new ConnectionErrorException(condition, + error.getDescription() == null + ? "AMQP error: '" + condition.toString() + "' when attempting to create a receiver" + (source != null ? " from: '" + source.getAddress() +"'" : "") - : getError().getDescription()); - } - else - { - + : error.getDescription()); } } |