WrenSecurity / wrenam

Community fork of OpenAM, an authentication and authorization system originally developed by ForgeRock.
Other
43 stars 27 forks source link

Fix NPE when global properties are missing. #113

Closed karelmaxa closed 1 year ago

karelmaxa commented 1 year ago

I have fixed the NullPointerException in ConfigurationObserver when no new properties are returned. Related stacktrace:

amSMSEvent:05/25/2023 02:32:34:619 PM CEST: Thread[smIdmThreadPool,5,main]: TransactionId[59021cc5-1b25-4e37-b4fe-2328963f82a1-11]
ERROR: ServiceConfigManagerImpl(:iPlanetAMPlatformService) notifyGlobalConfigChange Error sending notification to ServiceListener: com.sun.identity.common.configuration.ConfigurationObserver
java.lang.NullPointerException: Cannot invoke "java.util.Map.size()" because "m" is null
    at java.base/java.util.concurrent.ConcurrentHashMap.putAll(ConcurrentHashMap.java:1087)
    at java.base/java.util.Properties.putAll(Properties.java:1311)
    at com.iplanet.am.util.SystemProperties.initializeProperties(SystemProperties.java:505)
    at com.sun.identity.common.configuration.ConfigurationObserver.globalConfigChanged(ConfigurationObserver.java:149)
    at com.sun.identity.sm.ServiceConfigManagerImpl.notifyGlobalConfigChange(ServiceConfigManagerImpl.java:484)
    at com.sun.identity.sm.ServiceConfigManagerImpl.objectChanged(ServiceConfigManagerImpl.java:456)
    at com.sun.identity.sm.SMSNotificationManager.sendNotifications(SMSNotificationManager.java:294)
    at com.sun.identity.sm.SMSNotificationManager$LocalChangeNotifcationTask.run(SMSNotificationManager.java:370)
    at org.forgerock.openam.audit.context.AuditRequestContextPropagatingRunnable.run(AuditRequestContextPropagatingRunnable.java:42)
    at com.iplanet.am.util.ThreadPool$WorkerThread.run(ThreadPool.java:314)