From: Abhishek Kumar Date: Wed, 1 Apr 2015 19:01:08 +0000 (-0700) Subject: Fixes Bug 2935 X-Git-Tag: release/lithium~286^2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=f8d7f0bca83b571545d2554680a2a1abf781fe2f;hp=-c Fixes Bug 2935 Details for the issue is documented here: https://bugs.opendaylight.org/show_bug.cgi?id=2935 This patch updates mapException implementation to appropriately handle exceptions. Change-Id: I104ea62453517e2c6a74955f6b3cce342274a9e5 Signed-off-by: Abhishek Kumar --- f8d7f0bca83b571545d2554680a2a1abf781fe2f diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/PingPongFuture.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/PingPongFuture.java index 1dfc607e6f..611303a41a 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/PingPongFuture.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/PingPongFuture.java @@ -7,7 +7,6 @@ */ package org.opendaylight.controller.md.sal.dom.broker.impl; -import com.google.common.base.Preconditions; import com.google.common.util.concurrent.AbstractCheckedFuture; import com.google.common.util.concurrent.ListenableFuture; import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; @@ -16,13 +15,17 @@ import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFaile * A {@link Future} used to report the status of an future {@link java.util.concurrent.Future}. */ final class PingPongFuture extends AbstractCheckedFuture { - protected PingPongFuture(final ListenableFuture delegate) { - super(delegate); - } + protected PingPongFuture(final ListenableFuture delegate) { + super(delegate); + } - @Override - protected TransactionCommitFailedException mapException(final Exception e) { - Preconditions.checkArgument(e instanceof TransactionCommitFailedException); - return (TransactionCommitFailedException) e; + @Override + protected TransactionCommitFailedException mapException(final Exception e) { + if (e.getCause() instanceof TransactionCommitFailedException){ + return (TransactionCommitFailedException) e.getCause(); + } else { + return new TransactionCommitFailedException(e.getMessage(), e.getCause(), null); } + } } +