From aedef4e46dac4b991072034ee07e3f35b6e5a700 Mon Sep 17 00:00:00 2001 From: Marek Gradzki Date: Fri, 13 Apr 2018 13:38:16 +0200 Subject: WriteTransaction: make sure TransactionCommitFailedException is thrown DataTreeModification.ready() used by DataModification.validate() might throw IllegalArgumentException in case of missing mandatory nodes. Use broader Exception type in WriteTransaction.submit() to make sure contract defined by AsyncWriteTransaction is preserved. Change-Id: I95cb3e1e8c6db36df90d2c78e7d63c854189e2fd Signed-off-by: Marek Gradzki --- .../src/main/java/io/fd/honeycomb/data/impl/WriteTransaction.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'infra/data-impl/src/main/java/io') diff --git a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/WriteTransaction.java b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/WriteTransaction.java index 648d4359e..8e7dca07b 100644 --- a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/WriteTransaction.java +++ b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/WriteTransaction.java @@ -29,7 +29,6 @@ import com.google.common.util.concurrent.CheckedFuture; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import io.fd.honeycomb.data.DataModification; -import io.fd.honeycomb.translate.TranslationException; import java.util.function.Consumer; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -41,7 +40,6 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction; import org.opendaylight.yangtools.yang.common.RpcResult; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; -import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -143,7 +141,7 @@ final class WriteTransaction implements DOMDataWriteTransaction { } status = COMMITED; - } catch (DataValidationFailedException | TranslationException e) { + } catch (Exception e) { status = FAILED; LOG.error("Submit failed", e); return Futures.immediateFailedCheckedFuture( -- cgit 1.2.3-korg