X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FProfile.java;h=0f9b8ff3e7ddf2818193812f70b3240cb237db36;hb=1a2e2a402b62923a68b09eea463ca3952c5505b0;hp=9c7da484a7854e4aabf3f7a04e5d21b2836b0836;hpb=b2e3ba7456f47f01552c8e1300e295c48d8fe9a8;p=Sone.git
diff --git a/src/main/java/net/pterodactylus/sone/data/Profile.java b/src/main/java/net/pterodactylus/sone/data/Profile.java
index 9c7da48..0f9b8ff 100644
--- a/src/main/java/net/pterodactylus/sone/data/Profile.java
+++ b/src/main/java/net/pterodactylus/sone/data/Profile.java
@@ -1,5 +1,5 @@
/*
- * Sone - Profile.java - Copyright © 2010â2013 David Roden
+ * Sone - Profile.java - Copyright © 2010â2016 David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -325,7 +325,9 @@ public class Profile implements Fingerprintable {
*/
public Field addField(String fieldName) throws IllegalArgumentException {
checkNotNull(fieldName, "fieldName must not be null");
- checkArgument(fieldName.length() > 0, "fieldName must not be empty");
+ if (fieldName.length() == 0) {
+ throw new EmptyFieldName();
+ }
if (getFieldByName(fieldName) != null) {
throw new DuplicateField();
}
@@ -556,6 +558,13 @@ public class Profile implements Fingerprintable {
}
/**
+ * Exception that signals the addition of a field with an empty name.
+ *
+ * @author David âBombeâ Roden
+ */
+ public static class EmptyFieldName extends IllegalArgumentException { }
+
+ /**
* Exception that signals the addition of a field that already exists.
*
* @author David âBombeâ Roden