{"record":{"id":"453106f06bd6f683","repo":"flowable/flowable-engine","slug":"created-before-time-is-null","errorCode":null,"errorMessage":"created before time is null","messagePattern":"created before time is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-eventsubscription-service/src/main/java/org/flowable/eventsubscription/service/impl/EventSubscriptionQueryImpl.java","lineNumber":364,"sourceCode":"    @Override\n    public EventSubscriptionQueryImpl scopeType(String scopeType) {\n        if (scopeType == null) {\n            throw new FlowableIllegalArgumentException(\"Provided scope type is null\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.scopeType = scopeType;\n        } else {\n            this.scopeType = scopeType;\n        }\n\n        return this;\n    }\n\n    @Override\n    public EventSubscriptionQueryImpl createdBefore(Date beforeTime) {\n        if (beforeTime == null) {\n            throw new FlowableIllegalArgumentException(\"created before time is null\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.createdBefore = beforeTime;\n        } else {\n            this.createdBefore = beforeTime;\n        }\n\n        return this;\n    }\n\n    @Override\n    public EventSubscriptionQueryImpl createdAfter(Date afterTime) {\n        if (afterTime == null) {\n            throw new FlowableIllegalArgumentException(\"created after time is null\");\n        }\n\n        if (inOrStatement) {","sourceCodeStart":346,"sourceCodeEnd":382,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-eventsubscription-service/src/main/java/org/flowable/eventsubscription/service/impl/EventSubscriptionQueryImpl.java#L346-L382","documentation":"EventSubscriptionQueryImpl.createdBefore() requires a non-null java.util.Date boundary. Flowable throws FlowableIllegalArgumentException when the before-time is null because a null date cannot be translated into a SQL comparison predicate. Query criteria setters are strict about null inputs.","triggerScenarios":"Calling eventSubscriptionQuery.createdBefore(null), typically when the cutoff date is computed from a nullable variable, request parameter, or Date parsing that returned null.","commonSituations":"Building time-window queries where an end date comes from user input or an optional API parameter; SimpleDateFormat.parse failures or unset configuration yielding a null Date.","solutions":["Validate/parse the date before calling createdBefore() and substitute a concrete cutoff (e.g. new Date())","Skip the createdBefore() call when no end boundary is desired","Fix date parsing so it cannot silently return null (check parse errors explicitly)"],"exampleFix":"// before\nquery.createdBefore(userProvidedEnd);\n\n// after\nif (userProvidedEnd != null) {\n    query.createdBefore(userProvidedEnd);\n}","handlingStrategy":"validation","validationCode":"if (beforeTime == null) {\n    beforeTime = new Date();\n}","typeGuard":"boolean validDate(Date d) { return d != null && d.after(new Date(0)); }","tryCatchPattern":"try {\n    query.createdBefore(beforeTime);\n} catch (FlowableIllegalArgumentException e) {\n    log.warn(\"createdBefore null\", e);\n}","preventionTips":["Default date boundaries before query building","Fail fast at the API boundary when a required date is missing","Wrap date parsing so parse failures throw instead of returning null"],"tags":["flowable","query","null-check","date"],"backgroundTag":"null-argument","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"}