From ed777a1f79389ce52750d3bfc4ebac290878ff7a Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Tue, 19 Apr 2022 22:15:10 +0200 Subject: [PATCH] Remove FindBugs workaround SpotBugs no longer throws a fit on callback's nullness, remove the workaround. Also do not execute read/exists if there is no callback -- although there always should be. Change-Id: I3609d3be076de488f7fa64c72ad3b875e77a633e Signed-off-by: Robert Varga --- .../actors/dds/LocalProxyTransaction.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/LocalProxyTransaction.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/LocalProxyTransaction.java index aef5f8bbc6..662ccba85d 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/LocalProxyTransaction.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/LocalProxyTransaction.java @@ -104,22 +104,18 @@ abstract class LocalProxyTransaction extends AbstractProxyTransaction { // Note we delay completion of read requests to limit the scope at which the client can run, as they have // listeners, which we do not want to execute while we are reconnecting. if (request instanceof ReadTransactionRequest) { - final YangInstanceIdentifier path = ((ReadTransactionRequest) request).getPath(); - final Optional result = readOnlyView().readNode(path); if (callback != null) { - // XXX: FB does not see that callback is final, on stack and has be check for non-null. - final Consumer> fbIsStupid = requireNonNull(callback); - executeInActor(() -> fbIsStupid.accept(new ReadTransactionSuccess(request.getTarget(), + final YangInstanceIdentifier path = ((ReadTransactionRequest) request).getPath(); + final Optional result = readOnlyView().readNode(path); + executeInActor(() -> callback.accept(new ReadTransactionSuccess(request.getTarget(), request.getSequence(), result))); } return true; } else if (request instanceof ExistsTransactionRequest) { - final YangInstanceIdentifier path = ((ExistsTransactionRequest) request).getPath(); - final boolean result = readOnlyView().readNode(path).isPresent(); if (callback != null) { - // XXX: FB does not see that callback is final, on stack and has be check for non-null. - final Consumer> fbIsStupid = requireNonNull(callback); - executeInActor(() -> fbIsStupid.accept(new ExistsTransactionSuccess(request.getTarget(), + final YangInstanceIdentifier path = ((ExistsTransactionRequest) request).getPath(); + final boolean result = readOnlyView().readNode(path).isPresent(); + executeInActor(() -> callback.accept(new ExistsTransactionSuccess(request.getTarget(), request.getSequence(), result))); } return true; -- 2.36.6