Bump versions 9.0.4-SNAPSHOT
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / databroker / actors / dds / LocalReadWriteProxyTransaction.java
index 7fcaf4e953e1410b8b3c57c4fe4f83c77521a34d..47ae6a2bc7a27ae60fc1a8b094411c65c03d4a21 100644 (file)
@@ -12,6 +12,7 @@ import static com.google.common.base.Verify.verify;
 import static com.google.common.base.Verify.verifyNotNull;
 
 import com.google.common.util.concurrent.FluentFuture;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.Optional;
 import java.util.OptionalLong;
 import java.util.function.BiConsumer;
@@ -96,8 +97,7 @@ final class LocalReadWriteProxyTransaction extends LocalProxyTransaction {
             final DataTreeSnapshot snapshot) {
         super(parent, identifier, false);
 
-        if (snapshot instanceof FailedDataTreeModification) {
-            final var failed = (FailedDataTreeModification) snapshot;
+        if (snapshot instanceof FailedDataTreeModification failed) {
             recordedFailure = failed.cause();
             modification = failed;
         } else {
@@ -107,7 +107,7 @@ final class LocalReadWriteProxyTransaction extends LocalProxyTransaction {
             } catch (Exception e) {
                 LOG.debug("Failed to instantiate modification for {}", identifier, e);
                 recordedFailure = e;
-                mod = new FailedDataTreeModification(snapshot.getEffectiveModelContext(), e);
+                mod = new FailedDataTreeModification(snapshot.modelContext(), e);
             }
             modification = mod;
         }
@@ -297,7 +297,7 @@ final class LocalReadWriteProxyTransaction extends LocalProxyTransaction {
                 sealOnly();
             }
 
-            switch (maybeProtocol.get()) {
+            switch (maybeProtocol.orElseThrow()) {
                 case ABORT:
                     sendMethod.accept(new AbortLocalTransactionRequest(getIdentifier(), localActor()), cb);
                     break;
@@ -311,7 +311,7 @@ final class LocalReadWriteProxyTransaction extends LocalProxyTransaction {
                     sendMethod.accept(commitRequest(true), cb);
                     break;
                 default:
-                    throw new IllegalArgumentException("Unhandled protocol " + maybeProtocol.get());
+                    throw new IllegalArgumentException("Unhandled protocol " + maybeProtocol.orElseThrow());
             }
         }
     }
@@ -407,6 +407,7 @@ final class LocalReadWriteProxyTransaction extends LocalProxyTransaction {
         closedException = this::abortedException;
     }
 
+    @SuppressFBWarnings(value = "THROWS_METHOD_THROWS_RUNTIMEEXCEPTION", justification = "Replay of recorded failure")
     private @NonNull CursorAwareDataTreeModification getModification() {
         if (closedException != null) {
             throw closedException.get();