Remove calls to deprecated Throwables.propagate() method

Change-Id: Id48a8f1d4fb02560cfb77108f554556a3cad9b16
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/DefaultAsyncAtomicValue.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/DefaultAsyncAtomicValue.java
index 37092f2..33af601 100644
--- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/DefaultAsyncAtomicValue.java
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/DefaultAsyncAtomicValue.java
@@ -16,11 +16,7 @@
 
 package org.onosproject.store.primitives.impl;
 
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-import java.util.concurrent.CompletableFuture;
-
+import com.google.common.collect.Maps;
 import org.onosproject.store.service.AsyncAtomicValue;
 import org.onosproject.store.service.AsyncConsistentMap;
 import org.onosproject.store.service.AtomicValueEvent;
@@ -31,8 +27,10 @@
 import org.onosproject.store.service.Versioned;
 import org.onosproject.utils.MeteringAgent;
 
-import com.google.common.base.Throwables;
-import com.google.common.collect.Maps;
+import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+
+import static com.google.common.base.Preconditions.checkNotNull;
 
 /**
  * Default implementation of a {@code AsyncAtomicValue}.
@@ -170,14 +168,15 @@
                 final MeteringAgent.Context newTimer = monitor.startTimer(NOTIFY_LISTENER);
                 byte[] rawNewValue = Versioned.valueOrNull(event.newValue());
                 byte[] rawOldValue = Versioned.valueOrNull(event.oldValue());
+
                 try {
                     listener.event(new AtomicValueEvent<>(name,
                             rawNewValue == null ? null : serializer.decode(rawNewValue),
-                                    rawOldValue == null ? null : serializer.decode(rawOldValue)));
+                            rawOldValue == null ? null : serializer.decode(rawOldValue)));
                     newTimer.stop(null);
                 } catch (Exception e) {
                     newTimer.stop(e);
-                    Throwables.propagate(e);
+                    throw new IllegalStateException(e.getCause());
                 }
             }
         }
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/MeteredAsyncConsistentMap.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/MeteredAsyncConsistentMap.java
index ac41e84..de53121 100644
--- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/MeteredAsyncConsistentMap.java
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/MeteredAsyncConsistentMap.java
@@ -16,6 +16,17 @@
 
 package org.onosproject.store.primitives.impl;
 
+import com.google.common.collect.Maps;
+import org.onosproject.store.primitives.MapUpdate;
+import org.onosproject.store.primitives.TransactionId;
+import org.onosproject.store.service.AsyncConsistentMap;
+import org.onosproject.store.service.MapEvent;
+import org.onosproject.store.service.MapEventListener;
+import org.onosproject.store.service.TransactionLog;
+import org.onosproject.store.service.Version;
+import org.onosproject.store.service.Versioned;
+import org.onosproject.utils.MeteringAgent;
+
 import java.util.Collection;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -26,20 +37,6 @@
 import java.util.function.Function;
 import java.util.function.Predicate;
 
-import org.onosproject.store.primitives.MapUpdate;
-import org.onosproject.store.primitives.TransactionId;
-import org.onosproject.store.service.AsyncConsistentMap;
-import org.onosproject.store.service.MapEvent;
-import org.onosproject.store.service.MapEventListener;
-import org.onosproject.store.service.TransactionLog;
-import org.onosproject.store.service.Version;
-import org.onosproject.store.service.Versioned;
-
-import com.google.common.base.Throwables;
-import com.google.common.collect.Maps;
-
-import org.onosproject.utils.MeteringAgent;
-
 /**
  * {@link AsyncConsistentMap} that meters all its operations.
  *
@@ -310,7 +307,7 @@
                 timer.stop(null);
             } catch (Exception e) {
                 timer.stop(e);
-                Throwables.propagate(e);
+                throw new IllegalStateException(e);
             }
         }
     }
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/TransactionalMapParticipant.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/TransactionalMapParticipant.java
index 55f4e24..8837b49 100644
--- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/TransactionalMapParticipant.java
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/TransactionalMapParticipant.java
@@ -16,16 +16,6 @@
 
 package org.onosproject.store.primitives.impl;
 
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
 import com.google.common.base.MoreObjects;
 import com.google.common.base.Objects;
 import com.google.common.base.Throwables;
@@ -38,6 +28,16 @@
 import org.onosproject.store.service.TransactionalMap;
 import org.onosproject.store.service.Version;
 
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
 import static com.google.common.base.Preconditions.checkNotNull;
 import static com.google.common.base.Preconditions.checkState;
 
@@ -87,7 +87,7 @@
                     } catch (TimeoutException e) {
                         throw new TransactionException.Timeout();
                     } catch (ExecutionException e) {
-                        Throwables.propagateIfPossible(e.getCause());
+                        Throwables.throwIfUnchecked(e);
                         throw new TransactionException(e.getCause());
                     }
                 }
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentMapService.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentMapService.java
index 22f59f3..d25d475 100644
--- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentMapService.java
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentMapService.java
@@ -26,7 +26,6 @@
 import java.util.function.Predicate;
 import java.util.stream.Collectors;
 
-import com.google.common.base.Throwables;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
@@ -731,7 +730,7 @@
             }
         } catch (Exception e) {
             logger().warn("Failure applying {}", commit, e);
-            throw Throwables.propagate(e);
+            throw new IllegalStateException(e);
         }
     }
 
@@ -753,7 +752,7 @@
             return commitTransaction(transactionScope);
         } catch (Exception e) {
             logger().warn("Failure applying {}", commit, e);
-            throw Throwables.propagate(e);
+            throw new IllegalStateException(e);
         } finally {
             discardTombstones();
         }
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixDocumentTreeService.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixDocumentTreeService.java
index 2633bf1..41a1a9f 100644
--- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixDocumentTreeService.java
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixDocumentTreeService.java
@@ -32,7 +32,6 @@
 import com.esotericsoftware.kryo.Kryo;
 import com.esotericsoftware.kryo.io.Input;
 import com.esotericsoftware.kryo.io.Output;
-import com.google.common.base.Throwables;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Queues;
@@ -274,7 +273,7 @@
             result = DocumentTreeResult.invalidPath();
         } catch (Exception e) {
             logger().error("Failed to apply {} to state machine", commit.value(), e);
-            throw Throwables.propagate(e);
+            throw new IllegalStateException(e);
         }
         return result;
     }
@@ -366,7 +365,7 @@
             }
         } catch (Exception e) {
             logger().warn("Failure applying {}", commit, e);
-            throw Throwables.propagate(e);
+            throw new IllegalStateException(e);
         }
     }
 
@@ -457,7 +456,7 @@
             return commitTransaction(transactionScope);
         } catch (Exception e) {
             logger().warn("Failure applying {}", commit, e);
-            throw Throwables.propagate(e);
+            throw new IllegalStateException(e);
         }
     }
 
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorService.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorService.java
index b259cd1..542c375 100644
--- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorService.java
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorService.java
@@ -29,7 +29,6 @@
 
 import com.google.common.base.MoreObjects;
 import com.google.common.base.Objects;
-import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
@@ -177,7 +176,7 @@
             return newLeadership;
         } catch (Exception e) {
             logger().error("State machine operation failed", e);
-            throw Throwables.propagate(e);
+            throw new IllegalStateException(e);
         }
     }
 
@@ -197,7 +196,7 @@
             }
         } catch (Exception e) {
             logger().error("State machine operation failed", e);
-            throw Throwables.propagate(e);
+            throw new IllegalStateException(e);
         }
     }
 
@@ -222,7 +221,7 @@
                     commit.value().nodeId().equals(electionState.leader().nodeId()));
         } catch (Exception e) {
             logger().error("State machine operation failed", e);
-            throw Throwables.propagate(e);
+            throw new IllegalStateException(e);
         }
     }
 
@@ -247,7 +246,7 @@
             return true;
         } catch (Exception e) {
             logger().error("State machine operation failed", e);
-            throw Throwables.propagate(e);
+            throw new IllegalStateException(e);
         }
     }
 
@@ -271,7 +270,7 @@
             notifyLeadershipChanges(changes);
         } catch (Exception e) {
             logger().error("State machine operation failed", e);
-            throw Throwables.propagate(e);
+            throw new IllegalStateException(e);
         }
     }
 
@@ -286,7 +285,7 @@
             return leadership(topic);
         } catch (Exception e) {
             logger().error("State machine operation failed", e);
-            throw Throwables.propagate(e);
+            throw new IllegalStateException(e);
         }
     }
 
@@ -304,7 +303,7 @@
             }).keySet());
         } catch (Exception e) {
             logger().error("State machine operation failed", e);
-            throw Throwables.propagate(e);
+            throw new IllegalStateException(e);
         }
     }
 
@@ -320,7 +319,7 @@
             return result;
         } catch (Exception e) {
             logger().error("State machine operation failed", e);
-            throw Throwables.propagate(e);
+            throw new IllegalStateException(e);
         }
     }
 
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixWorkQueueService.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixWorkQueueService.java
index b1d6698..4540aa5 100644
--- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixWorkQueueService.java
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixWorkQueueService.java
@@ -29,7 +29,6 @@
 import java.util.stream.IntStream;
 
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Queues;
@@ -169,7 +168,7 @@
                     .collect(Collectors.toCollection(ArrayList::new));
         } catch (Exception e) {
             logger().warn("State machine update failed", e);
-            throw Throwables.propagate(e);
+            throw new IllegalStateException(e);
         }
     }
 
@@ -186,7 +185,7 @@
             });
         } catch (Exception e) {
             logger().warn("State machine update failed", e);
-            throw Throwables.propagate(e);
+            throw new IllegalStateException(e);
         }
     }