diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-06-13 19:42:29 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-06-13 19:42:29 +0200 |
commit | 28862ccc448cae25719452e7f29d16872498fbbb (patch) | |
tree | 692ad583199e450b1ce8f82b2d9d88d1ce1e62e4 /documentapi | |
parent | 4ae60e3fbc20e0397662c39848cab012ff052e5e (diff) |
Avoid potential NullPtrException and add some more information in case something odd happens.
Diffstat (limited to 'documentapi')
-rw-r--r-- | documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/StoragePolicy.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/StoragePolicy.java b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/StoragePolicy.java index a12828fb104..65912cdd0bd 100644 --- a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/StoragePolicy.java +++ b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/StoragePolicy.java @@ -477,7 +477,12 @@ public class StoragePolicy extends ExternalSlobrokPolicy { @Override public void merge(RoutingContext context) { RoutingNodeIterator it = context.getChildIterator(); - Reply reply = it.removeReply(); + Reply reply = (it.hasReply()) ? it.removeReply() : context.getReply(); + if (reply == null) { + reply = new EmptyReply(); + reply.addError(new Error(ErrorCode.NO_ADDRESS_FOR_SERVICE, + "No reply in any children, nor in the routing context: " + context)); + } if (reply instanceof WrongDistributionReply) { distributorSelectionLogic.handleWrongDistribution((WrongDistributionReply) reply, context); |