From: David ‘Bombe’ Roden Date: Mon, 8 Apr 2013 19:30:17 +0000 (+0200) Subject: Ensure that name is always != null. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=a9081d6a1d743d087db2127e60606e7284f02863;p=xudocci.git Ensure that name is always != null. --- 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"); } //