From 77ce3be7567bd01c66d8ee88a93b485666723501 Mon Sep 17 00:00:00 2001 From: Ashlee Young Date: Sun, 22 Nov 2015 10:02:05 -0800 Subject: Removed patch path since changes have been merged upstream to a different path. Updated README with directions. Change-Id: Ie419abd2d3d3ef7315de9f607dcd757a78190995 Signed-off-by: Ashlee Young --- framework/src/onos/utils/catalyst/pom.xml | 8 +------- .../src/main/java/org/onlab/util/DefaultHashMap.java | 4 ++-- .../utils/misc/src/main/java/org/onlab/util/Tools.java | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 9 deletions(-) (limited to 'framework/src/onos/utils') diff --git a/framework/src/onos/utils/catalyst/pom.xml b/framework/src/onos/utils/catalyst/pom.xml index 26508f7b..bd1d52dd 100644 --- a/framework/src/onos/utils/catalyst/pom.xml +++ b/framework/src/onos/utils/catalyst/pom.xml @@ -47,14 +47,8 @@ - io.atomix.catalyst.serializer;version="1.0.0-rc4", - io.atomix.catalyst.buffer;version="1.0.0-rc4", - io.atomix.catalyst.transport;version="1.0.0-rc4", + io.atomix.catalyst.* - - io.atomix.catalyst.*;version="1.0.0-rc4" - - diff --git a/framework/src/onos/utils/misc/src/main/java/org/onlab/util/DefaultHashMap.java b/framework/src/onos/utils/misc/src/main/java/org/onlab/util/DefaultHashMap.java index f9d878ab..d6ddbd56 100644 --- a/framework/src/onos/utils/misc/src/main/java/org/onlab/util/DefaultHashMap.java +++ b/framework/src/onos/utils/misc/src/main/java/org/onlab/util/DefaultHashMap.java @@ -21,10 +21,10 @@ import java.util.HashMap; /** * HashMap that returns a default value for unmapped keys. */ -public class DefaultHashMap extends HashMap { +public final class DefaultHashMap extends HashMap { /** Default value to return when no key binding exists. */ - protected V defaultValue; + protected final V defaultValue; /** * Constructs an empty map with the given default value. diff --git a/framework/src/onos/utils/misc/src/main/java/org/onlab/util/Tools.java b/framework/src/onos/utils/misc/src/main/java/org/onlab/util/Tools.java index 1b788145..ffefbfd4 100644 --- a/framework/src/onos/utils/misc/src/main/java/org/onlab/util/Tools.java +++ b/framework/src/onos/utils/misc/src/main/java/org/onlab/util/Tools.java @@ -40,6 +40,7 @@ import java.util.Collection; import java.util.Dictionary; import java.util.List; import java.util.Random; +import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; @@ -143,6 +144,23 @@ public abstract class Tools { return item; } + /** + * Returns the specified set if the set is not null and not empty; + * otherwise throws a not found exception. + * + * @param item set to check + * @param message not found message + * @param Set item type + * @return item if not null and not empty + * @throws org.onlab.util.ItemNotFoundException if set is null or empty + */ + public static Set emptyIsNotFound(Set item, String message) { + if (item == null || item.isEmpty()) { + throw new ItemNotFoundException(message); + } + return item; + } + /** * Returns the specified item if that item is not null; otherwise throws * bad argument exception. -- cgit 1.2.3-korg