[KEYCLOAK-8789] Fix getAttribute(String name) implementations so they never return null
- user adapter classes were violating the UserModel contract as the javadoc for the method states that null must never be returned
This commit is contained in:
parent
845195780e
commit
d3a4bef9a4
2 changed files with 3 additions and 2 deletions
|
@ -323,7 +323,7 @@ public abstract class AbstractUserAdapter implements UserModel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getAttribute(String name) {
|
public List<String> getAttribute(String name) {
|
||||||
return null;
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -364,7 +364,8 @@ public abstract class AbstractUserAdapterFederatedStorage implements UserModel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getAttribute(String name) {
|
public List<String> getAttribute(String name) {
|
||||||
return getFederatedStorage().getAttributes(realm, this.getId()).get(name);
|
List<String> result = getFederatedStorage().getAttributes(realm, this.getId()).get(name);
|
||||||
|
return (result == null) ? Collections.emptyList() : result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue