Avoid creating a NPE when closing
This is a performance optimization and improved logging so it doesn't hide problems in the future. Closes #20176
This commit is contained in:
parent
0f481da77f
commit
754aac2f4e
1 changed files with 4 additions and 2 deletions
|
@ -471,9 +471,11 @@ public class DefaultKeycloakSession implements KeycloakSession {
|
|||
try {
|
||||
Consumer<? super Provider> safeClose = p -> {
|
||||
try {
|
||||
p.close();
|
||||
if (p != null) {
|
||||
p.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// Ignore exception
|
||||
LOG.warnf(e, "Unable to close provider %s", p.getClass().getName());
|
||||
}
|
||||
};
|
||||
providers.values().forEach(safeClose);
|
||||
|
|
Loading…
Reference in a new issue