{"record":{"id":"c06d3ce60e96aaae","repo":"flowable/flowable-engine","slug":"listener-cannot-be-null","errorCode":null,"errorMessage":"Listener cannot be null.","messagePattern":"Listener cannot be null\\.","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/event/FlowableEventSupport.java","lineNumber":50,"sourceCode":" * Class that allows adding and removing event listeners and dispatching events to the appropriate listeners.\n * \n * @author Frederik Heremans\n */\npublic class FlowableEventSupport {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(FlowableEventSupport.class);\n\n    protected List<FlowableEventListener> eventListeners;\n    protected Map<FlowableEventType, List<FlowableEventListener>> typedListeners;\n\n    public FlowableEventSupport() {\n        eventListeners = new CopyOnWriteArrayList<>();\n        typedListeners = new HashMap<>();\n    }\n\n    public synchronized void addEventListener(FlowableEventListener listenerToAdd) {\n        if (listenerToAdd == null) {\n            throw new FlowableIllegalArgumentException(\"Listener cannot be null.\");\n        }\n        Collection<? extends FlowableEventType> types = listenerToAdd.getTypes();\n        if (types.isEmpty()) {\n            if (!eventListeners.contains(listenerToAdd)) {\n                eventListeners.add(listenerToAdd);\n            }\n        } else {\n            for (FlowableEventType type : types) {\n                addTypedEventListener(listenerToAdd, type);\n            }\n        }\n    }\n\n    public synchronized void addEventListener(FlowableEventListener listenerToAdd, FlowableEventType... types) {\n        if (listenerToAdd == null) {\n            throw new FlowableIllegalArgumentException(\"Listener cannot be null.\");\n        }\n","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/event/FlowableEventSupport.java#L32-L68","documentation":"Null-argument guard in FlowableEventSupport.addEventListener: an attempt was made to register a null event listener (globally or for specific types), which the engine refuses because dispatching to it would NPE.","triggerScenarios":"Thrown at modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/event/FlowableEventSupport.java:50 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a non-null FlowableEventListener instance","Check listener construction/injection (e.g. Spring bean not created) before registering"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}