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 | ddfdc25e7efea788834509dde13c8eecb313aacd (patch) | |
| tree | b10303419505e8a569512bc52315c4ec7551b690 /qpid/java | |
| parent | 8c56d64f1cbaa2445d6deefa754f89981f0b17cb (diff) | |
| download | qpid-python-ddfdc25e7efea788834509dde13c8eecb313aacd.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@1625241 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
| -rw-r--r-- | qpid/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/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/transport/SessionEndpoint.java b/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/transport/SessionEndpoint.java index bc961cb86e..0f37518773 100644 --- a/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/transport/SessionEndpoint.java +++ b/qpid/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(); + } } } |
