summaryrefslogtreecommitdiffstats
path: root/vpp-common/vpp-translate-utils
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2017-06-23 12:09:16 +0200
committerMarek Gradzki <mgradzki@cisco.com>2017-06-23 12:09:16 +0200
commit2064e56f72c75eac68773bf35de81c081cb04231 (patch)
tree5c73c42d3603150bc21e512c72ea17d5839738ed /vpp-common/vpp-translate-utils
parent3489360adb7d3221c6396a74a86f917894ac128b (diff)
More specific exceptions in JvppReplyConsumer
Change-Id: I96bd342e84742f6c6ab7d4c6aa687bcb1baf9e7c Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'vpp-common/vpp-translate-utils')
-rw-r--r--vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/JvppReplyConsumer.java34
1 files changed, 17 insertions, 17 deletions
diff --git a/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/JvppReplyConsumer.java b/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/JvppReplyConsumer.java
index 2a8345445..9fe9162c5 100644
--- a/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/JvppReplyConsumer.java
+++ b/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/JvppReplyConsumer.java
@@ -16,26 +16,24 @@
package io.fd.hc2vpp.common.translate.util;
+import static com.google.common.base.Preconditions.checkArgument;
+
import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.vpp.jvpp.VppBaseCallException;
import io.fd.vpp.jvpp.dto.JVppReply;
import java.util.Optional;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-import javax.annotation.Nonnegative;
-import javax.annotation.Nonnull;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
+import javax.annotation.Nonnegative;
+import javax.annotation.Nonnull;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkState;
-
/**
* Trait providing logic for consuming reply's to jvpp api calls
*/
@@ -81,7 +79,7 @@ public interface JvppReplyConsumer {
default <REP extends JVppReply<?>> REP getReplyForCreate(@Nonnull Future<REP> future,
@Nonnull final InstanceIdentifier<?> replyType,
@Nonnull final DataObject data)
- throws WriteFailedException {
+ throws WriteFailedException.CreateFailedException {
return getReplyForCreate(future, replyType, data, JvppReplyTimeoutHolder.getTimeout());
}
@@ -92,13 +90,14 @@ public interface JvppReplyConsumer {
@Nonnull final InstanceIdentifier<?> replyType,
@Nonnull final DataObject data,
@Nonnegative final int timeoutInSeconds)
- throws WriteFailedException {
+ throws WriteFailedException.CreateFailedException {
try {
return getReply(future, timeoutInSeconds);
} catch (VppBaseCallException e) {
throw new WriteFailedException.CreateFailedException(replyType, data, e);
} catch (TimeoutException e) {
- throw new WriteTimeoutException(replyType, e);
+ throw new WriteFailedException.CreateFailedException(replyType, data,
+ new WriteTimeoutException(replyType, e));
}
}
@@ -109,7 +108,7 @@ public interface JvppReplyConsumer {
@Nonnull final InstanceIdentifier<?> replyType,
@Nonnull final DataObject dataBefore,
@Nonnull final DataObject dataAfter)
- throws WriteFailedException {
+ throws WriteFailedException.UpdateFailedException {
return getReplyForUpdate(future, replyType, dataBefore, dataAfter, JvppReplyTimeoutHolder.getTimeout());
}
@@ -121,13 +120,14 @@ public interface JvppReplyConsumer {
@Nonnull final DataObject dataBefore,
@Nonnull final DataObject dataAfter,
@Nonnegative final int timeoutInSeconds)
- throws WriteFailedException {
+ throws WriteFailedException.UpdateFailedException {
try {
return getReply(future, timeoutInSeconds);
} catch (VppBaseCallException e) {
throw new WriteFailedException.UpdateFailedException(replyType, dataBefore, dataAfter, e);
} catch (TimeoutException e) {
- throw new WriteTimeoutException(replyType, e);
+ throw new WriteFailedException.UpdateFailedException(replyType, dataBefore, dataAfter,
+ new WriteTimeoutException(replyType, e));
}
}
@@ -136,7 +136,7 @@ public interface JvppReplyConsumer {
*/
default <REP extends JVppReply<?>> REP getReplyForDelete(@Nonnull Future<REP> future,
@Nonnull final InstanceIdentifier<?> replyType)
- throws WriteFailedException {
+ throws WriteFailedException.DeleteFailedException {
return getReplyForDelete(future, replyType, JvppReplyTimeoutHolder.getTimeout());
}
@@ -146,13 +146,13 @@ public interface JvppReplyConsumer {
default <REP extends JVppReply<?>> REP getReplyForDelete(@Nonnull Future<REP> future,
@Nonnull final InstanceIdentifier<?> replyType,
@Nonnegative final int timeoutInSeconds)
- throws WriteFailedException {
+ throws WriteFailedException.DeleteFailedException {
try {
return getReply(future, timeoutInSeconds);
} catch (VppBaseCallException e) {
throw new WriteFailedException.DeleteFailedException(replyType, e);
} catch (TimeoutException e) {
- throw new WriteTimeoutException(replyType, e);
+ throw new WriteFailedException.DeleteFailedException(replyType, new WriteTimeoutException(replyType, e));
}
}