Skip to content

Commit

Permalink
Merge pull request #12261 from npamudika/master
Browse files Browse the repository at this point in the history
Fix NPE in JWKS endpoint
  • Loading branch information
npamudika authored Feb 13, 2024
2 parents 13b6312 + 78833d8 commit d7a6a0f
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6852,11 +6852,13 @@ public static void logAuditMessage(String entityType, String entityInfo, String
jsonObject.put("typ", entityType);
jsonObject.put("action", action);
jsonObject.put("performedBy", performedBy);
try {
JSONObject entityInfoJson = (JSONObject) new JSONParser().parse(entityInfo);
jsonObject.put("info", entityInfoJson);
} catch (ParseException ignored) { // if entityInfo cannot be parsed as json, log as a simple string
jsonObject.put("info", entityInfo);
if (entityInfo != null && !StringUtils.isBlank(entityInfo)) {
try {
JSONObject entityInfoJson = (JSONObject) new JSONParser().parse(entityInfo);
jsonObject.put("info", entityInfoJson);
} catch (ParseException ignored) { // if entityInfo cannot be parsed as json, log as a simple string
jsonObject.put("info", entityInfo);
}
}
audit.info(StringEscapeUtils.unescapeJava(jsonObject.toString()));
}
Expand Down

0 comments on commit d7a6a0f

Please sign in to comment.