}
}
private void exceptionAudit(Principal userPrincipal, Map<String, Object> entries, Exception e) {
if (auditManager != null && !disableAudit) {
AuditEvent auditEvent = new AuditEvent(AuditLevel.ERROR);
Map<String, Object> ctxMap = new HashMap<String, Object>();
ctxMap.put("principal", userPrincipal);
ctxMap.putAll(entries);
HttpServletRequest hsr = getServletRequest();
if (hsr != null) {
ctxMap.put("request", WebUtil.deriveUsefulInfo(hsr));
}
ctxMap.put("source", getClass().getCanonicalName());
if (entries != null) {
ctxMap.putAll(entries);
}
auditEvent.setContextMap(ctxMap);
auditEvent.setUnderlyingException(e);
auditManager.audit(auditEvent);
}
}