diff options
author | Robert Godfrey <rgodfrey@apache.org> | 2014-09-16 10:55:24 +0000 |
---|---|---|
committer | Robert Godfrey <rgodfrey@apache.org> | 2014-09-16 10:55:24 +0000 |
commit | 6f41ea5ce5e1238b23d214b27730ad0cf66c5b37 (patch) | |
tree | e72f051ed1bebadb8a82b9d28c99ac696f4f75b7 | |
parent | 82099c7c8e3e721a527ca5401f57706eb488a574 (diff) | |
download | qpid-python-6f41ea5ce5e1238b23d214b27730ad0cf66c5b37.tar.gz |
QPID-6103 : Fix NPE which occurred when first flow was sent before receiving initial flow from partner
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1625241 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/transport/SessionEndpoint.java | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/transport/SessionEndpoint.java b/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/transport/SessionEndpoint.java index bc961cb86e..0f37518773 100644 --- a/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/transport/SessionEndpoint.java +++ b/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/transport/SessionEndpoint.java @@ -772,10 +772,13 @@ public class SessionEndpoint } public void sendFlow(final Flow flow) { - final int nextIncomingId = _nextIncomingTransferId.intValue(); - flow.setNextIncomingId(UnsignedInteger.valueOf(nextIncomingId)); + if(_nextIncomingTransferId != null) + { + final int nextIncomingId = _nextIncomingTransferId.intValue(); + flow.setNextIncomingId(UnsignedInteger.valueOf(nextIncomingId)); + _lastSentIncomingLimit = UnsignedInteger.valueOf(nextIncomingId + _availableIncomingCredit); + } flow.setIncomingWindow(UnsignedInteger.valueOf(_availableIncomingCredit)); - _lastSentIncomingLimit = UnsignedInteger.valueOf(nextIncomingId + _availableIncomingCredit); flow.setNextOutgoingId(UnsignedInteger.valueOf(_nextOutgoingTransferId.intValue())); flow.setOutgoingWindow(UnsignedInteger.valueOf(_availableOutgoingCredit)); @@ -784,11 +787,15 @@ public class SessionEndpoint public void sendFlowConditional() { - UnsignedInteger clientsCredit = _lastSentIncomingLimit.subtract(UnsignedInteger.valueOf(_nextIncomingTransferId.intValue())); - int i = UnsignedInteger.valueOf(_availableIncomingCredit).subtract(clientsCredit).compareTo(clientsCredit); - if(i >=0) + if(_nextIncomingTransferId != null) { - sendFlow(); + UnsignedInteger clientsCredit = + _lastSentIncomingLimit.subtract(UnsignedInteger.valueOf(_nextIncomingTransferId.intValue())); + int i = UnsignedInteger.valueOf(_availableIncomingCredit).subtract(clientsCredit).compareTo(clientsCredit); + if (i >= 0) + { + sendFlow(); + } } } |