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