From a9081d6a1d743d087db2127e60606e7284f02863 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 8 Apr 2013 21:30:17 +0200 Subject: [PATCH] Ensure that name is always != null. --- src/main/java/net/pterodactylus/xdcc/data/Network.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/pterodactylus/xdcc/data/Network.java b/src/main/java/net/pterodactylus/xdcc/data/Network.java index 8fac0ea..65a419f 100644 --- a/src/main/java/net/pterodactylus/xdcc/data/Network.java +++ b/src/main/java/net/pterodactylus/xdcc/data/Network.java @@ -17,6 +17,8 @@ package net.pterodactylus.xdcc.data; +import static com.google.common.base.Preconditions.checkNotNull; + import java.util.Collection; import com.beust.jcommander.internal.Sets; @@ -40,9 +42,11 @@ public class Network { * * @param name * The name of the network + * @throws NullPointerException + * if {@code name} is {@code null} */ - private Network(String name) { - this.name = name; + private Network(String name) throws NullPointerException { + this.name = checkNotNull(name, "name must not be null"); } // -- 2.7.4