Skip to content

Commit

Permalink
npe fix for userupdate call from dashboard (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
matallen authored Mar 10, 2021
1 parent fa1ddb3 commit 83cc999
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/main/java/com/redhat/sso/ninja/ManagementController.java
Original file line number Diff line number Diff line change
Expand Up @@ -327,11 +327,18 @@ public Response updateUserProperty(@Context HttpServletRequest request, @PathPar
if (null==userInfo) throw new JsonMappingException("User info for '"+user+"' not found");
for (Entry<String, String> e:values.entrySet()){
String existingValue=userInfo.get(e.getKey());
if (!existingValue.equals(e.getValue())){

if (null==existingValue){ // no existing, value so just add it
userInfo.put(e.getKey(), e.getValue());
// Add an event entry so we know what was changed and when
db.addEvent("User Update", user, e.getKey()+" changed from "+existingValue+" to "+e.getValue());
db.addEvent("User Update", user, e.getKey()+" added as "+e.getValue());
}else{ // value exists, so update it (if it's changed)
if (!existingValue.equals(e.getValue())){
userInfo.put(e.getKey(), e.getValue());
// Add an event entry so we know what was changed and when
db.addEvent("User Update", user, e.getKey()+" changed from "+existingValue+" to "+e.getValue());
}
}

}

// push the new data to the graphs proxy, so when the page refreshes it loads the new values from the proxy
Expand Down

0 comments on commit 83cc999

Please sign in to comment.