Ensure that name is always != null.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 8 Apr 2013 19:30:17 +0000 (21:30 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 8 Apr 2013 19:30:17 +0000 (21:30 +0200)
src/main/java/net/pterodactylus/xdcc/data/Network.java

index 8fac0ea..65a419f 100644 (file)
@@ -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");
        }
 
        //