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);
         }
     }
 
diff --git a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentMapTest.java b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentMapTest.java
index d08495a..23f9a1f 100644
--- a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentMapTest.java
+++ b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentMapTest.java
@@ -15,15 +15,6 @@
  */
 package org.onosproject.store.primitives.resources.impl;
 
-import java.util.Arrays;
-import java.util.ConcurrentModificationException;
-import java.util.List;
-import java.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.CompletionException;
-import java.util.stream.Collectors;
-
-import com.google.common.base.Throwables;
 import com.google.common.collect.Sets;
 import io.atomix.protocols.raft.proxy.RaftProxy;
 import io.atomix.protocols.raft.service.RaftService;
@@ -37,6 +28,14 @@
 import org.onosproject.store.service.Version;
 import org.onosproject.store.service.Versioned;
 
+import java.util.Arrays;
+import java.util.ConcurrentModificationException;
+import java.util.List;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.CompletionException;
+import java.util.stream.Collectors;
+
 import static org.hamcrest.Matchers.is;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
@@ -594,7 +593,8 @@
             try {
                 queue.put(event);
             } catch (InterruptedException e) {
-                Throwables.propagate(e);
+                Thread.currentThread().interrupt();
+                throw new IllegalStateException(e);
             }
         }
 
diff --git a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentTreeMapTest.java b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentTreeMapTest.java
index acb7925..57bf60c 100644
--- a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentTreeMapTest.java
+++ b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentTreeMapTest.java
@@ -15,14 +15,6 @@
  */
 package org.onosproject.store.primitives.resources.impl;
 
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.BlockingQueue;
-import java.util.stream.Collectors;
-
-import com.google.common.base.Throwables;
 import com.google.common.collect.Lists;
 import io.atomix.protocols.raft.proxy.RaftProxy;
 import io.atomix.protocols.raft.service.RaftService;
@@ -31,6 +23,13 @@
 import org.onosproject.store.service.MapEvent;
 import org.onosproject.store.service.MapEventListener;
 
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.BlockingQueue;
+import java.util.stream.Collectors;
+
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -500,7 +499,8 @@
             try {
                 queue.put(event);
             } catch (InterruptedException e) {
-                Throwables.propagate(e);
+                Thread.interrupted();
+                throw new IllegalStateException(e);
             }
         }
 
diff --git a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixDocumentTreeTest.java b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixDocumentTreeTest.java
index 7a41395..6abe84f 100644
--- a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixDocumentTreeTest.java
+++ b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixDocumentTreeTest.java
@@ -16,18 +16,9 @@
 
 package org.onosproject.store.primitives.resources.impl;
 
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.BlockingQueue;
-
 import com.google.common.base.Throwables;
 import io.atomix.protocols.raft.proxy.RaftProxy;
 import io.atomix.protocols.raft.service.RaftService;
-
 import org.junit.Test;
 import org.onosproject.store.primitives.NodeUpdate;
 import org.onosproject.store.primitives.TransactionId;
@@ -41,6 +32,14 @@
 import org.onosproject.store.service.Version;
 import org.onosproject.store.service.Versioned;
 
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.BlockingQueue;
+
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -482,7 +481,8 @@
             try {
                 queue.put(event);
             } catch (InterruptedException e) {
-                Throwables.propagate(e);
+                Thread.currentThread().interrupt();
+                throw new IllegalStateException(e);
             }
         }