projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Persist compatibility mode in configuration
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
data
/
Profile.java
diff --git
a/src/main/java/net/pterodactylus/sone/data/Profile.java
b/src/main/java/net/pterodactylus/sone/data/Profile.java
index
1f80248
..
679196b
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/data/Profile.java
+++ b/
src/main/java/net/pterodactylus/sone/data/Profile.java
@@
-243,7
+243,7
@@
public class Profile implements Fingerprintable {
return this;
}
checkArgument(avatar.getSone().equals(sone), "avatar must belong to Sone");
return this;
}
checkArgument(avatar.getSone().equals(sone), "avatar must belong to Sone");
- this.avatar = avatar.getId();
+ this.avatar = avatar.getI
nternalI
d();
return this;
}
return this;
}
@@
-325,12
+325,14
@@
public class Profile implements Fingerprintable {
*/
public Field addField(String fieldName) throws IllegalArgumentException {
checkNotNull(fieldName, "fieldName must not be null");
*/
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();
}
@SuppressWarnings("synthetic-access")
if (getFieldByName(fieldName) != null) {
throw new DuplicateField();
}
@SuppressWarnings("synthetic-access")
- Field field = new Field().setName(fieldName);
+ Field field = new Field().setName(fieldName)
.setValue("")
;
fields.add(field);
return field;
}
fields.add(field);
return field;
}
@@
-556,6
+558,13
@@
public class Profile implements Fingerprintable {
}
/**
}
/**
+ * Exception that signals the addition of a field with an empty name.
+ *
+ * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ */
+ public static class EmptyFieldName extends IllegalArgumentException { }
+
+ /**
* Exception that signals the addition of a field that already exists.
*
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
* Exception that signals the addition of a field that already exists.
*
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>