}
- @SuppressWarnings({ "unchecked", "deprecation", "rawtypes" })
+ @SuppressWarnings({ "unchecked", "rawtypes" })
// deviceTx.put needs the "true" boolean parameter at the end in order to not compromise the Junit test suite
// FIXME check if the InstanceIdentifier raw type can be avoided
// Raw types use are discouraged since they lack type safety.
if (!deviceTxFuture.get().isPresent()) {
return false;
}
- DeviceTransaction deviceTx = deviceTxFuture.get().get();
+ DeviceTransaction deviceTx = deviceTxFuture.get().orElseThrow();
deviceTx.merge(logicalDatastoreType, instanceIdentifier, object);
deviceTx.commit(Timeouts.DEVICE_WRITE_TIMEOUT, Timeouts.DEVICE_WRITE_TIMEOUT_UNIT).get();
return true;
throws ExecutionException, InterruptedException {
Future<Optional<DeviceTransaction>> deviceTxFuture =
deviceTransactionManager.getDeviceTransaction(nodeId);
- if (!deviceTxFuture.get().isPresent()) {
- return null;
- }
- DeviceTransaction deviceTx = deviceTxFuture.get().get();
+ DeviceTransaction deviceTx = deviceTxFuture.get().orElseThrow(null);
Optional<? extends DataObject> readOpt
= deviceTx.read(logicalDatastoreType, instanceIdentifier).get();
- if (!readOpt.isPresent()) {
- return null;
- }
- return readOpt.get();
+ return readOpt.orElseThrow(null);
}
}