Migrate WordUtils users
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / FrontendReadWriteTransaction.java
index 50e913025d6b9a7ab818393a47c61d4a384f202a..5af7c7954ebbf1abc74ecf14d24fb5c481230b61 100644 (file)
@@ -247,7 +247,7 @@ final class FrontendReadWriteTransaction extends FrontendTransaction {
             case READY:
                 throw new IllegalStateException("Attempted to preCommit in stage " + ready.stage);
             default:
-                throw new IllegalStateException("Unhandled commit stage " + ready.stage);
+                throwUnhandledCommitStage(ready);
         }
     }
 
@@ -306,7 +306,7 @@ final class FrontendReadWriteTransaction extends FrontendTransaction {
             case READY:
                 throw new IllegalStateException("Attempted to doCommit in stage " + ready.stage);
             default:
-                throw new IllegalStateException("Unhandled commit stage " + ready.stage);
+                throwUnhandledCommitStage(ready);
         }
     }
 
@@ -395,7 +395,7 @@ final class FrontendReadWriteTransaction extends FrontendTransaction {
             case PRE_COMMIT_PENDING:
                 throw new IllegalStateException("Attempted to canCommit in stage " + ready.stage);
             default:
-                throw new IllegalStateException("Unhandled commit stage " + ready.stage);
+                throwUnhandledCommitStage(ready);
         }
     }
 
@@ -442,7 +442,7 @@ final class FrontendReadWriteTransaction extends FrontendTransaction {
                 });
                 break;
             default:
-                throw new IllegalStateException("Unhandled commit stage " + ready.stage);
+                throwUnhandledCommitStage(ready);
         }
     }
 
@@ -525,14 +525,16 @@ final class FrontendReadWriteTransaction extends FrontendTransaction {
 
     private ExistsTransactionSuccess handleExistsTransaction(final ExistsTransactionRequest request)
             throws RequestException {
-        final Optional<NormalizedNode<?, ?>> data = checkOpen().getSnapshot().readNode(request.getPath());
+        final Optional<NormalizedNode<?, ?>> data = Optional.fromJavaUtil(checkOpen().getSnapshot().readNode(
+            request.getPath()));
         return recordSuccess(request.getSequence(), new ExistsTransactionSuccess(getIdentifier(), request.getSequence(),
             data.isPresent()));
     }
 
     private ReadTransactionSuccess handleReadTransaction(final ReadTransactionRequest request)
             throws RequestException {
-        final Optional<NormalizedNode<?, ?>> data = checkOpen().getSnapshot().readNode(request.getPath());
+        final Optional<NormalizedNode<?, ?>> data = Optional.fromJavaUtil(checkOpen().getSnapshot().readNode(
+            request.getPath()));
         return recordSuccess(request.getSequence(), new ReadTransactionSuccess(getIdentifier(), request.getSequence(),
             data));
     }
@@ -558,7 +560,8 @@ final class FrontendReadWriteTransaction extends FrontendTransaction {
         }
     }
 
-    private @Nullable TransactionSuccess<?> handleModifyTransaction(final ModifyTransactionRequest request,
+    @Nullable
+    private TransactionSuccess<?> handleModifyTransaction(final ModifyTransactionRequest request,
             final RequestEnvelope envelope, final long now) throws RequestException {
         // We need to examine the persistence protocol first to see if this is an idempotent request. If there is no
         // protocol, there is nothing for us to do.
@@ -636,4 +639,8 @@ final class FrontendReadWriteTransaction extends FrontendTransaction {
             state);
         return ((Sealed) state).sealedModification;
     }
+
+    private static void throwUnhandledCommitStage(final Ready ready) {
+        throw new IllegalStateException("Unhandled commit stage " + ready.stage);
+    }
 }