Add null check for additionalInfo to UserListingModel fromDataModel
This commit is contained in:
parent
d4672f1e60
commit
c18e3f8e3c
|
@ -105,12 +105,14 @@ public class UserListingModel implements DataModel<eu.eudat.data.entities.UserIn
|
||||||
this.lastloggedin = entity.getLastloggedin();
|
this.lastloggedin = entity.getLastloggedin();
|
||||||
// this.additionalinfo = entity.getAdditionalinfo();
|
// this.additionalinfo = entity.getAdditionalinfo();
|
||||||
this.appRoles = entity.getUserRoles().stream().map(item -> item.getRole()).collect(Collectors.toList());
|
this.appRoles = entity.getUserRoles().stream().map(item -> item.getRole()).collect(Collectors.toList());
|
||||||
|
if (entity.getAdditionalinfo() != null) {
|
||||||
try {
|
try {
|
||||||
Map<String, Object> additionalInfo = new ObjectMapper().readValue(entity.getAdditionalinfo(), HashMap.class);
|
Map<String, Object> additionalInfo = new ObjectMapper().readValue(entity.getAdditionalinfo(), HashMap.class);
|
||||||
this.avatarUrl = (String) additionalInfo.get("avatarUrl");
|
this.avatarUrl = (String) additionalInfo.get("avatarUrl");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue