projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
🔀 Merge branch 'release/v82'
[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
d3ce38e
..
34246cb
100644
(file)
--- 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–20
16
David Roden
+ * Sone - Profile.java - Copyright © 2010–20
20
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
*
* 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
@@
-19,7
+19,7
@@
package net.pterodactylus.sone.data;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
-import static
com.google.common.base.Preconditions.checkState
;
+import static
java.nio.charset.StandardCharsets.UTF_8
;
import java.util.ArrayList;
import java.util.Collections;
import java.util.ArrayList;
import java.util.Collections;
@@
-126,7
+126,7
@@
public class Profile implements Fingerprintable {
*/
@Nonnull
public Profile setFirstName(@Nullable String firstName) {
*/
@Nonnull
public Profile setFirstName(@Nullable String firstName) {
- this.firstName = firstName;
+ this.firstName =
"".equals(firstName) ? null :
firstName;
return this;
}
return this;
}
@@
-149,7
+149,7
@@
public class Profile implements Fingerprintable {
*/
@Nonnull
public Profile setMiddleName(@Nullable String middleName) {
*/
@Nonnull
public Profile setMiddleName(@Nullable String middleName) {
- this.middleName = middleName;
+ this.middleName =
"".equals(middleName) ? null :
middleName;
return this;
}
return this;
}
@@
-172,7
+172,7
@@
public class Profile implements Fingerprintable {
*/
@Nonnull
public Profile setLastName(@Nullable String lastName) {
*/
@Nonnull
public Profile setLastName(@Nullable String lastName) {
- this.lastName = lastName;
+ this.lastName =
"".equals(lastName) ? null :
lastName;
return this;
}
return this;
}
@@
-282,7
+282,7
@@
public class Profile implements Fingerprintable {
*/
@Nonnull
public List<Field> getFields() {
*/
@Nonnull
public List<Field> getFields() {
- return new ArrayList<
Field
>(fields);
+ return new ArrayList<>(fields);
}
/**
}
/**
@@
-429,34
+429,34
@@
public class Profile implements Fingerprintable {
@Override
public String getFingerprint() {
Hasher hash = Hashing.sha256().newHasher();
@Override
public String getFingerprint() {
Hasher hash = Hashing.sha256().newHasher();
- hash.putString("Profile(");
+ hash.putString("Profile("
, UTF_8
);
if (firstName != null) {
if (firstName != null) {
- hash.putString("FirstName("
).putString(firstName).putString(")"
);
+ hash.putString("FirstName("
, UTF_8).putString(firstName, UTF_8).putString(")", UTF_8
);
}
if (middleName != null) {
}
if (middleName != null) {
- hash.putString("MiddleName("
).putString(middleName).putString(")"
);
+ hash.putString("MiddleName("
, UTF_8).putString(middleName, UTF_8).putString(")", UTF_8
);
}
if (lastName != null) {
}
if (lastName != null) {
- hash.putString("LastName("
).putString(lastName).putString(")"
);
+ hash.putString("LastName("
, UTF_8).putString(lastName, UTF_8).putString(")", UTF_8
);
}
if (birthDay != null) {
}
if (birthDay != null) {
- hash.putString("BirthDay("
).putInt(birthDay).putString(")"
);
+ hash.putString("BirthDay("
, UTF_8).putInt(birthDay).putString(")", UTF_8
);
}
if (birthMonth != null) {
}
if (birthMonth != null) {
- hash.putString("BirthMonth("
).putInt(birthMonth).putString(")"
);
+ hash.putString("BirthMonth("
, UTF_8).putInt(birthMonth).putString(")", UTF_8
);
}
if (birthYear != null) {
}
if (birthYear != null) {
- hash.putString("BirthYear("
).putInt(birthYear).putString(")"
);
+ hash.putString("BirthYear("
, UTF_8).putInt(birthYear).putString(")", UTF_8
);
}
if (avatar != null) {
}
if (avatar != null) {
- hash.putString("Avatar("
).putString(avatar).putString(")"
);
+ hash.putString("Avatar("
, UTF_8).putString(avatar, UTF_8).putString(")", UTF_8
);
}
}
- hash.putString("ContactInformation(");
+ hash.putString("ContactInformation("
, UTF_8
);
for (Field field : fields) {
for (Field field : fields) {
- hash.putString(field.getName()
).putString("(").putString(field.getValue()).putString(")"
);
+ hash.putString(field.getName()
, UTF_8).putString("(", UTF_8).putString(field.getValue(), UTF_8).putString(")", UTF_8
);
}
}
- hash.putString(")");
- hash.putString(")");
+ hash.putString(")"
, UTF_8
);
+ hash.putString(")"
, UTF_8
);
return hash.hash().toString();
}
return hash.hash().toString();
}