Fix duplicate-field detection.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 23 Oct 2013 05:51:44 +0000 (07:51 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 28 Feb 2014 21:25:34 +0000 (22:25 +0100)
src/main/java/net/pterodactylus/sone/data/Profile.java

index 6201276..03e9a91 100644 (file)
@@ -217,7 +217,7 @@ 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");
-               checkState(getFieldByName(fieldName) == null, "fieldName must be unique");
+               checkState(!getFieldByName(fieldName).isPresent(), "fieldName must be unique");
                @SuppressWarnings("synthetic-access")
                Field field = new Field(fieldName);
                fields.add(field);