diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-06-14 15:19:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-14 15:19:34 +0200 |
commit | 5736566c2dc551b4f059011e99f68eea1fb1a32b (patch) | |
tree | 26c7bc7925edaf7e2df1c5aacdad8255e94b4075 /documentapi | |
parent | e3c6ab4ce1f42c348c04e1f35a4a1a2e647e3256 (diff) | |
parent | 28862ccc448cae25719452e7f29d16872498fbbb (diff) |
Merge pull request #2747 from yahoo/balder/add-some-more-debug-information-in-case-of-error-and-avoid-potential-nullptr-exception
Avoid potential NullPtrException and add some more information in cas…
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 de0ce196678..054c889dbfd 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); |