diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2018-03-07 11:02:29 +0100 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2018-03-07 11:57:06 +0100 |
commit | a604b493ab32467635ec1767b2747bcf8f22cae9 (patch) | |
tree | d3813d11dcfa2a6e92068f3b842de25b2c6bb2e7 /infra/rpc/impl/src/main/java/io | |
parent | 58049e06ac79053d72e97dd333fe65a44642c6d3 (diff) |
Fix handling of RPCs that do not produce a result
The output statement of RPC operation is optional.
In such cases DefaultDOMRpcResult should be initialized with null result.
Change-Id: Ia832e480b3c72607b3636493bc044a9144f247be
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'infra/rpc/impl/src/main/java/io')
-rw-r--r-- | infra/rpc/impl/src/main/java/io/fd/honeycomb/rpc/HoneycombDOMRpcService.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/infra/rpc/impl/src/main/java/io/fd/honeycomb/rpc/HoneycombDOMRpcService.java b/infra/rpc/impl/src/main/java/io/fd/honeycomb/rpc/HoneycombDOMRpcService.java index 68f29f208..01adbd6da 100644 --- a/infra/rpc/impl/src/main/java/io/fd/honeycomb/rpc/HoneycombDOMRpcService.java +++ b/infra/rpc/impl/src/main/java/io/fd/honeycomb/rpc/HoneycombDOMRpcService.java @@ -71,8 +71,12 @@ public final class HoneycombDOMRpcService implements DOMRpcService { private ListenableFuture<DOMRpcResult> getDOMRpcResult(final ListenableFuture<DataObject> invoke) { return Futures.transform( invoke, - (Function<DataObject, DOMRpcResult>) output -> { - final ContainerNode outputNode = serializer.toNormalizedNodeRpcData(output); + output -> { + // If result is available convert it to BI form. Otherwise pass null as DOMRpcResult expects. + ContainerNode outputNode = null; + if (output != null) { + outputNode = serializer.toNormalizedNodeRpcData(output); + } return new DefaultDOMRpcResult(outputNode); }); } |